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.

59 lines
1.3 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef LABELEDCOMMANDCOMBOBOX_H
  8. #define LABELEDCOMMANDCOMBOBOX_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui_controls/ComboBox.h>
  13. #include <vgui_controls/Label.h>
  14. #include <vgui_controls/Panel.h>
  15. #include "utlvector.h"
  16. class CLabeledCommandComboBox : public vgui::ComboBox
  17. {
  18. DECLARE_CLASS_SIMPLE( CLabeledCommandComboBox, vgui::ComboBox );
  19. public:
  20. CLabeledCommandComboBox(vgui::Panel *parent, const char *panelName);
  21. ~CLabeledCommandComboBox();
  22. virtual void DeleteAllItems();
  23. virtual void AddItem(char const *text, char const *engineCommand);
  24. virtual void ActivateItem(int itemIndex);
  25. const char *GetActiveItemCommand();
  26. void SetInitialItem(int itemIndex);
  27. void ApplyChanges();
  28. void Reset();
  29. bool HasBeenModified();
  30. enum
  31. {
  32. MAX_NAME_LEN = 256,
  33. MAX_COMMAND_LEN = 256
  34. };
  35. private:
  36. MESSAGE_FUNC_CHARPTR( OnTextChanged, "TextChanged", text );
  37. struct COMMANDITEM
  38. {
  39. char name[ MAX_NAME_LEN ];
  40. char command[ MAX_COMMAND_LEN ];
  41. int comboBoxID;
  42. };
  43. CUtlVector< COMMANDITEM > m_Items;
  44. int m_iCurrentSelection;
  45. int m_iStartSelection;
  46. };
  47. #endif // LABELEDCOMMANDCOMBOBOX_H