GUI
Public Member Functions | Public Attributes | Private Attributes | List of all members
Button Class Reference

Button widget. That rectangular thing with inscription on it. More...

#include <Button.h>

Inherits Widget.

Inherited by CustomWidget.

Public Member Functions

 Button ()
 
 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)
 
- Public Member Functions inherited from Widget
 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 ()
 
- Public Member Functions inherited from EventEmitter
 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...
 

Public Attributes

Color upStateColor
 
Color hoverStateColor
 
Color downStateColor
 
Color textColor
 

Private Attributes

std::string text
 

Additional Inherited Members

- Public Types inherited from Widget
enum  states { STATE_HOVER, STATE_DOWN, STATE_UP }
 
typedef char State
 
- Public Types inherited from EventEmitter
typedef std::multimap< EventType, EventListener > Map
 
- Protected Attributes inherited from Widget
int x
 
int y
 
int w
 
int h
 
int xAbs
 
int yAbs
 
int state
 
bool focused
 
bool visible
 
GUISystemguiSystem
 

Detailed Description

Button widget. That rectangular thing with inscription on it.

Definition at line 13 of file Button.h.

Constructor & Destructor Documentation

◆ Button() [1/2]

Button::Button ( )

Definition at line 5 of file Button.cpp.

◆ Button() [2/2]

Button::Button ( GUISystem guiSystem,
int  x,
int  y,
int  w,
int  h,
std::string  text 
)

Definition at line 10 of file Button.cpp.

References Widget::guiSystem.

◆ ~Button()

Button::~Button ( )
virtual

Definition at line 17 of file Button.cpp.

Member Function Documentation

◆ render()

void Button::render ( Renderer renderer)
virtual

◆ setText()

void Button::setText ( const std::string &  text)

Definition at line 57 of file Button.cpp.

References text.

◆ stateChange()

void Button::stateChange ( Widget::State  state)
virtual

Member Data Documentation

◆ downStateColor

Color Button::downStateColor

Definition at line 26 of file Button.h.

◆ hoverStateColor

Color Button::hoverStateColor

Definition at line 25 of file Button.h.

◆ text

std::string Button::text
private

Definition at line 32 of file Button.h.

◆ textColor

Color Button::textColor

Definition at line 27 of file Button.h.

◆ upStateColor

Color Button::upStateColor

Definition at line 24 of file Button.h.


The documentation for this class was generated from the following files: