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
GUI-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.

Unigine::Gui Class

Interface for GUI.

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

Unigine::Gui Class

Members


virtual ~Gui ()

Virtual destructor.

static Ptr< Gui > get ()

Returns a pointer to the GUI.

Return value

Pointer to the GUI.

static Ptr< Gui > create (const char * name)

GUI constructor.

Arguments

  • const char * name - GUI skin name.

Return value

Pointer to the created GUI.

virtual void grab () =0

Grabs GUI. The GUI should not be handled by the engine after this function is called.

virtual void release () =0

Releases GUI. The GUI should be handled by the engine after this function is called.

virtual int isOwner () const =0

Returns the "owner" flag.

Return value

The "owner" flag.

virtual void enable (int width, int height) const =0

Enables GUI rendering.

Arguments

  • int width - GUI width.
  • int height - GUI height.

virtual void disable () const =0

Disables GUI rendering.

virtual void destroy () const =0

Destroys all GUI resources.

virtual void update (float ifps) const =0

Updates GUI.

Arguments

  • float ifps - Inverse FPS counter.

virtual void render (int mouse_x, int mouse_y, int mouse_button, int mouse_show) const =0

Renders GUI with specified parameters.

Arguments

  • int mouse_x - X mouse position.
  • int mouse_y - Y mouse position.
  • int mouse_button - Pressed mouse button.
  • int mouse_show - Show mouse cursor flag.

virtual void setEnabled (int enable) const =0

Sets a value indicating if a widget should be enabled / disabled.

Arguments

  • int enable - 1 to enable the GUI, 0 to disable it.

virtual int isEnabled () const =0

Returns a value indicating if the GUI is enabled.

Return value

Return 1 if the GUI is enabled; otherwise, 0 is returned.

virtual void setHidden (int hidden) const =0

Sets a value indicating if a widget should not be rendered.

Arguments

  • int hidden - 1 to show the GUI, 0 to hide it.

virtual int isHidden () const =0

Returns a value indicating if a widget is rendered visible.

Return value

1 if the widget is rendered; otherwise, 0.

virtual int getWidth () const =0

Returns the current screen width.

Return value

Screen width, in pixels.

virtual int getHeight () const =0

Returns the current screen height.

Return value

Screen height, in pixels.

virtual void setColor (const vec4 & color) const =0

Sets a color for the global color multiplier. The default is equivalent to #ffffff (white).

Arguments

  • const vec4 & color - Color multiplier.

virtual vec4 getColor () const =0

Returns the color of the global color multiplier.

Return value

Color multiplier.

virtual void setTransform (const mat4 & transform) const =0

Sets the global GUI transformation matrix. This 2D matrix can be tilted, rotated, moved or modified in many ways in 3D space.

Arguments

  • const mat4 & transform - Transformation matrix.

virtual mat4 getTransform () const =0

Returns GUI transformation matrix.

Return value

GUI transformation matrix.

virtual void setToolTipEnabled (int enable) const =0

Sets a value indicating whether tooltips are available or not.

Arguments

  • int enable - 1 to enable tooltips; otherwise, 0.

virtual int isToolTipEnabled () const =0

Returns a value indicating if tooltips are available or not.

Return value

Return 1 if tooltips are enabled; otherwise, 0.

virtual const char * getToolTipText () const =0

Gets GUI ToolTip text.

Return value

GUI ToolTip text.

virtual int getToolTipX () const =0

Gets GUI ToolTip X position.

Return value

GUI ToolTip X position.

virtual int getToolTipY () const =0

Gets GUI ToolTip Y position.

Return value

GUI ToolTip Y position.

virtual void setToolTip (int x, int y, const char * str) const =0

Sets a tooltip.

Arguments

  • int x - X coordinate of the tooltip position.
  • int y - Y coordinate of the tooltip position.
  • const char * str - ToolTip text.

virtual void setMouseEnabled (int enable) const =0

Enables or disables rendering of the mouse cursor.

Arguments

  • int enable - 1 to enable the mouse, 0 to disable it.

virtual int isMouseEnabled () const =0

Returns a value indicating if the mouse cursor is rendered.

Return value

1 if the mouse is rendered; otherwise, 0.

virtual void setMouseSprite (const Ptr< WidgetSprite > & widget) const =0

Sets a custom mouse pointer.

Arguments

  • const Ptr< WidgetSprite > & widget - Sprite with a custom mouse pointer, or NULL to fall back to the standard mouse pointer.

virtual Ptr< WidgetSprite > getMouseSprite () const =0

Returns the custom mouse pointer currently in use.

Return value

Sprite with a custom mouse pointer, or NULL if the standard mouse pointer is used.

virtual void setMouseCursor (int cursor) const =0

Sets a mouse pointer to display.

Arguments

  • int cursor - One of the CURSOR_* pre-defined variables.

virtual int getMouseCursor () const =0

One of the CURSOR_* pre-defined variables.

Return value

Returns the type of mouse pointer currently displayed.

virtual int setMouseButton () const =0

Sets a mouse button, which input should be received.

Return value

APP_BUTTON_LEFT or APP_BUTTON_RIGHT or APP_BUTTON_MIDDLE.

virtual int getMouseButton () const =0

Returns the mouse button, which input is received.

Return value

APP_BUTTON_LEFT or APP_BUTTON_RIGHT or APP_BUTTON_MIDDLE.

virtual void setMouseGrab (int mode) const =0

Sets a value indicating if the mouse pointer is bound to the GUI.

Arguments

  • int mode - 1 if the mouse pointer cannot leave the GUI; otherwise, 0.

virtual int getMouseGrab () const =0

Returns a value indicating if the mouse pointer is bound to the GUI.

Return value

1 if the mouse pointer cannot leave the GUI; otherwise, 0.

virtual int getMouseX () const =0

Returns the current X-coordinate of the mouse pointer in the coordinate system of the application window.

Return value

X-coordinate of the mouse pointer.

virtual int getMouseY () const =0

Returns the current Y-coordinate of the mouse pointer in the coordinate system of the application window.

Return value

Y-coordinate of the mouse pointer.

virtual int getMouseDX () const =0

Returns the difference between the previous position of the mouse pointer and the current one along the X-axis.

Return value

Difference along the X-axis.

virtual int getMouseDY () const =0

Returns the difference between the previous position of the mouse pointer and the current one along the Y-axis.

Return value

Difference along the Y-axis.

virtual Ptr< Widget > getFocus () const =0

Returns the widget that is currently in focus.

Return value

Focused widget smart pointer.

virtual Ptr< Widget > getOverlappedFocus () const =0

Returns the widget placed under the currently focused widget.

Return value

Overlapped widget.

virtual Ptr< Widget > getPermanentFocus () const =0

Returns a widget that is always in focus.

Return value

Widget always in focus.

virtual void removeFocus () const =0

Removes focus from the GUI.

virtual void addChild (const Ptr< Widget > & widget, int flags) const =0

Adds a given widget to the GUI.

Arguments

  • const Ptr< Widget > & widget - Widget to add.
  • int flags - One of the ALIGN_* pre-defined variables. This is an optional parameter.

virtual void removeChild (const Ptr< Widget > & widget) const =0

Removes a child widget from the list of children.

Arguments

  • const Ptr< Widget > & widget - Child widget to be removed.

virtual void replaceChild (const Ptr< Widget > & widget, const Ptr< Widget > & old_widget, int flags) const =0

Replaces a given widget in the GUI with another widget.

Arguments

  • const Ptr< Widget > & widget - Replacement widget.
  • const Ptr< Widget > & old_widget - Widget to be replaced.
  • int flags - One of the ALIGN_* pre-defined variables. This is an optional parameter.

virtual int isChild (const Ptr< Widget > & widget) const =0

Checks if a given widget is a child of the current GUI.

Arguments

  • const Ptr< Widget > & widget - Widget to check.

Return value

Returns 1 if the given widget is a child; otherwise, 0.

virtual int getNumChilds () const =0

Returns the number of widgets in the GUI.
Warning
The function is deprecated. It is provided to keep your code working until the next release. Please, replace it with getNumChildren().

Return value

Number of widgets.

virtual int getNumChildren () const =0

Returns the number of widgets in the GUI.

Return value

Number of widgets.

virtual Ptr< Widget > getChild (int num) const =0

Returns a child widget with a given number.

Arguments

  • int num - Child widget number.

Return value

Child widget.

virtual int getActivity () const =0

Returns a value indicating if any widget in the GUI is in focus.

Return value

1 if any widget is focused; otherwise, 0.

virtual int getKeyActivity () const =0

Checks if a given key already has a special purpose for the widget in focus.

Return value

1 if the key cannot be used; otherwise, 0.

virtual int setFont (const char * name) const =0

Changes the font used in the system GUI.

Arguments

  • const char * name - Path to the font file.

Return value

1 if the font is successfully changed; otherwise, 0.

virtual int setSkin (const char * name) const =0

Changes the GUI skin used in the system GUI.

Arguments

  • const char * name - Path to the skin file (an RC file and textures).

virtual int setResource (const char * name) const =0

Changes the resource skin file used in the system GUI.

Arguments

  • const char * name - Path to the rc file.

virtual int clearTexture (const char * name) const =0

Clears the specified GUI texture file cache.

Arguments

  • const char * name - Texture name.

Return value

1 if the texture is successfully cleared; otherwise, 0.

virtual vec4 parseColor (const char * str) const =0

Converts a color string in the Web format (RRGGBB / #RRGGBB or RRGGBBAA / #RRGGBBAA) into its vec4 equivalent.

Arguments

  • const char * str - Color string in the Web format.

Return value

Color value in vec4.

virtual void clearDictionaries () const =0

Clears all dictionaries.

virtual int addDictionary (const char * name, const char * language) const =0

Adds a new dictionary with localized interface strings. Dictionaries cannot be modified in run-time.

Arguments

  • const char * name - Path to the dictionary file.
  • const char * language - Name of the dictionary language.

Return value

Returns 1 if the dictionary is added successfully; otherwise, 0.

virtual int saveDictionary (const char * name, const char * language) const =0

Saves the current dictionary on disk. This function can be used to save the currently loaded dictionary into another file.

Arguments

  • const char * name - Name of the dictionary language.
  • const char * language - Dictionary language name.

Return value

Returns 1 if the dictionary is saved successfully; otherwise, 0.

virtual const char * translate (const char * str) const =0

Translates the string using dictionary.

Arguments

  • const char * str - String to translate.

Return value

Target (translated) string if it is found in the localization dictionary; otherwise, the source string.

Unigine::Gui::anonymous_8 Enumeration

SHOW = 0
HIDE
FOCUS_IN
FOCUS_OUT
CHANGED
CLICKED
DOUBLE_CLICKED
PRESSED
RELEASED
KEY_PRESSED
ENTER
LEAVE
DRAG_MOVE
DRAG_DROP
NUM_CALLBACKS

Unigine::Gui::anonymous_9 Enumeration

VERTICAL = 0
HORIZONTAL

Unigine::Gui::anonymous_10 Enumeration

VALIDATOR_ANY = 0
VALIDATOR_INT
VALIDATOR_UINT
VALIDATOR_FLOAT
VALIDATOR_ASCII

Unigine::Gui::anonymous_11 Enumeration

ATTACH_LOG10 = 1 << 0
ATTACH_MIN_EXPAND = 1 << 1
ATTACH_MAX_EXPAND = 1 << 2

Unigine::Gui::anonymous_12 Enumeration

ALIGN_CENTER = 1 << 0
ALIGN_LEFT = 1 << 1
ALIGN_RIGHT = 1 << 2
ALIGN_TOP = 1 << 3
ALIGN_BOTTOM = 1 << 4
ALIGN_EXPAND = 1 << 5
ALIGN_OVERLAP = 1 << 6
ALIGN_BACKGROUND = 1 << 7
ALIGN_FIXED = 1 << 8

Unigine::Gui::anonymous_13 Enumeration

CURSOR_NONE = 0
CURSOR_ARROW
CURSOR_NA
CURSOR_DND
CURSOR_WIDTH
CURSOR_HEIGHT
CURSOR_NESW
CURSOR_NWSE
CURSOR_MOVE
CURSOR_ROTATE
CURSOR_SCALE
NUM_CURSORS
Last update: 2017-07-03
Build: ()