Team Fortress 2 Source Code as on 22/4/2020
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.

54 lines
1.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #ifndef TOGGLEBUTTON_H
  8. #define TOGGLEBUTTON_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui/VGUI.h>
  13. #include <vgui_controls/Button.h>
  14. namespace vgui
  15. {
  16. //-----------------------------------------------------------------------------
  17. // Purpose: Type of button that when pressed stays selected & depressed until pressed again
  18. //-----------------------------------------------------------------------------
  19. class ToggleButton : public Button
  20. {
  21. DECLARE_CLASS_SIMPLE( ToggleButton, Button );
  22. public:
  23. ToggleButton(Panel *parent, const char *panelName, const char *text);
  24. virtual void DoClick();
  25. /* messages sent (get via AddActionSignalTarget()):
  26. "ButtonToggled"
  27. int "state"
  28. */
  29. protected:
  30. // overrides
  31. virtual void OnMouseDoublePressed(MouseCode code);
  32. virtual Color GetButtonFgColor();
  33. virtual void ApplySchemeSettings(IScheme *pScheme);
  34. virtual bool CanBeDefaultButton(void);
  35. virtual void OnKeyCodePressed(KeyCode code);
  36. private:
  37. Color _selectedColor;
  38. };
  39. } // namespace vgui
  40. #endif // TOGGLEBUTTON_H