Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Core Library
Containers
Engine Classes
Node-Related Classes
Rendering-Related Classes
Physics-Related Classes
Bounds-Related Classes
Controls-Related Classes
Pathfinding-Related Classes
Utility Classes

WidgetButton Class

Interface for widget button handling. See also UnigineScript analog.

To use this class, include the UnigineWidgetButton.h file.

WidgetButton Class

Members


WidgetButton (const Ptr<Gui> & gui, const char * str = 0)

Constructor. Creates a button with a given label.

Arguments

  • const Ptr<Gui> & gui - GUI, to which the new button will belong.
  • const char * str - Button label. This is an optional parameter.

Ptr<WidgetButton> create (const Ptr<Widget> & widget)

WidgetButton constructor.

Arguments

  • const Ptr<Widget> & widget - Widget smart pointer.

Return value

int getTextAlign ()

Returns alignment of the button label.

Return value

Alignment of the button label: one of the Gui:: Enumeration with ALIGN_* prefixes.

const char * getTexture ()

Returns the path to the button image texture.

Return value

Path to the button image texture.

void setText (const char * text)

Sets a button text label.

Arguments

  • const char * 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. The default is 0.

Return value

1 if the button is a toggle button; otherwise, 0.

void setTexture (const char * texture)

Sets a button image texture.

Arguments

  • const char * texture - Path to a texture file.

void setToggled (int toggled)

Sets a state of the toggle button.

Arguments

  • int toggled - 1 to press the button, 0 to release it.

const char * getText ()

Returns the button text label.

Return value

Button label.

void getImage (const Ptr<Image> & image)

Returns the button image.

Arguments

  • const Ptr<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 (const Ptr<Image> & image)

Updates a button image.

Arguments

  • const Ptr<Image> & image - Image to set.

int getBackground ()

Returns a value indicating if a background texture is rendered for the button. The default is 1.

Return value

1 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 - 1 to make the button a toggle button, 0 to make it a simple one. The default is 0.

void setTextAlign (int align)

Sets alignment of the button label.

Arguments

  • int align - One of the Gui:: Enumeration with ALIGN_* prefixes.

void setBackground (int background)

Sets a value indicating if a background texture should be rendered for the button. By default, the background texture is always rendered. The default is 1.

Arguments

  • int background - 1 to render the background texture, 0 not to render. The default is 1.
Last update: 2017-07-03