SourceMod SDK  1.7
SourceMod::IBaseMenu Class Referenceabstract

High-level interface for building menus. More...

#include <public/IMenuManager.h>

Public Member Functions

virtual bool AppendItem (const char *info, const ItemDrawInfo &draw)=0
 Appends an item to the end of a menu. More...
 
virtual bool InsertItem (unsigned int position, const char *info, const ItemDrawInfo &draw)=0
 Inserts an item into the menu before a certain position; the new item will be at the given position and all next items pushed forward. More...
 
virtual bool RemoveItem (unsigned int position)=0
 Removes an item from the menu. More...
 
virtual void RemoveAllItems ()=0
 Removes all items from the menu.
 
virtual const char * GetItemInfo (unsigned int position, ItemDrawInfo *draw)=0
 Returns an item's info. More...
 
virtual unsigned int GetItemCount ()=0
 Returns the number of items. More...
 
virtual bool SetPagination (unsigned int itemsPerPage)=0
 Sets the menu's pagination,. More...
 
virtual unsigned int GetPagination ()=0
 Returns an item's pagination. More...
 
virtual IMenuStyleGetDrawStyle ()=0
 Returns the menu style. More...
 
virtual void SetDefaultTitle (const char *message)=0
 Sets the menu's display title/message. More...
 
virtual const char * GetDefaultTitle ()=0
 Returns the menu's display/title message. More...
 
virtual bool SetExtOption (MenuOption option, const void *valuePtr)=0
 Sets an extended menu option. More...
 
virtual IMenuPanelCreatePanel ()=0
 Creates a new IMenuPanel object using extended options specific to the IMenuStyle parent. Titles, items, etc, are not copied. More...
 
virtual bool Display (int client, unsigned int time, IMenuHandler *alt_handler=NULL)=0
 Sends the menu to a client. More...
 
virtual void Destroy (bool releaseHandle=true)=0
 Destroys the menu and frees all associated resources. More...
 
virtual void Cancel ()=0
 Cancels the menu on all client's displays. While the menu is being cancelled, the menu may not be re-displayed to any clients. If a vote menu is currently active, it will be cancelled as well. More...
 
virtual Handle_t GetHandle ()=0
 Returns the menu's Handle. The Handle is automatically removed when the menu is destroyed. More...
 
virtual unsigned int GetMenuOptionFlags ()=0
 Returns menu option flags. More...
 
virtual void SetMenuOptionFlags (unsigned int flags)=0
 Sets menu option flags. More...
 
virtual IMenuHandlerGetHandler ()=0
 Returns the menu's handler. More...
 
virtual bool DisplayAtItem (int client, unsigned int time, unsigned int start_item, IMenuHandler *alt_handler=NULL)=0
 Sends the menu to a client, starting from the given item number. More...
 
virtual unsigned int GetApproxMemUsage ()=0
 For the Handle system, returns approximate memory usage. More...
 

Detailed Description

High-level interface for building menus.

Member Function Documentation

virtual bool SourceMod::IBaseMenu::AppendItem ( const char *  info,
const ItemDrawInfo draw 
)
pure virtual

Appends an item to the end of a menu.

Parameters
infoItem information string.
drawDefault drawing information.
Returns
True on success, false on item limit reached.
virtual void SourceMod::IBaseMenu::Cancel ( )
pure virtual

Cancels the menu on all client's displays. While the menu is being cancelled, the menu may not be re-displayed to any clients. If a vote menu is currently active, it will be cancelled as well.

Returns
Number of menus cancelled.
virtual IMenuPanel* SourceMod::IBaseMenu::CreatePanel ( )
pure virtual

Creates a new IMenuPanel object using extended options specific to the IMenuStyle parent. Titles, items, etc, are not copied.

Note: The object should be freed with IMenuPanel::DeleteThis.

Returns
IMenuPanel pointer.
virtual void SourceMod::IBaseMenu::Destroy ( bool  releaseHandle = true)
pure virtual

Destroys the menu and frees all associated resources.

Parameters
releaseHandleIf true, the Handle will be released in the destructor. This should be set to true except for IHandleTypeDispatch destructors.
virtual bool SourceMod::IBaseMenu::Display ( int  client,
unsigned int  time,
IMenuHandler alt_handler = NULL 
)
pure virtual

Sends the menu to a client.

Parameters
clientClient index to display to.
timeTime to hold menu for.
alt_handlerAlternate IMenuHandler.
Returns
True on success, false otherwise.
virtual bool SourceMod::IBaseMenu::DisplayAtItem ( int  client,
unsigned int  time,
unsigned int  start_item,
IMenuHandler alt_handler = NULL 
)
pure virtual

Sends the menu to a client, starting from the given item number.

Note: this API call was added in v13.

Parameters
clientClient index to display to.
timeTime to hold menu for.
start_itemStarting item to draw.
alt_handlerAlternate IMenuHandler.
Returns
True on success, false otherwise.
virtual unsigned int SourceMod::IBaseMenu::GetApproxMemUsage ( )
pure virtual

For the Handle system, returns approximate memory usage.

Returns
Approximate number of bytes being used.
virtual const char* SourceMod::IBaseMenu::GetDefaultTitle ( )
pure virtual

Returns the menu's display/title message.

Returns
Message string.
virtual IMenuStyle* SourceMod::IBaseMenu::GetDrawStyle ( )
pure virtual

Returns the menu style.

Returns
Menu style.
virtual Handle_t SourceMod::IBaseMenu::GetHandle ( )
pure virtual

Returns the menu's Handle. The Handle is automatically removed when the menu is destroyed.

Returns
Handle_t handle value.
virtual IMenuHandler* SourceMod::IBaseMenu::GetHandler ( )
pure virtual

Returns the menu's handler.

Returns
IMenuHandler of the menu.
virtual unsigned int SourceMod::IBaseMenu::GetItemCount ( )
pure virtual

Returns the number of items.

Returns
Number of items in the menu.
virtual const char* SourceMod::IBaseMenu::GetItemInfo ( unsigned int  position,
ItemDrawInfo draw 
)
pure virtual

Returns an item's info.

Parameters
positionPosition, starting from 0.
drawOptional pointer to store a draw information.
Returns
Info string pointer, or NULL if position was invalid.
virtual unsigned int SourceMod::IBaseMenu::GetMenuOptionFlags ( )
pure virtual

Returns menu option flags.

Returns
Menu option flags.
virtual unsigned int SourceMod::IBaseMenu::GetPagination ( )
pure virtual

Returns an item's pagination.

Returns
Pagination setting.
virtual bool SourceMod::IBaseMenu::InsertItem ( unsigned int  position,
const char *  info,
const ItemDrawInfo draw 
)
pure virtual

Inserts an item into the menu before a certain position; the new item will be at the given position and all next items pushed forward.

Parameters
positionPosition, starting from 0.
infoItem information string.
drawDefault item draw info.
Returns
True on success, false on invalid menu position
virtual bool SourceMod::IBaseMenu::RemoveItem ( unsigned int  position)
pure virtual

Removes an item from the menu.

Parameters
positionPosition, starting from 0.
Returns
True on success, false on invalid menu position.
virtual void SourceMod::IBaseMenu::SetDefaultTitle ( const char *  message)
pure virtual

Sets the menu's display title/message.

Parameters
messageMessage (format options allowed).
virtual bool SourceMod::IBaseMenu::SetExtOption ( MenuOption  option,
const void *  valuePtr 
)
pure virtual

Sets an extended menu option.

Parameters
optionOption type.
valuePtrPointer of the type expected by the option.
Returns
True on success, false if option or value is not supported.
virtual void SourceMod::IBaseMenu::SetMenuOptionFlags ( unsigned int  flags)
pure virtual

Sets menu option flags.

Parameters
flagsMenu option flags.
virtual bool SourceMod::IBaseMenu::SetPagination ( unsigned int  itemsPerPage)
pure virtual

Sets the menu's pagination,.

If pagination is set to MENU_NO_PAGINATION, and the previous pagination was not MENU_NO_PAGINATION, then the MENUFLAG_BUTTON_EXIT is unset. It can be re-applied if desired.

Parameters
itemsPerPageNumber of items per page, or MENU_NO_PAGINATION.
Returns
True on success, false if itemsPerPage is too large.

The documentation for this class was generated from the following file: