Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.5 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose: Core Movie Maker UI API
  4. //
  5. //=============================================================================
  6. #ifndef TOOLMENUBUTTON_H
  7. #define TOOLMENUBUTTON_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "vgui_controls/menubutton.h"
  12. #include "tier1/utldict.h"
  13. #include "tier1/UtlSymbol.h"
  14. //-----------------------------------------------------------------------------
  15. // Base class for tools menus
  16. //-----------------------------------------------------------------------------
  17. class CToolMenuButton : public vgui::MenuButton
  18. {
  19. DECLARE_CLASS_SIMPLE( CToolMenuButton, vgui::MenuButton );
  20. public:
  21. CToolMenuButton( vgui::Panel *parent, const char *panelName, const char *text, vgui::Panel *actionTarget );
  22. virtual void OnShowMenu(vgui::Menu *menu);
  23. vgui::Menu *GetMenu();
  24. // Add a simple text item to the menu
  25. virtual int AddMenuItem( char const *itemName, const char *itemText, KeyValues *message, Panel *target, const KeyValues *userData = NULL, char const *kbcommandname = NULL );
  26. virtual int AddCheckableMenuItem( char const *itemName, const char *itemText, KeyValues *message, Panel *target, const KeyValues *userData = NULL, char const *kbcommandname = NULL );
  27. // Wide-character version to add a simple text item to the menu
  28. virtual int AddMenuItem( char const *itemName, const wchar_t *itemText, KeyValues *message, Panel *target, const KeyValues *userData = NULL, char const *kbcommandname = NULL );
  29. virtual int AddCheckableMenuItem( char const *itemName, const wchar_t *itemText, KeyValues *message, Panel *target, const KeyValues *userData = NULL, char const *kbcommandname = NULL );
  30. virtual int FindMenuItem( char const *itemName );
  31. virtual vgui::MenuItem *GetMenuItem( int itemID );
  32. virtual void AddSeparatorAfterItem( char const *itemName );
  33. virtual void MoveMenuItem( int itemID, int moveBeforeThisItemID );
  34. virtual void SetItemEnabled( int itemID, bool state );
  35. // Pass in a NULL binding to clear it
  36. virtual void SetCurrentKeyBindingLabel( char const *itemName, char const *binding );
  37. virtual void AddSeparator();
  38. void Reset();
  39. protected:
  40. void UpdateMenuItemKeyBindings();
  41. vgui::Menu *m_pMenu;
  42. vgui::Panel *m_pActionTarget;
  43. struct MenuItem_t
  44. {
  45. MenuItem_t()
  46. : m_ItemID( 0 ),
  47. m_KeyBinding( UTL_INVAL_SYMBOL )
  48. {
  49. }
  50. unsigned short m_ItemID;
  51. CUtlSymbol m_KeyBinding;
  52. };
  53. CUtlDict< MenuItem_t, unsigned short > m_Items;
  54. };
  55. #endif // TOOLMENUBUTTON_H