本文整理汇总了C++中IBaseMenu::GetDrawStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ IBaseMenu::GetDrawStyle方法的具体用法?C++ IBaseMenu::GetDrawStyle怎么用?C++ IBaseMenu::GetDrawStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBaseMenu
的用法示例。
在下文中一共展示了IBaseMenu::GetDrawStyle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetMenuStyle
static cell_t GetMenuStyle(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);
}
return menu->GetDrawStyle()->GetHandle();
}
示例2: if
IMenuPanel *MenuManager::RenderMenu(int client, menu_states_t &md, ItemOrder order)
{
IBaseMenu *menu = md.menu;
if (!menu)
{
return NULL;
}
struct
{
unsigned int position;
ItemDrawInfo draw;
} drawItems[10];
/* Figure out how many items to draw */
IMenuStyle *style = menu->GetDrawStyle();
unsigned int pgn = menu->GetPagination();
unsigned int maxItems = style->GetMaxPageItems();
bool exitButton = (menu->GetMenuOptionFlags() & MENUFLAG_BUTTON_EXIT) == MENUFLAG_BUTTON_EXIT;
bool novoteButton = (menu->GetMenuOptionFlags() & MENUFLAG_BUTTON_NOVOTE) == MENUFLAG_BUTTON_NOVOTE;
if (pgn != MENU_NO_PAGINATION)
{
maxItems = pgn;
}
else if (exitButton)
{
maxItems--;
}
if (novoteButton)
{
maxItems--;
}
/* This is very not allowed! */
if (maxItems < 2)
{
return NULL;
}
unsigned int totalItems = menu->GetItemCount();
unsigned int startItem = 0;
/* For pagination, find the starting point. */
if (pgn != MENU_NO_PAGINATION)
{
if (order == ItemOrder_Ascending)
{
startItem = md.lastItem;
/* This shouldn't happen with well-coded menus.
* If the item is out of bounds, switch the order to
* Items_Descending and make us start from the top.
*/
if (startItem >= totalItems)
{
startItem = totalItems - 1;
order = ItemOrder_Descending;
}
}
else if (order == ItemOrder_Descending)
{
startItem = md.firstItem;
/* This shouldn't happen with well-coded menus.
* If searching backwards doesn't give us enough room,
* start from the beginning and change to ascending.
*/
if (startItem <= maxItems)
{
startItem = 0;
order = ItemOrder_Ascending;
}
}
}
/* Get our Display pointer and initialize some crap */
IMenuPanel *panel = menu->CreatePanel();
IMenuHandler *mh = md.mh;
bool foundExtra = false;
unsigned int extraItem = 0;
if (panel == NULL)
{
return NULL;
}
/**
* We keep searching until:
* 1) There are no more items
* 2) We reach one OVER the maximum number of slot items
* 3) We have reached maxItems and pagination is MENU_NO_PAGINATION
*/
unsigned int i = startItem;
unsigned int foundItems = 0;
while (totalItems)
{
ItemDrawInfo &dr = drawItems[foundItems].draw;
/* Is the item valid? */
if (menu->GetItemInfo(i, &dr) != NULL)
//.........这里部分代码省略.........