SourceMod::ITopMenu Class Reference

"Top menu" interface, for managing top-level categorized menus. More...

#include <public/extensions/ITopMenus.h>

List of all members.

Public Member Functions

virtual unsigned int AddToMenu (const char *name, TopMenuObjectType type, ITopMenuObjectCallbacks *callbacks, IdentityToken_t *owner, const char *cmdname, FlagBits flags, unsigned int parent)=0
 Creates and adds an object type type to the top menu.
virtual void RemoveFromMenu (unsigned int object_id)=0
 Removes an object from a menu. If the object has any children, those will be removed.
virtual bool DisplayMenu (int client, unsigned int hold_time, TopMenuPosition position)=0
 Sends the main menu to a given client.
virtual bool LoadConfiguration (const char *file, char *error, size_t maxlength)=0
 Loads a configuration file for organizing the menu. This forces all known categories to be re-sorted.
virtual unsigned int FindCategory (const char *name)=0
 Finds a category's ID by name.
virtual unsigned int AddToMenu2 (const char *name, TopMenuObjectType type, ITopMenuObjectCallbacks *callbacks, IdentityToken_t *owner, const char *cmdname, FlagBits flags, unsigned int parent, const char *info_string)=0
 Creates and adds an object type type to the top menu.
virtual const char * GetObjectInfoString (unsigned int object_id)=0
 Returns an object's info string.
virtual const char * GetObjectName (unsigned int object_id)=0
 Returns an object's name string.


Detailed Description

"Top menu" interface, for managing top-level categorized menus.

Definition at line 165 of file ITopMenus.h.


Member Function Documentation

virtual unsigned int SourceMod::ITopMenu::AddToMenu ( const char *  name,
TopMenuObjectType  type,
ITopMenuObjectCallbacks callbacks,
IdentityToken_t *  owner,
const char *  cmdname,
FlagBits  flags,
unsigned int  parent 
) [pure virtual]

Creates and adds an object type type to the top menu.

Parameters:
name Unique, string name to give the object.
type Object type.
callbacks ITopMenuObjectCallbacks pointer.
owner IdentityToken_t owner of the object.
cmdname Command name used for override access checks. If NULL or empty, access will not be Checked.
flags Default flag(s) to use for access checks.
parent Parent object, or 0 if none. Currently, categories cannot have a parent, and items must have a category parent.
Returns:
An object ID, or 0 on failure.

virtual void SourceMod::ITopMenu::RemoveFromMenu ( unsigned int  object_id  )  [pure virtual]

Removes an object from a menu. If the object has any children, those will be removed.

Parameters:
object_id Object ID returned from AddToMenu.

virtual bool SourceMod::ITopMenu::DisplayMenu ( int  client,
unsigned int  hold_time,
TopMenuPosition  position 
) [pure virtual]

Sends the main menu to a given client.

Once the menu is drawn to a client, the drawing order is cached. If text on the menu is rendered differently for the client's next viewing, the text will render properly, but its order will not change. The menu is sorted by its configuration. Remaining items are sorted in alphabetical order using the initial display text.

Parameters:
client Client index.
hold_time Time to hold the menu on the screen for.
position TopMenuPosition enumeration value.
Returns:
True on success, false if nothing displayed.

virtual bool SourceMod::ITopMenu::LoadConfiguration ( const char *  file,
char *  error,
size_t  maxlength 
) [pure virtual]

Loads a configuration file for organizing the menu. This forces all known categories to be re-sorted.

Only one configuration can be active at a time. Loading a new one will cause the old sorting to disappear.

Parameters:
file File path.
error Error buffer.
maxlength Maximum length of the error buffer.
Returns:
True on success, false on failure.

virtual unsigned int SourceMod::ITopMenu::FindCategory ( const char *  name  )  [pure virtual]

Finds a category's ID by name.

Parameters:
name Category's name.
Returns:
Object ID of the category, or 0 if none.

virtual unsigned int SourceMod::ITopMenu::AddToMenu2 ( const char *  name,
TopMenuObjectType  type,
ITopMenuObjectCallbacks callbacks,
IdentityToken_t *  owner,
const char *  cmdname,
FlagBits  flags,
unsigned int  parent,
const char *  info_string 
) [pure virtual]

Creates and adds an object type type to the top menu.

Parameters:
name Unique, string name to give the object.
type Object type.
callbacks ITopMenuObjectCallbacks pointer.
owner IdentityToken_t owner of the object.
cmdname Command name used for override access checks. If NULL or empty, access will not be Checked.
flags Default flag(s) to use for access checks.
parent Parent object, or 0 if none. Currently, categories cannot have a parent, and items must have a category parent.
info_string Optional info string to attach to the object. Only 255 bytes of the string (including null terminator) will be stored.
Returns:
An object ID, or 0 on failure.

virtual const char* SourceMod::ITopMenu::GetObjectInfoString ( unsigned int  object_id  )  [pure virtual]

Returns an object's info string.

Parameters:
object_id Object ID.
Returns:
Object's info string, or NULL if none.

virtual const char* SourceMod::ITopMenu::GetObjectName ( unsigned int  object_id  )  [pure virtual]

Returns an object's name string.

Parameters:
object_id Object ID.
Returns:
Object's name string, or NULL if none.


The documentation for this class was generated from the following file:
Generated on Fri Nov 21 06:10:04 2008 for SourceMod SDK by  doxygen 1.5.1