GUI
|
Button widget. That rectangular thing with inscription on it. More...
#include <Button.h>
Inherits gui::Widget.
Inherited by CustomWidget.
Public Member Functions | |
Button (GUISystem *guiSystem, int x, int y, int w, int h, std::string text) | |
virtual | ~Button () |
virtual void | render (Renderer *renderer) |
void | stateChange (Widget::State state) |
void | setText (const std::string &text) |
![]() | |
Widget () | |
Widget (int x, int y, int w, int h) | |
virtual | ~Widget () |
virtual void | keyChar (int uchar) |
virtual void | keyDown (int keyCode) |
virtual void | mouseMove (int x, int y) |
virtual void | focusIn () |
virtual void | focusOut () |
void | addChild (Widget *widget) |
void | removeChild (Widget *widget) |
void | setParent (Widget *widget) |
void | resize (int x, int y, int w, int h) |
void | updateAbs () |
void | setVisibility (bool visible) |
bool | contain (int posX, int posY) |
bool | isFocused () |
State | getState () |
![]() | |
EventEmitter () | |
virtual | ~EventEmitter () |
void | setQueue (AddToQueue addFunction) |
Assigns addToQueue function so the events can be sent to the queue. More... | |
EventListener::Id | addEventListener (EventType eventType, EventListener::Function listenerFunc) |
Adds an event listener. More... | |
void | removeEventListener (EventListener::Id listenerId) |
Removes an event listener. More... | |
void | emitEvent (Event &event) |
Emits an event. More... | |
Public Attributes | |
Color | upStateColor |
Color | hoverStateColor |
Color | downStateColor |
Color | textColor |
Private Attributes | |
std::string | text |
Additional Inherited Members | |
![]() | |
enum | states { STATE_HOVER, STATE_DOWN, STATE_UP } |
typedef char | State |
![]() | |
typedef std::multimap< EventType, EventListener > | Map |
![]() | |
int | x |
int | y |
int | w |
int | h |
int | xAbs |
int | yAbs |
int | state |
bool | focused |
bool | visible |
![]() | |
GUISystem * | guiSystem |
Button widget. That rectangular thing with inscription on it.
Button::Button | ( | GUISystem * | guiSystem, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h, | ||
std::string | text | ||
) |
Definition at line 12 of file Button.cpp.
References gui::EventEmitter::guiSystem.
|
inlinevirtual |
Definition at line 24 of file Button.h.
References render(), setText(), gui::Widget::state, and stateChange().
|
virtual |
Reimplemented from gui::Widget.
Definition at line 19 of file Button.cpp.
References downStateColor, gui::Renderer::drawFilledRect(), gui::Renderer::drawText(), gui::Widget::h, hoverStateColor, gui::Renderer::setTarget(), gui::Widget::state, gui::Widget::STATE_DOWN, gui::Widget::STATE_HOVER, gui::Widget::STATE_UP, text, textColor, upStateColor, gui::Widget::w, gui::Widget::x, gui::Widget::xAbs, gui::Widget::y, and gui::Widget::yAbs.
void Button::setText | ( | const std::string & | text | ) |
Definition at line 53 of file Button.cpp.
References text.
|
virtual |
Reimplemented from gui::Widget.
Definition at line 34 of file Button.cpp.
References gui::GUISystem::createEvent(), gui::EventEmitter::emitEvent(), gui::EventEmitter::guiSystem, gui::MOUSE_BUTTON_DOWN, gui::MOUSE_BUTTON_UP, gui::Widget::state, gui::Widget::STATE_DOWN, gui::Widget::STATE_HOVER, and gui::Widget::STATE_UP.