GUI
|
Base class for widgets. Inherits EventEmitter. More...
#include <Widget.h>
Inherits EventEmitter.
Inherited by Button, EditBox, Scrollbar, and TextField.
Public Types | |
enum | states { STATE_HOVER, STATE_DOWN, STATE_UP } |
typedef char | State |
![]() | |
typedef std::multimap< EventType, EventListener > | Map |
Public Member Functions | |
Widget () | |
Widget (int x, int y, int w, int h) | |
virtual | ~Widget () |
virtual void | render (Renderer *renderer) |
virtual void | keyChar (int uchar) |
virtual void | keyDown (int keyCode) |
virtual void | mouseMove (int x, int y) |
virtual void | stateChange (State state) |
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) |
Assings 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) |
Emitts an event. More... | |
Protected Attributes | |
int | x |
int | y |
int | w |
int | h |
int | xAbs |
int | yAbs |
int | state |
bool | focused |
bool | visible |
GUISystem * | guiSystem |
Private Attributes | |
Widget * | parent |
std::forward_list< Widget * > | children |
Friends | |
class | GUISystem |
Base class for widgets. Inherits EventEmitter.
typedef char Widget::State |
enum Widget::states |
Widget::Widget | ( | ) |
Definition at line 5 of file Widget.cpp.
References updateAbs().
Widget::Widget | ( | int | x, |
int | y, | ||
int | w, | ||
int | h | ||
) |
Definition at line 18 of file Widget.cpp.
References updateAbs().
|
virtual |
Definition at line 31 of file Widget.cpp.
void Widget::addChild | ( | Widget * | widget | ) |
Definition at line 108 of file Widget.cpp.
References children.
bool Widget::contain | ( | int | posX, |
int | posY | ||
) |
Definition at line 130 of file Widget.cpp.
|
virtual |
Definition at line 88 of file Widget.cpp.
References focused.
|
virtual |
Definition at line 93 of file Widget.cpp.
References focused.
|
virtual |
Reimplemented in EditBox.
Definition at line 40 of file Widget.cpp.
|
virtual |
Reimplemented in EditBox.
Definition at line 44 of file Widget.cpp.
|
virtual |
Definition at line 48 of file Widget.cpp.
References GUISystem::createEvent(), EventEmitter::emitEvent(), guiSystem, and MOUSE_MOVE.
void Widget::removeChild | ( | Widget * | widget | ) |
Definition at line 113 of file Widget.cpp.
References setParent().
|
virtual |
void Widget::resize | ( | int | x, |
int | y, | ||
int | w, | ||
int | h | ||
) |
Definition at line 59 of file Widget.cpp.
References h, updateAbs(), w, x, and y.
void Widget::setParent | ( | Widget * | widget | ) |
Definition at line 119 of file Widget.cpp.
References addChild(), parent, removeChild(), and updateAbs().
void Widget::setVisibility | ( | bool | visible | ) |
Definition at line 98 of file Widget.cpp.
|
virtual |
void Widget::updateAbs | ( | ) |