本文整理汇总了C++中IBaseMenu::GetDefaultTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ IBaseMenu::GetDefaultTitle方法的具体用法?C++ IBaseMenu::GetDefaultTitle怎么用?C++ IBaseMenu::GetDefaultTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBaseMenu
的用法示例。
在下文中一共展示了IBaseMenu::GetDefaultTitle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetMenuTitle
static cell_t GetMenuTitle(IPluginContext *pContext, const cell_t *params)
{
Handle_t hndl = (Handle_t)params[1];
HandleError err;
IBaseMenu *menu;
if ((err=g_Menus.ReadMenuHandle(params[1], &menu)) != HandleError_None)
{
return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
}
size_t written;
const char *title = menu->GetDefaultTitle();
pContext->StringToLocalUTF8(params[2], params[3], title, &written);
return (cell_t)written;
}
示例2: if
//.........这里部分代码省略.........
ItemDrawInfo dr(text, 0);
/**
* If we have one or the other, we need to have spacers for both.
*/
if (pgn != MENU_NO_PAGINATION)
{
if (displayPrev || displayNext)
{
/* PREVIOUS */
ItemDrawInfo padCtrlItem(NULL, ITEMDRAW_SPACER|ITEMDRAW_CONTROL);
if (displayPrev || canDrawDisabled)
{
if (exitBackButton)
{
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Back", &client))
{
UTIL_Format(text, sizeof(text), "Back");
}
dr.style = ITEMDRAW_CONTROL;
position = panel->DrawItem(dr);
slots[position].type = ItemSel_ExitBack;
}
else
{
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Previous", &client))
{
UTIL_Format(text, sizeof(text), "Previous");
}
dr.style = (displayPrev ? 0 : ITEMDRAW_DISABLED)|ITEMDRAW_CONTROL;
position = panel->DrawItem(dr);
slots[position].type = ItemSel_Back;
}
}
else if (displayNext || exitButton)
{
/* If we can't display this, and there is an exit button,
* we need to pad!
*/
position = panel->DrawItem(padCtrlItem);
slots[position].type = ItemSel_None;
}
/* NEXT */
if (displayNext || canDrawDisabled)
{
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Next", &client))
{
UTIL_Format(text, sizeof(text), "Next");
}
dr.style = (displayNext ? 0 : ITEMDRAW_DISABLED)|ITEMDRAW_CONTROL;
position = panel->DrawItem(dr);
slots[position].type = ItemSel_Next;
}
else if (exitButton)
{
/* If we can't display this,
* but there is an "exit" button, we need to pad!
*/
position = panel->DrawItem(padCtrlItem);
slots[position].type = ItemSel_None;
}
}
else
{
/* Otherwise, bump to two slots! */
ItemDrawInfo numBump(NULL, ITEMDRAW_NOTEXT);
position = panel->DrawItem(numBump);
slots[position].type = ItemSel_None;
position = panel->DrawItem(numBump);
slots[position].type = ItemSel_None;
}
}
/* EXIT */
if (exitButton)
{
if (!logicore.CoreTranslate(text, sizeof(text), "%T", 2, NULL, "Exit", &client))
{
UTIL_Format(text, sizeof(text), "Exit");
}
dr.style = ITEMDRAW_CONTROL;
position = panel->DrawItem(dr);
slots[position].type = ItemSel_Exit;
}
}
/* Lastly, fill in any slots we could have missed */
for (unsigned int i = position + 1; i < 10; i++)
{
slots[i].type = ItemSel_None;
}
/* Do title stuff */
mh->OnMenuDisplay(menu, client, panel);
panel->DrawTitle(menu->GetDefaultTitle(), true);
return panel;
}