From 0d8dceea4310fde5706b3ce1c70609d72a38efdf Mon Sep 17 00:00:00 2001 From: John Schoenick Date: Wed, 9 Sep 2015 18:35:41 -0700 Subject: Updated the SDK with the latest code from the TF and HL2 branches. --- mp/src/public/vgui_controls/Menu.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'mp/src/public/vgui_controls/Menu.h') diff --git a/mp/src/public/vgui_controls/Menu.h b/mp/src/public/vgui_controls/Menu.h index 2b374373..77937335 100644 --- a/mp/src/public/vgui_controls/Menu.h +++ b/mp/src/public/vgui_controls/Menu.h @@ -216,7 +216,7 @@ public: virtual int GetActiveItem(); // returns the itemID (not the row) of the active item // Return the number of items currently in the menu list - virtual int GetItemCount(); + virtual int GetItemCount() const; // return the menuID of the n'th item in the menu list, valid from [0, GetItemCount) virtual int GetMenuID(int index); @@ -351,6 +351,29 @@ private: double m_fLastTypeAheadTime; }; + +//----------------------------------------------------------------------------- +// Helper class to create menu +//----------------------------------------------------------------------------- +class MenuBuilder +{ +public: + + MenuBuilder( Menu *pMenu, Panel *pActionTarget ); + + MenuItem* AddMenuItem( const char *pszButtonText, const char *pszCommand, const char *pszCategoryName ); + + MenuItem* AddCascadingMenuItem( const char *pszButtonText, Menu *pSubMenu, const char *pszCategoryName ); + +private: + + void AddSepratorIfNeeded( const char *pszCategoryName ); + + Menu *m_pMenu; + Panel *m_pActionTarget; + const char *m_pszLastCategory; +}; + } // namespace vgui #endif // MENU_H -- cgit v1.2.3