This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
编程
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::WidgetEditText Class

Header: #include <UnigineWidgets.h>
Inherits: 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#

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

Arguments

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

Ptr<WidgetEditText> cast( const Ptr<Widget> & widget )

Casts a WidgetEditText out of the Widget instance.

Arguments

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

Return value

Pointer to WidgetEditText.

void setBackground( int background )

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

Arguments

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

int getBackground( )

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( )

Returns a number of the current line.

Return value

Line number.

int getCursorPosition( )

Returns a cursor position in the current line.

Return value

Position number.

void setEditable( int editable )

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

Arguments

  • int editable - Positive number to make the text field editable, 0 to make it read-only.

int isEditable( )

Returns a value indicating if the contents of the text field can be edited. The default is 1.

Return value

Positive number if the text field contents can be edited; otherwise, 0.

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 )

Returns the text contained in a given line.

Arguments

  • int line - Line number.

Return value

Text contained in the line.

int getNumLines( )

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( )

Returns a number of the line where selection starts.

Return value

Line number.

int getSelectionPosition( )

Returns a cursor position in the line where selection starts.

Return value

Position number.

String getSelectionText( )

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( )

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 )

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.

int type( )

WidgetEditText type.

Return value

WidgetEditText type identifier.
Last update: 2020-01-14
Build: ()