Enfusion Script API
Loading...
Searching...
No Matches
Public Member Functions | List of all members
TextWidget Interface Reference

Widget representing text. More...

Inheritance diagram for TextWidget:
[legend]

Public Member Functions

proto external void SetRotation (float angle)
 Sets rotation of widget around defined center.
 
proto external float GetRotation ()
 Returns rotation of widget in degrees.
 
proto external void SetPivot (float x, float y)
 Sets pivot around which the widget will rotate.
 
proto external void SetText (string text)
 Sets text for the widget. String-table entries are translated.
 
proto external void SetTextOffset (float xoff, float yoff)
 Sets top-left corner where text begins in widget.
 
proto external void SetLineSpacing (float spacing)
 Sets given spacing between lines.
 
proto external void SetDesiredFontSize (int size)
 Sets desired (maximal) font size.
 
proto external void SetMinFontSize (int size)
 Sets minimal font size.
 
proto external void SetExactFontSize (int size)
 Sets both min font size and desired font size to the same value size.
 
proto external bool GetTextWrapping ()
 Returns whether the text wraps when it runs out of horizontal space.
 
proto external void SetTextWrapping (bool isWrapping)
 Sets whether should the text wrap when it runs out of horizontal space.
 
proto external void SetOutline (int outlineSize, int argb=0xFF000000)
 Sets outline style.
 
proto external int GetOutlineSize ()
 
proto external int GetOutlineColor ()
 
proto external void SetShadow (int shadowSize, int shadowARGB=0xFF000000, float shadowOpacity=1, float shadowOffsetX=0, float shadowOffsetY=0)
 Sets shadow style.
 
proto external int GetShadowSize ()
 
proto external int GetShadowColor ()
 Returns shadow color encoded as ARGB.
 
proto external float GetShadowOpacity ()
 
proto external void SetItalic (bool italic)
 Sets italic style.
 
proto external bool GetItalic ()
 Gets current italic style.
 
proto external void SetBold (bool bold)
 Sets bold style.
 
proto external bool GetBold ()
 Gets current bold style.
 
proto external void SetForceFont (bool force)
 Sets force font.
 
proto external bool GetForceFont ()
 Gets current force font.
 
proto void SetFont (ResourceName fontResource)
 Sets font used for text drawing in this widget.
 
proto string GetText ()
 Returns text in this widget. This is NOT a cheap operation - needs to copy the text.
 
proto void SetTextFormat (string text, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
 Sets text where given params are inserted to appropriate places in given string.
 
proto void GetTextSize (out float sx, out float sy)
 Returns text size in pixels in reference resolution.
 
proto void GetShadowOffset (out float sx, out float sy)
 
- Public Member Functions inherited from Widget
proto external void Update ()
 
proto external Widget GetParent ()
 Returns parent in hierarchy, or NULL.
 
proto external Widget GetChildren ()
 Returns children in hierarchy, or NULL.
 
proto external Widget GetSibling ()
 Returns next sibling in hierarchy, or NULL.
 
proto external void AddChild (notnull Widget child)
 Adds given widget as a child. Possible only if this widget accepts more children.
 
proto external void RemoveChild (notnull Widget child)
 
proto external void SetName (string name)
 
proto external string GetName ()
 
proto external void SetUserID (int id)
 Sets user ID.
 
proto external int GetUserID ()
 Gets user ID.
 
proto external bool IsFocusable ()
 
proto external void AddHandler (ScriptedWidgetEventHandler eventHandler)
 Add (hook) handler to widget. Adds reference to the handler.
 
proto external void RemoveHandler (ScriptedWidgetEventHandler eventHandler)
 Unhook handler from widget. Release reference to the handler.
 
proto external int GetNumHandlers ()
 Return number of all handlers attached to widget (C++ & scripted)
 
proto external ScriptedWidgetEventHandler GetHandler (int index)
 return widget event handler on given index, when the event handler is not inherited from ScriptedWidgetEventHandler, null is returned
 
proto external ScriptedWidgetEventHandler FindHandler (TypeName type)
 return first widget event handler of given type, when none of event handlers has the type null is returned
 
proto external void SetVisible (bool show)
 Sets visibility of this widget (VISIBLE flag)
 
proto external void SetEnabled (bool enable)
 Sets enabled state of this widget (DISABLED flag)
 
proto external bool IsVisible ()
 Returns whether is this widget visible (VISIBLE flag is set)
 
proto external bool IsVisibleInHierarchy ()
 Returns whether are this widget and all its ancesstors visible (VISIBLE flag is set)
 
proto external bool IsEnabled ()
 Returns whether is this widget enabled (DISABLED flag is not set)
 
proto external bool IsEnabledInHierarchy ()
 Returns whether are this widget and all its ancesstors enabled (DISABLED flag is not set)
 
proto external bool IsClippingChildren ()
 Returns wheter this widget clips its children.
 
proto external bool GetIsColorInherited ()
 
proto external void SetIsColorInherited (bool isColorInherited)
 Sets whether this widget inherits color from its parent.
 
proto external void SetColor (notnull Color color)
 Sets color of this widget.
 
proto external void SetColorInt (int color)
 Set ARGB color.
 
proto external int GetColorInt ()
 
proto external void SetOpacity (float alpha)
 Sets opacity which applies to this widget and all its descendants.
 
proto external float GetOpacity ()
 
proto external void SetZOrder (int zOrder)
 Changes z-order value.
 
proto external int GetZOrder ()
 Higher values mean more in front.
 
proto external void RemoveFromHierarchy ()
 Removes this widget from its parent and from the WidgetManager.
 
proto external Widget FindWidget (string pathname)
 Find Widget by path. e.g FindWidget("widget1.widget2.widget3.mywidget")
 
proto external Widget FindAnyWidget (string pathname)
 Looks for a widget with given name in this widget's children.
 
proto external Widget FindAnyWidgetById (int user_id)
 Find Widget by userID.
 
proto external string GetStyleName ()
 
proto external bool RemoveCallback (int eventId, int callbackId)
 
proto external bool RemoveCallbackByOwner (int eventId, Class owner)
 
proto external bool EmitCallback (int eventId)
 
proto external WorkspaceWidget GetWorkspace ()
 
proto ref Color GetColor ()
 Returns color of this widget.
 
proto string GetNavigation (WidgetNavigationDirection direction, out WidgetNavigationRuleType rule)
 Gets navigation rule for given direction.
 
proto external void SetNavigation (WidgetNavigationDirection direction, WidgetNavigationRuleType rule, string explicitTarget=string.Empty)
 Sets navigation rule for given direction.
 
proto external string GetTypeName ()
 
proto external int GetFlags ()
 
proto external int SetFlags (int flags)
 Sets given WidgetFlags for this widget.
 
proto external int ClearFlags (int flags)
 Removes all flags.
 
proto external WidgetType GetTypeID ()
 
proto void GetScreenPos (out float x, out float y)
 Returns position of this widget's top left corner in DPI scaled resolution.
 
proto void GetScreenSize (out float width, out float height)
 Returns size of this widget in DPI scaled resolution.
 
proto int AddCallback (int eventId, WidgetEventCallback fn)
 Add callback for given event id and returns callback id.
 
- Public Member Functions inherited from Managed
proto external ref Managed Clone ()
 Return shallow copy of object, or null if it is not allowed (not public constructor)
 

Detailed Description

Widget representing text.

Can be both single and multiline. Automatic wrapping is turned on by the WRAP_TEXT flag.

Member Function Documentation

◆ GetBold()

proto external bool TextWidget.GetBold ( )

Gets current bold style.

◆ GetForceFont()

proto external bool TextWidget.GetForceFont ( )

Gets current force font.

◆ GetItalic()

proto external bool TextWidget.GetItalic ( )

Gets current italic style.

◆ GetOutlineColor()

proto external int TextWidget.GetOutlineColor ( )

◆ GetOutlineSize()

proto external int TextWidget.GetOutlineSize ( )

◆ GetRotation()

proto external float TextWidget.GetRotation ( )

Returns rotation of widget in degrees.

◆ GetShadowColor()

proto external int TextWidget.GetShadowColor ( )

Returns shadow color encoded as ARGB.

◆ GetShadowOffset()

proto void TextWidget.GetShadowOffset ( out float  sx,
out float  sy 
)

◆ GetShadowOpacity()

proto external float TextWidget.GetShadowOpacity ( )

◆ GetShadowSize()

proto external int TextWidget.GetShadowSize ( )

◆ GetText()

proto string TextWidget.GetText ( )

Returns text in this widget. This is NOT a cheap operation - needs to copy the text.

◆ GetTextSize()

proto void TextWidget.GetTextSize ( out float  sx,
out float  sy 
)

Returns text size in pixels in reference resolution.

◆ GetTextWrapping()

proto external bool TextWidget.GetTextWrapping ( )

Returns whether the text wraps when it runs out of horizontal space.

◆ SetBold()

proto external void TextWidget.SetBold ( bool  bold)

Sets bold style.

The underlying font implementation may not support it, if this is the case, it will do nothing.

◆ SetDesiredFontSize()

proto external void TextWidget.SetDesiredFontSize ( int  size)

Sets desired (maximal) font size.

◆ SetExactFontSize()

proto external void TextWidget.SetExactFontSize ( int  size)

Sets both min font size and desired font size to the same value size.

◆ SetFont()

proto void TextWidget.SetFont ( ResourceName  fontResource)

Sets font used for text drawing in this widget.

Parameters
fontResourcePointer to font. Always use nullptr when you want to set the Default font or work properly with increments and decrements of font reference.

◆ SetForceFont()

proto external void TextWidget.SetForceFont ( bool  force)

Sets force font.

Disable font override by language settings.

◆ SetItalic()

proto external void TextWidget.SetItalic ( bool  italic)

Sets italic style.

The underlying font implementation may not support it, if this is the case, it will do nothing.

◆ SetLineSpacing()

proto external void TextWidget.SetLineSpacing ( float  spacing)

Sets given spacing between lines.

◆ SetMinFontSize()

proto external void TextWidget.SetMinFontSize ( int  size)

Sets minimal font size.

◆ SetOutline()

proto external void TextWidget.SetOutline ( int  outlineSize,
int  argb = 0xFF000000 
)

Sets outline style.

The underlying font implementation may not support it, if this is the case, it will do nothing.

◆ SetPivot()

proto external void TextWidget.SetPivot ( float  x,
float  y 
)

Sets pivot around which the widget will rotate.

◆ SetRotation()

proto external void TextWidget.SetRotation ( float  angle)

Sets rotation of widget around defined center.

Parameters
angleAngle in degrees

◆ SetShadow()

proto external void TextWidget.SetShadow ( int  shadowSize,
int  shadowARGB = 0xFF000000,
float  shadowOpacity = 1,
float  shadowOffsetX = 0,
float  shadowOffsetY = 0 
)

Sets shadow style.

The underlying font implementation may not support it, if this is the case, it will do nothing.

◆ SetText()

proto external void TextWidget.SetText ( string  text)

Sets text for the widget. String-table entries are translated.

◆ SetTextFormat()

proto void TextWidget.SetTextFormat ( string  text,
void  param1 = NULL,
void  param2 = NULL,
void  param3 = NULL,
void  param4 = NULL,
void  param5 = NULL,
void  param6 = NULL,
void  param7 = NULL,
void  param8 = NULL,
void  param9 = NULL 
)

Sets text where given params are inserted to appropriate places in given string.

◆ SetTextOffset()

proto external void TextWidget.SetTextOffset ( float  xoff,
float  yoff 
)

Sets top-left corner where text begins in widget.

For RALIGN the horizontal offset is from the right.

Parameters
xoffOffset from left
yoffOffset from top

◆ SetTextWrapping()

proto external void TextWidget.SetTextWrapping ( bool  isWrapping)

Sets whether should the text wrap when it runs out of horizontal space.


The documentation for this interface was generated from the following file: