This page has been translated automatically.
Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

WidgetButton Class

This class is used to create a toggleable button that can be into two states - on and off.

WidgetButton Class

This class inherits from Widget

Members


WidgetButton (Gui gui, string text = 0)

Constructor. Creates a button with a given label.

Arguments

  • Gui gui - GUI, to which the new button will belong.
  • string text - Button label. This is an optional parameter.

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.

Image getImage ()

Returns the button image.

Return value

The button image.

int getTextAlign ()

Returns the alignment of the button label.

Return value

One of the GUI_ALIGN_* pre-defined variables.

string getText ()

Returns the button text label.

Return value

Button label.

string getTexture ()

Returns path to the button image.

Return value

Path to the button image.

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.

int isToggled ()

Returns a value indicating if the toggle button is pressed.

Return value

1 if the button is pressed; otherwise, 0.

void setBackground (int mode)

Sets a value indicating if a background texture should be rendered for the button.

Arguments

  • int mode - Positive number to render a background texture, 0 not to render.

void setImage (Image image)

Sets a button image.

Arguments

  • Image image - Image to set.

void setTextAlign (int alignment)

Sets alignment of the button label.

Arguments

void setText (string text)

Sets a button text label.

Arguments

  • string text - Button label.

void setTexture (string texture)

Sets a texture to be used as the button image.

Arguments

  • string texture - Path to a texture file.

void setToggleable (int mode)

Sets a value indicating if the button is a toggle button or a simple one.

Arguments

  • int mode - Positive number to make the button a toggle button, 0 to make it a simple one.

void setToggled (int state)

Sets a state of the toggle button.

Arguments

  • int state - Positive number to press the button, 0 to release it.
Last update: 2017-07-03
Build: ()