#ifndef __SDL_SIMPLE_BUTTON_WIDGET_HEADER__ #define __SDL_SIMPLE_BUTTON_WIDGET_HEADER__ #include "../core/coreWidget.h" #include "../core/coreLabel.h" class classGUI_SDL; class sdlSimpleButtonWidget : public sdlCoreWidget { private: uint8_t m_bState; sdlLabel* m_pLabel; bool m_bToggleEnabled; bool m_bReadOnly; bool m_bUnderCursor; protected: virtual void drawBefore(SDL_Renderer* pRenderer); public: explicit sdlSimpleButtonWidget(CSTR text, int x, int y, int width, int height, sdlCoreWidget* pParent = NULL); ~sdlSimpleButtonWidget(); virtual void dispatch(SDL_Event* pEvt); void setToggle(bool enable) { m_bToggleEnabled = enable; }; void setReadOnly(bool a) { m_bReadOnly = a; }; void setToggled(bool a) { if (m_bToggleEnabled && a) m_bState = 3; if (m_bToggleEnabled && !a) m_bState = 0; }; /*emitters*/ void (*Pushed)(void) = NULL; void (*Toggled)(void) = NULL; void (*UnToggled)(void) = NULL; friend classGUI_SDL; }; #endif