Daikon Forge GUI  v1.0.16
Daikon Forge user interface library for Unity
 All Classes Functions Variables Enumerations Enumerator Properties Events Pages
dfLabel Class Reference

Used to display text information on the screen. The Label control can optionally use embedded markup to specify colors and embedded sprites. More...

Inheritance diagram for dfLabel:
dfControl IDFMultiRender IDFControlHost

Detailed Description

Used to display text information on the screen. The Label control can optionally use embedded markup to specify colors and embedded sprites.

The Color Tag

The color tag is used to render a section of text in a different color than the default, and is used to surround the text that should be rendered in that color. Note that the section to be colorized must be followed by a closing tag ([/color]). For instance, [color red]This is red[/color] will result in the words This is red being displayed in red.

You can use hexidecimal formatting for the color value, which is defined by using a pound sign followed by the six-digit hexidecimal value of the color, where the components are specified in Red, Green, Blue order. For instance, the value #FF0000 results in red, #00FF00 results in green, and #0000FF results in blue.

You can also use a few pre-defined color names: aqua, black, blue, cyan, fuchsia, gray, green, lime, magenta, maroon, navy, olive, orange, purple, red, silver, teal, white, and yellow.

The Sprite Tag

The Sprite tag is used to display a sprite inline with the text. It takes a single quoted parameter which corresponds to the name of a sprite in the same Texture Atlas as the label. It does not require an end tag.

To embed a sprite named "smiley face" you would use the format [sprite "smiley face"].

Public Member Functions

override Vector2 CalculateMinimumSize ()
 Used during layout to determine the effective minimum size of the control, which may be different than that specified by the MinimumSize property. More...
 
override void Invalidate ()
 Called when the control needs to rebuild its render information More...
 
dfList< dfRenderDataRenderMultiple ()
 
- Public Member Functions inherited from dfControl
dfControl AddControl (Type controlType)
 Creates a new dfControl instance of the specified type and adds it as a child of this instance More...
 
void AddControl (dfControl child)
 Adds the child control to the list of child controls for this instance More...
 
AddControl< T > ()
 Creates a new dfControl instance of the specified type and adds it as a child of this instance More...
 
dfControl AddPrefab (GameObject prefab)
 Instantiates a new instance of the specified prefab and adds it to the control hierarchy More...
 
virtual void BringToFront ()
 Brings this control to the front so that it appears in front of all other controls within the same container More...
 
int CompareTo (dfControl other)
 Used to compare dfControl instances in order to sort them according to ZOrder value. More...
 
bool Contains (dfControl child)
 Retrieves a value indicating whether the specified control is a child of this control. More...
 
void Disable ()
 Disables the control. Bindable alternative to setting IsEnabled = false More...
 
void DoClick ()
 Simulates the user clicking on the control More...
 
void Enable ()
 Enable the control. Bindable alternative to setting IsEnabled = true More...
 
dfControl Find (string controlName)
 Performs a breadth-first search for a dfControl instance with the same name as the controlName argument. This search is case-sensitive. More...
 
Find< T > (string controlName)
 Performs a breadth-first search for a dfControl instance with the same name as the controlName argument and which is of the specified Type. This search is case-sensitive. More...
 
void Focus ()
 Sets the global input focus to this object More...
 
Vector3 GetAbsolutePosition ()
 Returns the control's absolute position relative to the dfGUIManager instance that is hosting the control More...
 
Bounds GetBounds ()
 Returns the axis-aligned bounding box enclosing this dfControl More...
 
Camera GetCamera ()
 Returns a reference to the UnityEngine.Camera that is responsible for rendering this dfControl More...
 
Vector3 GetCenter ()
 Returns a UnityEngine.Vector3 representing the global coordinates of the dfControl's center More...
 
Vector3[] GetCorners ()
 Returns an array of Vector3 values corresponding to the global positions of this object's bounding box. The corners are specified in the following order: Top Left, Top Right, Bottom Left, Bottom Right More...
 
Vector2 GetHitPosition (Ray ray)
 Returns the relative position in screen coordinates (X increases to the right, Y increases downward, top-left origin) of the point where the ray intersects this control. Returns TRUE if the ray intersects the control and assigns the relative hit location to the ray argument. More...
 
bool GetHitPosition (Ray ray, out Vector2 position)
 Returns the relative position in screen coordinates (X increases to the right, Y increases downward, top-left origin) of the point where the ray intersects this control. Returns TRUE if the ray intersects the control and assigns the relative hit location to the position argument. More...
 
bool GetHitPosition (Ray ray, out Vector2 position, bool clamp)
 Returns the relative position in screen coordinates (X increases to the right, Y increases downward, top-left origin) of the point where the ray intersects this control. Returns TRUE if the ray intersects the control and assigns the relative hit location to the position argument. More...
 
dfGUIManager GetManager ()
 Returns a reference to the dfGUIManager instance that is responsible for rendering the control More...
 
dfControl GetRootContainer ()
 Returns a reference to the top-most container for this control More...
 
Rect GetScreenRect ()
 Returns the Screen-based coordinates containing this control More...
 
void Hide ()
 Hide the control. Bindable alternative to setting IsVisible = false More...
 
bool HitTest (Ray ray)
 Returns TRUE if the indicated ray intersects the control, and FALSE otherwise More...
 
void Localize ()
 Causes the control to use localized data for its (class-specific) properties. More...
 
void MakePixelPerfect ()
 Causes this control to textAlign its Position and Size properties so that they lie exactly on pixel boundaries More...
 
void MakePixelPerfect (bool recursive)
 Causes this control to textAlign its Position and Size properties so that they lie exactly on pixel boundaries More...
 
void PerformLayout ()
 Causes this control to update its layout More...
 
float PixelsToUnits ()
 Returns a number representing the conversion of World Units to pixels, used to convert a dfControl's "pixel-based" position and location properties into world units for rendering and raycasting purposes. More...
 
void RebuildControlOrder ()
 Removes any gaps in the ZOrder of child controls and sorts the Controls collection according to ZOrder More...
 
void RemoveControl (dfControl child)
 Removes the indicated control from the list of child controls for this instance More...
 
void ResetLayout ()
 Causes the control to reset all layout information More...
 
void ResetLayout (bool recursive, bool force)
 Causes the control to reset all layout information More...
 
void ResumeLayout ()
 Resumes usual layout logic More...
 
virtual void SendToBack ()
 Sends this control to the back so that it appears behind all other controls within the same container More...
 
void Show ()
 Show the control. Bindable alternative to setting IsVisible = true More...
 
void SuspendLayout ()
 Temporarily suspends the layout logic for the control More...
 
void Unfocus ()
 Removes global input focus from this object More...
 

Properties

dfAtlas Atlas [get, set]
 The Texture Atlas containing the images used by the Font More...
 
bool AutoHeight [get, set]
 Gets or sets whether the label will be automatically resized vertically to contain the rendered text. More...
 
bool AutoSize [get, set]
 Gets or sets whether the dfLabel label will be automatically resized to contain the rendered text. More...
 
Color32 BackgroundColor [get, set]
 Gets or set the color that will be applied to the background sprite More...
 
string BackgroundSprite [get, set]
 The name of the image in the Atlas that will be used to render the background of this label More...
 
Color32 BottomColor [get, set]
 Gets or sets the color for the bottom of the gradient More...
 
int CharacterSpacing [get, set]
 Gets or sets the amount of additional spacing (in pixels) that will be applied when rendering the text More...
 
bool ColorizeSymbols [get, set]
 Gets/Sets a value indicating whether symbols (sprites embedded in the text) should be colorized More...
 
dfFontBase Font [get, set]
 Gets or sets the dfFont instance that will be used to render the text More...
 
bool Outline [get, set]
 Gets or sets whether the text should be rendered with an outline More...
 
Color32 OutlineColor [get, set]
 Gets or sets the color of the outline that will be rendered if the Outline property is set to TRUE More...
 
int OutlineSize [get, set]
 Gets or sets the width of the outline effect More...
 
RectOffset Padding [get, set]
 Gets or sets the amount of padding that will be added to the label's borders when rendering the text More...
 
bool ProcessMarkup [get, set]
 Gets/Sets a value indicating whether embedded markup codes are processed More...
 
bool Shadow [get, set]
 Gets or sets whether the text should be rendered with a shadow effect More...
 
Color32 ShadowColor [get, set]
 Gets or sets the color of the shadow that will be rendered if the Shadow property is set to TRUE More...
 
Vector2 ShadowOffset [get, set]
 Gets or sets the distance that the shadow that will be offset if the Shadow property is set to TRUE More...
 
bool ShowGradient [get, set]
 Gets or sets whether the label is drawn with a vertical gradient, using the Color property as the top of the gradient and the BottomColor property to specify the bottom of the gradient. More...
 
int TabSize [get, set]
 The width (in pixels) of a tab character embedded in the Text More...
 
List< int > TabStops [get]
 Returns the list of tab stop positions More...
 
string Text [get, set]
 Gets or sets the value of the text that will be rendered More...
 
TextAlignment TextAlignment [get, set]
 Gets or sets the type of text alignment to use when rendering the text More...
 
float TextScale [get, set]
 Gets or sets the size multiplier that will be used to render text More...
 
dfTextScaleMode TextScaleMode [get, set]
 Gets or sets whether the TextScale property will be automatically adjusted to match runtime screen resolution More...
 
dfVerticalAlignment VerticalAlignment [get, set]
 Gets or sets the vertical alignment to use when rendering the text More...
 
bool WordWrap [get, set]
 Gets or sets whether Word Wrap should be used when rendering the text. More...
 
- Properties inherited from dfControl
bool AllowSignalEvents [get, set]
 Gets or sets a value indicating whether this control can use Signal() to call event handlers via reflection. Defaults to TRUE. More...
 
dfAnchorStyle Anchor [get, set]
 Gets or sets the edges of the container to which a control is bound and determines how a control is resized with its parent. More...
 
bool AutoFocus [get, set]
 Gets or sets whether the control will automatically be focused when enabled or shown More...
 
bool ClipChildren [get, set]
 Indicates whether child controls will be clipped to the bounds of this control More...
 
Color32 Color [get, set]
 Gets or sets the color of the control More...
 
virtual bool ContainsFocus [get]
 Gets a value indicating whether the control, or one of its child controls, currently has the input focus. More...
 
bool ContainsMouse [get]
 Returns TRUE when the mouse is contained within the bounds of the control More...
 
dfList< dfControlControls [get]
 Gets the collection of controls contained within the control More...
 
UnityColor32 DisabledColor [get, set]
 Gets or sets the color that will be used when this control is disabled More...
 
dfGUIManager GUIManager [get]
 Returns a reference to the dfGUIManager instance responsible for rendering this dfControl More...
 
virtual bool HasFocus [get]
 Gets a value indicating whether the control has user input focus. More...
 
float Height [get, set]
 Gets or sets the height of the control in pixels More...
 
Vector2 HotZoneScale [get, set]
 Gets or sets the size (as a multiplier) of the "hot zone" around the control More...
 
bool IsEnabled [get, set]
 Gets or sets a value indicating whether the control can respond to user interaction. More...
 
virtual bool IsInteractive [get, set]
 Gets/Sets a value indicating whether the control is user-interactive, ie: Whether the control responds to user input. This flag controls whether the control has an current BoxCollider, because there are real performance implications for having a collider on a large number of controls that will never process user input. More...
 
bool IsLayoutSuspended [get]
 Returns a value indicating whether the dfControl's layout engine is currently suspended More...
 
bool IsLocalized [get, set]
 Gets or sets a value indicating whether this controls should use localized versions of its (class-specific) properties More...
 
bool IsPerformingLayout [get]
 Returns TRUE if the control is currently performing a layout operation and FALSE otherwise More...
 
bool IsVisible [get, set]
 Gets or sets a value indicating whether the control and all its child controls are displayed. More...
 
Vector2 MaximumSize [get, set]
 Gets or sets the maximum allowed size of the control More...
 
Vector2 MinimumSize [get, set]
 Gets or sets the minimum allowed size of the control More...
 
float Opacity [get, set]
 Gets or sets the opacity level of the control More...
 
dfControl Parent [get]
 Gets the parent container of the control More...
 
dfPivotPoint Pivot [get, set]
 Gets or sets the Pivot Point of the control More...
 
Vector3 Position [get, set]
 Gets or sets the local position of the upper-left corner of the control relative to its container's pivot point More...
 
Vector3 RelativePosition [get, set]
 Returns the relative coordinates of the upper-left corner of the control relative to the upper-left corner of the parent control, expressed in "screen space" coordinates (left-top origin): x increases right, y increases down More...
 
int RenderOrder [get]
 Returns the order in which this dfControl will be rendered. More...
 
Vector2 Size [get, set]
 Gets or sets the size (in pixels) of the control More...
 
int TabIndex [get, set]
 Gets or sets the tab order of the control within its container. Set this value to -1 to remove this control from the tab order. More...
 
object Tag [get, set]
 Can be used to store additional data about the control instance More...
 
string Tooltip [get, set]
 The tooltip to be displayed to the user when the mouse hovers over the control. Currently not used directly by this library. More...
 
float Width [get, set]
 Gets or sets the width of the control in pixels More...
 
int ZOrder [get, set]
 Gets/Sets a value indicating the rendering order of this control More...
 

Events

PropertyChangedEventHandler
< string > 
TextChanged
 Raised whenever the value of the Text property changes More...
 
- Events inherited from dfControl
PropertyChangedEventHandler
< dfAnchorStyle
AnchorChanged
 Occurs when the control's Anchor property value changes More...
 
MouseEventHandler Click
 Occurs when the control is clicked by the mouse More...
 
PropertyChangedEventHandler
< Color32 > 
ColorChanged
 Occurs when the control's Color value changes More...
 
ChildControlEventHandler ControlAdded
 Occurs when a control is added to the Controls collection More...
 
PropertyChangedEventHandler< bool > ControlClippingChanged
 Raised whenever the clipping state of the control is changed, such as when the control is moved from within the active clipping region to outside of the clipping region, or vice versa. More...
 
PropertyChangedEventHandler< bool > ControlHidden
 Occurs when a control's IsVisible property is changed to FALSE. This event does not bubble up the control hierarchy. More...
 
ChildControlEventHandler ControlRemoved
 Occurs when a control is removed from the Controls collection More...
 
PropertyChangedEventHandler< bool > ControlShown
 Occurs when a control's IsVisible property is changed to TRUE. This event does not bubble up the control hierarchy. More...
 
MouseEventHandler DoubleClick
 Occurs when the control is double clicked by the mouse More...
 
DragEventHandler DragDrop
 Occurs when a drag-and-drop operation is completed More...
 
DragEventHandler DragEnd
 Occurs (on the source dfControl) when a drag-and-drop operation has ended More...
 
DragEventHandler DragEnter
 Occurs when an object is dragged into the control's bounds More...
 
DragEventHandler DragLeave
 Occurs when an object is dragged out of the control's bounds More...
 
DragEventHandler DragOver
 Occurs when an object is dragged over the control's bounds More...
 
DragEventHandler DragStart
 Occurs (on the source dfControl) when a drag-and-drop operation is starting More...
 
FocusEventHandler EnterFocus
 Occurs when the control or any of its child controls receives input focus More...
 
FocusEventHandler GotFocus
 Occurs when the control receives input focus More...
 
PropertyChangedEventHandler< bool > IsEnabledChanged
 Occurs when the control's Enabled property value changes More...
 
PropertyChangedEventHandler< bool > IsVisibleChanged
 Occurs when the control's Visible property changes More...
 
KeyPressHandler KeyDown
 Occurs when the user presses a key while the control has input focus More...
 
KeyPressHandler KeyPress
 Occurs when the user presses a key while the control has input focus More...
 
KeyPressHandler KeyUp
 Occurs when the user releases a key while the control has input focus More...
 
FocusEventHandler LeaveFocus
 Occurs when the control and all of its child controls lose input focus More...
 
FocusEventHandler LostFocus
 Occurs when the control loses input focus More...
 
MouseEventHandler MouseDown
 Occurs when the mouse pointer is over the control and a mouse button is pressed More...
 
MouseEventHandler MouseEnter
 Occurs when the mouse pointer enters the control More...
 
MouseEventHandler MouseHover
 Occurs when the mouse pointer rests on the control More...
 
MouseEventHandler MouseLeave
 Occurs when the mouse pointer leaves the control More...
 
MouseEventHandler MouseMove
 Occurs when the mouse pointer is moved over the control More...
 
MouseEventHandler MouseUp
 Occurs when a mouse button had previously been pressed on a control and a mouse button is released while the pointer is still over the control More...
 
MouseEventHandler MouseWheel
 Occurs when the mouse wheel moves while the control has focus More...
 
ControlMultiTouchEventHandler MultiTouch
 Occurs when more than one Touch is active for the control More...
 
ControlCallbackHandler MultiTouchEnd
 Occurs when a touch is lifted and there is only one Touch now active for the control More...
 
PropertyChangedEventHandler
< float > 
OpacityChanged
 Occurs when the control's Opacity property value changes More...
 
PropertyChangedEventHandler
< dfPivotPoint
PivotChanged
 Occurs when the control's Pivot property value changes More...
 
PropertyChangedEventHandler
< Vector2 > 
PositionChanged
 Occurs when the control's Position property is changed More...
 
PropertyChangedEventHandler
< Vector2 > 
SizeChanged
 Occurs when the control's Size propert is changed More...
 
PropertyChangedEventHandler< int > TabIndexChanged
 Occurs when the control's TabIndex property is changed More...
 
PropertyChangedEventHandler< int > ZOrderChanged
 Occurs when the control's ZOrder property value changes More...
 

Additional Inherited Members

- Public Attributes inherited from dfControl
int zindex = int.MaxValue
 
- Static Public Attributes inherited from dfControl
static readonly dfList< dfControlActiveInstances = new dfList<dfControl>()
 
- Protected Member Functions inherited from dfControl
virtual void OnControlClippingChanged ()
 
virtual void OnRebuildRenderData ()
 Called by the dfControl class during rendering to allow any derived classes to rebuild the renderData buffer. More...
 
virtual void OnTabKeyPressed (dfKeyEventArgs args)
 
void raiseMouseDownEvent (dfMouseEventArgs args)
 
void raiseMouseMoveEvent (dfMouseEventArgs args)
 
void raiseMouseWheelEvent (dfMouseEventArgs args)
 
void raiseSizeChangedEvent ()
 

Member Function Documentation

override Vector2 dfLabel.CalculateMinimumSize ( )
virtual

Used during layout to determine the effective minimum size of the control, which may be different than that specified by the MinimumSize property.

Returns
A Vector2 value that represents the minimum control size

Reimplemented from dfControl.

override void dfLabel.Invalidate ( )
virtual

Called when the control needs to rebuild its render information

Reimplemented from dfControl.

dfList<dfRenderData> dfLabel.RenderMultiple ( )

Implements IDFMultiRender.

Property Documentation

dfAtlas dfLabel.Atlas
getset

The Texture Atlas containing the images used by the Font

bool dfLabel.AutoHeight
getset

Gets or sets whether the label will be automatically resized vertically to contain the rendered text.

bool dfLabel.AutoSize
getset

Gets or sets whether the dfLabel label will be automatically resized to contain the rendered text.

Color32 dfLabel.BackgroundColor
getset

Gets or set the color that will be applied to the background sprite

string dfLabel.BackgroundSprite
getset

The name of the image in the Atlas that will be used to render the background of this label

Color32 dfLabel.BottomColor
getset

Gets or sets the color for the bottom of the gradient

int dfLabel.CharacterSpacing
getset

Gets or sets the amount of additional spacing (in pixels) that will be applied when rendering the text

bool dfLabel.ColorizeSymbols
getset

Gets/Sets a value indicating whether symbols (sprites embedded in the text) should be colorized

dfFontBase dfLabel.Font
getset

Gets or sets the dfFont instance that will be used to render the text

bool dfLabel.Outline
getset

Gets or sets whether the text should be rendered with an outline

Color32 dfLabel.OutlineColor
getset

Gets or sets the color of the outline that will be rendered if the Outline property is set to TRUE

int dfLabel.OutlineSize
getset

Gets or sets the width of the outline effect

RectOffset dfLabel.Padding
getset

Gets or sets the amount of padding that will be added to the label's borders when rendering the text

bool dfLabel.ProcessMarkup
getset

Gets/Sets a value indicating whether embedded markup codes are processed

bool dfLabel.Shadow
getset

Gets or sets whether the text should be rendered with a shadow effect

Color32 dfLabel.ShadowColor
getset

Gets or sets the color of the shadow that will be rendered if the Shadow property is set to TRUE

Vector2 dfLabel.ShadowOffset
getset

Gets or sets the distance that the shadow that will be offset if the Shadow property is set to TRUE

bool dfLabel.ShowGradient
getset

Gets or sets whether the label is drawn with a vertical gradient, using the Color property as the top of the gradient and the BottomColor property to specify the bottom of the gradient.

int dfLabel.TabSize
getset

The width (in pixels) of a tab character embedded in the Text

List<int> dfLabel.TabStops
get

Returns the list of tab stop positions

string dfLabel.Text
getset

Gets or sets the value of the text that will be rendered

TextAlignment dfLabel.TextAlignment
getset

Gets or sets the type of text alignment to use when rendering the text

float dfLabel.TextScale
getset

Gets or sets the size multiplier that will be used to render text

dfTextScaleMode dfLabel.TextScaleMode
getset

Gets or sets whether the TextScale property will be automatically adjusted to match runtime screen resolution

dfVerticalAlignment dfLabel.VerticalAlignment
getset

Gets or sets the vertical alignment to use when rendering the text

bool dfLabel.WordWrap
getset

Gets or sets whether Word Wrap should be used when rendering the text.

Event Documentation

PropertyChangedEventHandler<string> dfLabel.TextChanged

Raised whenever the value of the Text property changes