This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Rendering
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Version Control
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
VR Development
Double Precision Coordinates
API
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

Unigine::WidgetEditText Class

Header: #include <UnigineWidgets.h>
Inherits from: Widget

This class creates a simple editable multi-line text area containing text strings.

Notice
Word wrapping and rich text options are not supported for this class.

See Also#

  • Widgets sample in C# Component Samples suite
  • UnigineScript API sample <UnigineSDK>/data/samples/widgets/text_00

WidgetEditText Class

Members


static WidgetEditTextPtr create ( const Ptr<Gui> & gui, const char * str = 0 ) #

Constructor. Creates a multiline text field and adds it to the specified GUI.

Arguments

  • const Ptr<Gui> & gui - GUI, to which the text field will belong.
  • const char * str - Initial value. This is an optional parameter.

static WidgetEditTextPtr create ( const char * str = 0 ) #

Constructor. Creates a multiline text field and adds it to the Engine GUI.

Arguments

  • const char * str - Initial value. This is an optional parameter.

void setBackground ( int background ) #

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

Arguments

  • int background - 1 to render a background texture, 0 not to render.

int getBackground ( ) const#

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

Return value

Positive number if a background texture is rendered; otherwise, 0.

void setCursor ( int position, int line ) #

Sets the cursor to a given position in a given line.

Arguments

  • int position - Position number.
  • int line - Line number.

int getCursorLine ( ) const#

Returns a number of the current line.

Return value

Line number.

int getCursorPosition ( ) const#

Returns a cursor position in the current line.

Return value

Position number.

void setEditable ( bool editable ) #

Sets a value indicating if the contents of the text field can be edited.

Arguments

  • bool editable - true to make the text field editable, false to make it read-only.

bool isEditable ( ) const#

Returns a value indicating if the contents of the text field can be edited. By default, this option is enabled.

Return value

true if the text field contents can be edited; otherwise, false.

void setLineText ( int line, const char * str ) #

Sets new contents for a given line.

Arguments

  • int line - Line number.
  • const char * str - Text.

String getLineText ( int line ) const#

Returns the text contained in a given line.

Arguments

  • int line - Line number.

Return value

Text contained in the line.

int getNumLines ( ) const#

Returns the number of lines in the text field.

Return value

Number of lines.

void setSelection ( int position, int line ) #

Sets a line and a position from which a new selection will start.

Arguments

  • int position - Position number.
  • int line - Line number.

int getSelectionLine ( ) const#

Returns a number of the line where selection starts.

Return value

Line number.

int getSelectionPosition ( ) const#

Returns a cursor position in the line where selection starts.

Return value

Position number.

String getSelectionText ( ) const#

Returns the currently selected text.

Return value

Currently selected text.

void setText ( const char * text ) #

Sets a text for the text field.

Arguments

  • const char * text - Text for the text field.

const char * getText ( ) const#

Returns the current contents of the text field.

Return value

Text contained in the text field.

void setTokenColor ( const char * token, const Math::vec4 & color ) #

Sets a color for a given token. The token will be highlighted with the provided color.

Arguments

  • const char * token - Token (i.e. keyword, identifier, etc).
  • const Math::vec4 & color - Color.

Math::vec4 getTokenColor ( const char * token ) const#

Returns a color, which is used to highlight a given token.

Arguments

  • const char * token - Token (i.e. keyword, identifier, etc).

Return value

Color of the current token.

void setTokensColor ( const char * tokens, const Math::vec4 & color ) #

Sets a color to given tokens. Each token will be highlighted with the provided color.

Arguments

  • const char * tokens - Comma-separated list of tokens (i.e. keywords, identifiers, etc).
  • const Math::vec4 & color - Color.

int addLine ( const char * str = 0 ) #

Adds a new line to the widget.

Arguments

  • const char * str - Text to add. This is an optional argument.

Return value

Number of the added line.

void clearSelectionText ( ) #

Deletes the currently selected text.

void removeLine ( int line ) #

Deletes a given line.

Arguments

  • int line - Line number.

void setBackgroundColor ( const Math::vec4 & color ) #

Sets the background color for the widget.

Arguments

  • const Math::vec4 & color - Four-component vector specifying the color in the RGBA format.

Math::vec4 getBackgroundColor ( ) const#

Returns the current background color for the widget.

Return value

Four-component vector specifying the color in the RGBA format.

void setSelectionColor ( const Math::vec4 & color ) #

Sets the color to be used to highlight the current selection for the widget.

Arguments

  • const Math::vec4 & color - Four-component vector specifying the color in the RGBA format.

Math::vec4 getSelectionColor ( ) const#

Returns the current color used to highlight the current selection for the widget.

Return value

Four-component vector specifying the color in the RGBA format.

void setNumberColor ( const Math::vec4 & color ) #

Sets a color for numbers.

Arguments

  • const Math::vec4 & color - Four-component vector specifying the color in the RGBA format.

Math::vec4 getNumberColor ( ) const#

Returns a color which is used for numbers.

Return value

Four-component vector specifying the color in the RGBA format.

int getCursorPositionX ( ) const#

Returns the current value of the text cursor position X coordinate.

Return value

The current value of the text cursor position X coordinate, in pixels.

int getCursorPositionY ( ) const#

Returns the current value of the text cursor position Y coordinate.

Return value

The current value of the text cursor position Y coordinate, in pixels.

int getCursorWidth ( ) const#

Returns the text cursor width.

Return value

The text cursor width, in pixels.

int getLineWidth ( int line, int end = -1 ) const#

Returns the text line width (space taken by symbols).

Arguments

  • int line - The line index from 0 to the total number of lines.
  • int end - The index of the last symbol up to which the line width is returned. If set to -1, the whole set of symbols in the line is taken.

Return value

The text line width, in pixels.

void setUseScrollWheelEnabled ( bool enabled ) #

Sets a value indicating if the currently selected line is changed (the cursor moves up or down) when scrolling the mouse wheel.

Arguments

  • bool enabled - true to enable changing the line on scrolling, false to disable it.

bool isUseScrollWheelEnabled ( ) const#

Returns a value indicating if the currently selected line is changed (the cursor moves up or down) when scrolling the mouse wheel.

Return value

true if the line is changed on scrolling, otherwise false.
Last update: 2023-12-19
Build: ()