Button class. More...
#include <primitiveGui.h>
Public Member Functions | |
pButton (float x, float y, float width, float height) | |
void | setColors (sf::Color borderColor, sf::Color fillColor, sf::Color hoverColor, sf::Color clickedColor) |
void | setText (sf::String &text) |
sf::String | getText () |
virtual void | updateWidget () |
Public Member Functions inherited from pWidget | |
pWidget (float x, float y, float width, float height) | |
void | setGeometry (float x, float y, float width, float height) |
void | setVisiblity (bool visiblity) |
Public Attributes | |
sf::Color | borderColor |
Color of button border - default ( 117, 119, 114, 255 ) | |
sf::Color | fillColor |
Color of default button background - default ( 85, 87, 82, 255 ) | |
sf::Color | hoverColor |
Color of button when it's hovered - default ( 136, 127, 131, 255 ) | |
sf::Color | clickedColor |
Color of button when it's clicked - default ( 81, 78, 45, 255 ) | |
sf::Color | colorToDraw |
Color which is actually draw. | |
pText | buttonLabel |
Text on button. | |
Public Attributes inherited from pWidget | |
int | widgetId |
Widget unique index. | |
int | widgetOnWindowId |
If widget is on some window this is a unique index of this window ( it's widgetId of this window ) else it is -1. | |
bool | visiblity |
visibility of widget | |
widgetTypeEnum | widgetType |
Type of the widget. | |
widgetEventType | widgetEvent |
Type of the event. | |
sf::Vector2f | widgetPosition |
Position of widget. | |
sf::Vector2f | widgetSize |
Size of widget. | |
Additional Inherited Members | |
Public Types inherited from pWidget | |
enum | widgetTypeEnum { Button =0, TextEdit, CheckBox, Slider, ProgressBar, Window } |
Enumeration of the different types of widgets. More... | |
enum | widgetEventType { NoEvent =0, WidgetClicked } |
Enumeration of the different types of widgets. More... | |
Button class.
This class inherits of pWidget class. Button recive click events.
Usage example:
pButton::pButton | ( | float | x, |
float | y, | ||
float | width, | ||
float | height | ||
) |
Default constructor.
x | |
y | |
width | |
height |
sf::String pButton::getText | ( | ) |
void pButton::setColors | ( | sf::Color | borderColor, |
sf::Color | fillColor, | ||
sf::Color | hoverColor, | ||
sf::Color | clickedColor | ||
) |
Set button colors.
borderColor | |
fillColor | |
hoverColor | |
clickedColor |
void pButton::setText | ( | sf::String & | text | ) |
Set new string on buttonLabel.
text |
|
virtual |
Update widget. Every widget have own impementation of this function, because some widgets have more elements to draw.
Implements pWidget.