#include <button.h>
Buttons are clickable widgets that have a text written on the center of it, with settable background color. Upon click on a button, the function specified as OnClick function is called.
Definition at line 41 of file button.h.
Public Member Functions | |
bool | CastEvent (glictEvents evt, void *wparam, long lparam, void *returnvalue) |
Event processing for button widget. | |
glictButton () | |
Constructor for the button widget. | |
void | Paint () |
Paints the button. | |
void | SetBGColor (float r, float g, float b, float a) |
Sets the background color of the button. | |
void | SetFGColor (float r, float g, float b, float a) |
Sets the foreground color of the button. | |
~glictButton () | |
Destructor for the button widget. | |
Private Attributes | |
glictColor | bgcolor |
Stores the background color. | |
glictColor | fgcolor |
Stores the foreground color. | |
bool | highlighted |
Is mouse pressed or not. |
glictButton::glictButton | ( | ) |
Constructor for the button widget.
It fills up the class with default infos.
Definition at line 36 of file button.cpp.
References glictColor::a, glictColor::b, bgcolor, glictContainer::caption, fgcolor, glictContainer::focusable, glictColor::g, highlighted, glictContainer::parent, and glictColor::r.
glictButton::~glictButton | ( | ) |
bool glictButton::CastEvent | ( | glictEvents | evt, | |
void * | wparam, | |||
long | lparam, | |||
void * | returnvalue | |||
) | [virtual] |
Event processing for button widget.
evt | Event to process. Processed are GLICT_MOUSEUP, GLICT_MOUSEDOWN and GLICT_MOUSECLICK. | |
*wparam | Pointer parameter depending on event processed | |
lparam | Numeric parameter depending on event processed. | |
returnvalue | Not filled up with any currently processed event. |
Reimplemented from glictContainer.
Definition at line 82 of file button.cpp.
References glictContainer::DefaultCastEvent(), glictContainer::Focus(), glictContainer::GetEnabled(), glictContainer::GetVisible(), GLICT_KEYPRESS, GLICT_MOUSECLICK, GLICT_MOUSEDOWN, GLICT_MOUSEUP, highlighted, glictContainer::next, and glictContainer::x.
void glictButton::Paint | ( | ) | [virtual] |
Paints the button.
Paints a button. Button is a square thing rendered within boundaries specified by SetRect(). The square's color is specified with SetBGColor(). Upon rendering the square, white text specified with SetCaption() is placed on center of the widget.
Reimplemented from glictContainer.
Definition at line 148 of file button.cpp.
References glictColor::a, glictColor::b, bgcolor, glictGlobalsClass::buttonHighlightSkin, glictGlobalsClass::buttonHighlightTextColor, glictGlobalsClass::buttonSkin, glictGlobalsClass::buttonTextColor, glictContainer::CPaint(), glictGlobalsClass::debugCallback, glictContainer::fontname, glictContainer::fontsize, glictColor::g, glictContainer::GetVisible(), glictFontNumberOfLines(), glictFontRender(), glictFontSize(), glictContainer::height, highlighted, glictSkinner::Paint(), glictGlobalsClass::PaintRect(), glictGlobalsClass::PaintRectLines(), glictColor::r, glictGlobalsClass::SetColor(), glictContainer::SetScissor(), glictGlobalsClass::Translatef(), glictGlobalsClass::translation, glictContainer::width, glictContainer::x, glictPos::x, and glictPos::y.
void glictButton::SetBGColor | ( | float | r, | |
float | g, | |||
float | b, | |||
float | a | |||
) |
Sets the background color of the button.
r | Red element of the color. | |
g | Green element of the color. | |
b | Blue element of the color. | |
a | Alpha element of the color. |
Definition at line 245 of file button.cpp.
References glictColor::a, glictColor::b, bgcolor, glictColor::g, and glictColor::r.
Referenced by glictMessageBox::glictMessageBox().
void glictButton::SetFGColor | ( | float | r, | |
float | g, | |||
float | b, | |||
float | a | |||
) |
Sets the foreground color of the button.
r | Red element of the color. | |
g | Green element of the color. | |
b | Blue element of the color. | |
a | Alpha element of the color. |
Definition at line 261 of file button.cpp.
References glictColor::a, glictColor::b, fgcolor, glictColor::g, and glictColor::r.