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
2.2 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef RADIOBUTTON_H
  8. #define RADIOBUTTON_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui/vgui.h>
  13. #include <vgui_controls/ToggleButton.h>
  14. class RadioImage;
  15. namespace vgui
  16. {
  17. //-----------------------------------------------------------------------------
  18. // Purpose: Radio buttons are automatically selected into groups by who their
  19. // parent is. At most one radio button is active at any time.
  20. //-----------------------------------------------------------------------------
  21. class RadioButton : public ToggleButton
  22. {
  23. DECLARE_CLASS_SIMPLE( RadioButton, ToggleButton );
  24. public:
  25. RadioButton(Panel *parent, const char *panelName, const char *text);
  26. ~RadioButton();
  27. // Set the radio button checked. When a radio button is checked, a
  28. // message is sent to all other radio buttons in the same group so
  29. // they will become unchecked.
  30. virtual void SetSelected(bool state);
  31. // Get the tab position of the radio button with the set of radio buttons
  32. // A group of RadioButtons must have the same TabPosition, with [1, n] subtabpositions
  33. virtual int GetSubTabPosition();
  34. virtual void SetSubTabPosition(int position);
  35. // Return the RadioButton's real tab position (its Panel one changes)
  36. virtual int GetRadioTabPosition();
  37. protected:
  38. virtual void DoClick();
  39. virtual void Paint();
  40. virtual void ApplySchemeSettings(IScheme *pScheme);
  41. MESSAGE_FUNC_INT( OnRadioButtonChecked, "RadioButtonChecked", tabposition);
  42. virtual void OnKeyCodeTyped(KeyCode code);
  43. virtual IBorder *GetBorder(bool depressed, bool armed, bool selected, bool keyfocus);
  44. virtual void ApplySettings(KeyValues *inResourceData);
  45. virtual void GetSettings(KeyValues *outResourceData);
  46. virtual const char *GetDescription();
  47. virtual void PerformLayout();
  48. RadioButton *FindBestRadioButton(int direction);
  49. private:
  50. RadioImage *_radioBoxImage;
  51. int _oldTabPosition;
  52. Color _selectedFgColor;
  53. int _subTabPosition; // tab position with the radio button list
  54. };
  55. }; // namespace vgui
  56. #endif // RADIOBUTTON_H