|
Public Member Functions |
| CMenu (const char *a_pcTitle) |
virtual | ~CMenu () |
virtual CMenuItem * | AddMenuItem (const char *a_pcUtf8Text, SDLKey a_tShortcut=SDLK_UNKNOWN, int a_iCode=0) |
virtual CEnumMenuItem * | AddEnumMenuItem (const char *a_pcUtf8Text, int a_iInitialValue, const char **a_ppcNames, const int *a_piValues, int a_iCode=0) |
virtual CTextMenuItem * | AddTextMenuItem (const char *a_pcTitle, const char *a_pcValue, int a_iCode=0) |
virtual CMenuItem * | AddMenuItem (CMenuItem *a_poItem) |
virtual void | AddOkCancel (int a_iOkCode=0) |
virtual CMenuItem * | GetMenuItem (int a_iCode) const |
virtual void | ItemActivated (int a_iItemCode, CMenuItem *a_poMenuItem) |
virtual void | ItemChanged (int a_iItemCode, int a_iValue, CMenuItem *a_poMenuItem) |
virtual int | Run () |
| Run executes the menus, maybe invoking submenus as well.
|
virtual void | Draw () |
virtual void | Clear () |
virtual void | EnterName (const char *a_pcTitle, std::string &a_rsTarget, CTextMenuItem *a_poMenuItem, int a_iMaxlen) |
Protected Types |
typedef std::vector< CMenuItem * > | CItemList |
typedef CItemList::iterator | CItemIterator |
Protected Member Functions |
virtual void | FocusNext () |
virtual void | FocusPrev () |
virtual void | InvokeSubmenu (CMenu *a_poSubmenu) |
Protected Attributes |
std::string | m_sTitle |
CItemList | m_oItems |
int | m_iCurrentItem |
int | m_iReturnCode |
bool | m_bDone |
Menus are displayed over the current screen and allow for the editing of the game's state, SState. If you think in terms of model, view and controller, then SState is the model and CMenu is both the view and the controller.
Menus have menu items. The items in turn can edit various state variables or invoke submenus. The menu ends then the user exits the toplevel menu or invokes a command which unrolls the entire menu stack.