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.

26 lines
795 B

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __SDL_BUTTON_WIDGET_HEADER__
  2. #define __SDL_BUTTON_WIDGET_HEADER__
  3. #include "../core/coreWidget.h"
  4. #include "../core/coreLabel.h"
  5. class classGUI_SDL;
  6. class sdlButtonWidget : public sdlCoreWidget {
  7. private:
  8. uint8_t m_bState;
  9. sdlLabel * m_pLabel;
  10. bool m_bToggleEnabled;
  11. bool m_bUnderCursor;
  12. protected:
  13. virtual void drawBefore(SDL_Renderer* pRenderer);
  14. public:
  15. explicit sdlButtonWidget(CSTR text, int x, int y, int width, int height, sdlCoreWidget* pParent = NULL);
  16. ~sdlButtonWidget();
  17. virtual void dispatch(SDL_Event* pEvt);
  18. void setToggle(bool enable) { m_bToggleEnabled = enable; };
  19. /*emitters*/
  20. void (*Pushed)(void) = NULL;
  21. void (*Toggled)(void) = NULL;
  22. void (*UnToggled)(void) = NULL;
  23. friend classGUI_SDL;
  24. };
  25. #endif