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.

74 lines
1.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef CHECKBUTTONLIST_H
  7. #define CHECKBUTTONLIST_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include <vgui_controls/EditablePanel.h>
  12. #include "utlvector.h"
  13. namespace vgui
  14. {
  15. //-----------------------------------------------------------------------------
  16. // Purpose: Contains a list of check boxes, displaying scrollbars if necessary
  17. //-----------------------------------------------------------------------------
  18. class CheckButtonList : public EditablePanel
  19. {
  20. DECLARE_CLASS_SIMPLE( CheckButtonList, EditablePanel );
  21. public:
  22. CheckButtonList(Panel *parent, const char *name);
  23. ~CheckButtonList();
  24. // adds a check button to the list
  25. int AddItem(const char *itemText, bool startsSelected, KeyValues *userData);
  26. // clears the list
  27. void RemoveAll();
  28. // number of items in list that are checked
  29. int GetCheckedItemCount();
  30. // item iteration
  31. bool IsItemIDValid(int itemID);
  32. int GetHighestItemID();
  33. int GetItemCount();
  34. // item info
  35. KeyValues *GetItemData(int itemID);
  36. bool IsItemChecked(int itemID);
  37. void SetItemCheckable(int itemID, bool state);
  38. /* MESSAGES SENT
  39. "CheckButtonChecked" - sent when one of the check buttons state has changed
  40. */
  41. protected:
  42. virtual void PerformLayout();
  43. virtual void ApplySchemeSettings(IScheme *pScheme);
  44. virtual void OnMouseWheeled(int delta);
  45. private:
  46. MESSAGE_FUNC_PARAMS( OnCheckButtonChecked, "CheckButtonChecked", pParams );
  47. MESSAGE_FUNC( OnScrollBarSliderMoved, "ScrollBarSliderMoved" );
  48. struct CheckItem_t
  49. {
  50. vgui::CheckButton *checkButton;
  51. KeyValues *userData;
  52. };
  53. CUtlVector<CheckItem_t> m_CheckItems;
  54. vgui::ScrollBar *m_pScrollBar;
  55. };
  56. }
  57. #endif // CHECKBUTTONLIST_H