aboutsummaryrefslogtreecommitdiff
path: root/mp/src/public/vgui_controls/Menu.h
diff options
context:
space:
mode:
Diffstat (limited to 'mp/src/public/vgui_controls/Menu.h')
-rw-r--r--mp/src/public/vgui_controls/Menu.h25
1 files changed, 24 insertions, 1 deletions
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