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.

75 lines
1.9 KiB

  1. //========= Copyright 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef CHECKBUTTON_H
  8. #define CHECKBUTTON_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui/vgui.h>
  13. #include <vgui_controls/ToggleButton.h>
  14. class CheckImage;
  15. namespace vgui
  16. {
  17. class TextImage;
  18. //-----------------------------------------------------------------------------
  19. // Purpose: Tick-box button
  20. //-----------------------------------------------------------------------------
  21. class CheckButton : public ToggleButton
  22. {
  23. DECLARE_CLASS_SIMPLE( CheckButton, ToggleButton );
  24. public:
  25. CheckButton(Panel *parent, const char *panelName, const char *text);
  26. ~CheckButton();
  27. // Check the button
  28. virtual void SetSelected(bool state );
  29. // Left4Dead:
  30. void SetCheckDrawMode( int mode );
  31. // sets whether or not the state of the check can be changed
  32. // if this is set to false, then no input in the code or by the user can change it's state
  33. virtual void SetCheckButtonCheckable(bool state);
  34. virtual bool IsCheckButtonCheckable() const { return m_bCheckButtonCheckable; }
  35. Color GetDisabledFgColor() { return _disabledFgColor; }
  36. Color GetDisabledBgColor() { return _disabledBgColor; }
  37. protected:
  38. virtual void ApplySchemeSettings(IScheme *pScheme);
  39. MESSAGE_FUNC_PTR( OnCheckButtonChecked, "CheckButtonChecked", panel );
  40. virtual Color GetButtonFgColor();
  41. virtual IBorder *GetBorder(bool depressed, bool armed, bool selected, bool keyfocus);
  42. /* MESSAGES SENT
  43. "CheckButtonChecked" - sent when the check button state is changed
  44. "state" - button state: 1 is checked, 0 is unchecked
  45. */
  46. private:
  47. enum { CHECK_INSET = 6 };
  48. bool m_bCheckButtonCheckable;
  49. CheckImage *_checkBoxImage;
  50. Color _selectedFgColor;
  51. Color _disabledFgColor;
  52. Color _disabledBgColor;
  53. Color _highlightFgColor;
  54. };
  55. } // namespace vgui
  56. #endif // CHECKBUTTON_H