WidgetButton Class
This class is used to create a toggleable button that can be into two states - on and off.
WidgetButton Class
Members
WidgetButton (Gui gui, string str = 0)
Constructor. Creates a button with a given label.Arguments
- Gui gui - GUI, to which the new button will belong.
- string str - Button label. This is an optional parameter.
WidgetButton create (Widget widget)
WidgetButton constructor.Arguments
- Widget widget - Widget smart pointer.
Return value
int getTextAlign ()
Returns the alignment of the button label.Return value
One of the GUI_ALIGN_* pre-defined variables.string getTexture ()
Returns path to the button image.Return value
Path to the button image.void setText (string text)
Sets a button text label.Arguments
- string text - Button label.
int type ()
WidgetButton type.Return value
WidgetButton type identifier.int isToggleable ()
Returns a value indicating if the button is a toggle button or a simple one.Return value
Positive number if the button is a toggle button; otherwise, 0.void setTexture (string texture)
Sets a texture to be used as the button image.Arguments
- string texture - Path to a texture file.
void setToggled (int toggled)
Sets a state of the toggle button.Arguments
- int toggled - Positive number to press the button, 0 to release it.
string getText ()
Returns the button text label.Return value
Button label.void getImage (Image image)
Returns the button image.Arguments
- Image image
int isToggled ()
Returns a value indicating if the toggle button is pressed.Return value
1 if the button is pressed; otherwise, 0.void setImage (Image image)
Sets a button image.Arguments
- Image image - Image to set.
int getBackground ()
Returns a value indicating if a background texture is rendered for the button.Return value
Positive number if a background texture is rendered; otherwise, 0.void setToggleable (int toggleable)
Sets a value indicating if the button is a toggle button or a simple one.Arguments
- int toggleable - Positive number to make the button a toggle button, 0 to make it a simple one.
void setTextAlign (int align)
Sets alignment of the button label.Arguments
- int align - One of the GUI_ALIGN_* pre-defined variables.
void setBackground (int background)
Sets a value indicating if a background texture should be rendered for the button.Arguments
- int background - Positive number to render a background texture, 0 not to render.
Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)