Table of Contents

Class Widget

Namespace
Lime
Assembly
Lime.dll

Base class for any rendered object.

[TangerineVisualHintGroup("/All/Nodes/Containers", null)]
public class Widget : Node, IDisposable, IAnimatorHost, IRenderChainBuilder, IAnimable, ICloneable
Inheritance
Widget
Implements
Derived
Inherited Members
Extension Methods

Constructors

Widget()

public Widget()

Fields

BoneArray

public BoneArray BoneArray

Field Value

BoneArray

DefaultWidgetSize

public static readonly Vector2 DefaultWidgetSize

Field Value

Vector2

EnableViewCulling

public static bool EnableViewCulling

Field Value

bool

RenderTransparentWidgets

public static bool RenderTransparentWidgets

Field Value

bool

globalBlending

protected Blending globalBlending

Field Value

Blending

globalColor

protected Color4 globalColor

Field Value

Color4

globalShader

protected ShaderId globalShader

Field Value

ShaderId

globallyEnabled

protected bool globallyEnabled

Field Value

bool

globallyVisible

protected bool globallyVisible

Field Value

bool

Properties

Anchors

[YuzuMember]
[TangerineKeyframeColor(17)]
public Anchors Anchors { get; set; }

Property Value

Anchors

Blending

[YuzuMember]
[TangerineKeyframeColor(22)]
public Blending Blending { get; set; }

Property Value

Blending

BoundingRect

public Rectangle BoundingRect { get; set; }

Property Value

Rectangle

Center

Parent-relative position of center of this widget.

public Vector2 Center { get; }

Property Value

Vector2

Clicked

public virtual Action Clicked { get; set; }

Property Value

Action

Color

Hue of this widget. Contents color will be multiplied by it on render.

[YuzuMember]
[TangerineKeyframeColor(9)]
[YuzuSerializeIf("IsNotDecorated")]
public Color4 Color { get; set; }

Property Value

Color4

ContentHeight

public float ContentHeight { get; }

Property Value

float

ContentPosition

public Vector2 ContentPosition { get; }

Property Value

Vector2

ContentSize

public Vector2 ContentSize { get; }

Property Value

Vector2

ContentWidth

public float ContentWidth { get; }

Property Value

float

EffectiveMaxSize

public virtual Vector2 EffectiveMaxSize { get; }

Property Value

Vector2

EffectiveMinSize

public virtual Vector2 EffectiveMinSize { get; }

Property Value

Vector2

Enabled

public virtual bool Enabled { get; set; }

Property Value

bool

FocusScope

public KeyboardFocusScope FocusScope { get; set; }

Property Value

KeyboardFocusScope

Focused

public static Widget Focused { get; }

Property Value

Widget

FreezeInvisible

[YuzuMember]
[TangerineKeyframeColor(19)]
public bool FreezeInvisible { get; set; }

Property Value

bool

GlobalBlending

Gets the widget's effective blending.

public Blending GlobalBlending { get; }

Property Value

Blending

GlobalCenter

Gets position of this widget's center in the root widget space.

public Vector2 GlobalCenter { get; }

Property Value

Vector2

GlobalColor

Gets the widget's effective color.

public Color4 GlobalColor { get; }

Property Value

Color4

GlobalPivotPosition

public Vector2 GlobalPivotPosition { get; }

Property Value

Vector2

GlobalPosition

Gets position of this widget in the root widget space.

public Vector2 GlobalPosition { get; }

Property Value

Vector2

GlobalShader

Gets the widget's effective shader.

public ShaderId GlobalShader { get; }

Property Value

ShaderId

GloballyEnabled

Indicates whether the widget is actually enabled.

public bool GloballyEnabled { get; }

Property Value

bool

GloballyVisible

Indicates whether the widget is actually visible.

public bool GloballyVisible { get; }

Property Value

bool

Height

public float Height { get; set; }

Property Value

float

HitTestMethod

[YuzuMember]
public HitTestMethod HitTestMethod { get; set; }

Property Value

HitTestMethod

Input

public WidgetInput Input { get; }

Property Value

WidgetInput

this[string]

Searches for widget with provided path or id in this widget's descendants. Throws an exception if sought-for widget doesn't exist.

This function is thread safe.

public Widget this[string path] { get; }

Parameters

path string

Id or path of widget. Path can be incomplete (i.e. for path Root/Human/Head/Eye Human or Head can be ommited).

Property Value

Widget

this[string, object[]]

Searches for widget with provided path or id in this widget's descendants. Throws an exception if sought-for widget doesn't exist.

This function is thread safe.

public Widget this[string format, params object[] arg] { get; }

Parameters

format string

Id or path of widget. Path can be incomplete (i.e. for path Root/Human/Head/Eye Human or Head can be ommited).

arg object[]

Property Value

Widget

Layout

public ILayout Layout { get; set; }

Property Value

ILayout

LayoutConstraints

public LayoutConstraints LayoutConstraints { get; set; }

Property Value

LayoutConstraints

LayoutManager

public LayoutManager LayoutManager { get; set; }

Property Value

LayoutManager

LocalToWorldTransform

Gets the matrix represents transformation from this widget space into the root widget space.

public Matrix32 LocalToWorldTransform { get; }

Property Value

Matrix32

MaxHeight

public float MaxHeight { get; set; }

Property Value

float

MaxSize

public Vector2 MaxSize { get; set; }

Property Value

Vector2

MaxWidth

public float MaxWidth { get; set; }

Property Value

float

MeasuredMaxSize

public Vector2 MeasuredMaxSize { get; set; }

Property Value

Vector2

MeasuredMinSize

public Vector2 MeasuredMinSize { get; set; }

Property Value

Vector2

MinHeight

public float MinHeight { get; set; }

Property Value

float

MinMaxHeight

public float MinMaxHeight { set; }

Property Value

float

MinMaxSize

public Vector2 MinMaxSize { set; }

Property Value

Vector2

MinMaxWidth

public float MinMaxWidth { set; }

Property Value

float

MinSize

public Vector2 MinSize { get; set; }

Property Value

Vector2

MinWidth

public float MinWidth { get; set; }

Property Value

float

Opacity

0 - fully transparent. 1 - fully opaque.

public float Opacity { get; set; }

Property Value

float

Padding

Gets or sets the widget padding. Padding defines the white space between the widget content and the widget border. The widget presenter and layout should respect the padding.

[Validation.Range(-3.4028235E+38, 3.4028235E+38)]
[YuzuMember]
public Thickness Padding { get; set; }

Property Value

Thickness

ParentWidget

public Widget ParentWidget { get; }

Property Value

Widget

Pivot

Center point of rotation and scaling. (0, 0) is top-left corner, (1, 1) is bottom-right corner.

[YuzuMember]
[TangerineKeyframeColor(6)]
[TangerinePropertyDefaultValue(typeof(Widget), "GetPivotDefaultValue")]
public Vector2 Pivot { get; set; }

Property Value

Vector2

Position

Parent-relative position.

[YuzuMember]
[TangerineKeyframeColor(4)]
[TangerineNumericEditBoxStep(1)]
public Vector2 Position { get; set; }

Property Value

Vector2

Rotation

Counter-clockwise rotation of this widget.

[YuzuMember]
[TangerineKeyframeColor(3)]
[TangerineNumericEditBoxStep(1)]
public float Rotation { get; set; }

Property Value

float

Scale

[YuzuMember]
[TangerineKeyframeColor(5)]
public Vector2 Scale { get; set; }

Property Value

Vector2

Shader

[YuzuMember]
[TangerineKeyframeColor(18)]
public ShaderId Shader { get; set; }

Property Value

ShaderId

SilentSize

SilentSize is needed to prevent unwanted propagation of OnSizeChanged while deserializing with Yuzu.

[YuzuMember("Size")]
public Vector2 SilentSize { get; set; }

Property Value

Vector2

Size

[TangerineKeyframeColor(7)]
[TangerineNumericEditBoxStep(1)]
[Validation.RatioInfo(new Type[] { typeof(Image), typeof(DistortionMesh), typeof(NineGrid) })]
[Validation.SizeInfo(new Type[] { typeof(Image), typeof(DistortionMesh), typeof(NineGrid) })]
public Vector2 Size { get; set; }

Property Value

Vector2

SkinningWeights

[YuzuMember]
public SkinningWeights SkinningWeights { get; set; }

Property Value

SkinningWeights

Sprite

Gets or sets a texture upon the widget. For widgets which can not have a texture returns null.

public virtual ISprite Sprite { get; set; }

Property Value

ISprite

TabTravesable

public TabTraversable TabTravesable { get; set; }

Property Value

TabTraversable

Text

Get or sets a label upon the widget. For widgets which can not have a label returns null.

public virtual string Text { get; set; }

Property Value

string

Visible

[YuzuMember]
[TangerineKeyframeColor(19)]
public bool Visible { get; set; }

Property Value

bool

Width

public float Width { get; set; }

Property Value

float

X

Parent-relative X position.

public float X { get; set; }

Property Value

float

Y

Parent-relative Y position.

public float Y { get; set; }

Property Value

float

Methods

AddToRenderChain(RenderChain)

Adds widget and all its descendants to render chain.

public override void AddToRenderChain(RenderChain chain)

Parameters

chain RenderChain

BoundingRectHitTest(Vector2)

public bool BoundingRectHitTest(Vector2 point)

Parameters

point Vector2

Returns

bool

CalcAABBInSpaceOf(Widget)

Calculates the widget's AABB in the space of another widget.

public Rectangle CalcAABBInSpaceOf(Widget widget)

Parameters

widget Widget

Returns

Rectangle

CalcAABBInViewportSpace(WindowRect, Matrix44)

public IntRectangle CalcAABBInViewportSpace(WindowRect viewport, Matrix44 worldViewProjection)

Parameters

viewport WindowRect
worldViewProjection Matrix44

Returns

IntRectangle

CalcAABBInWindowSpace()

public Rectangle CalcAABBInWindowSpace()

Returns

Rectangle

CalcContentSize()

public virtual Vector2 CalcContentSize()

Returns

Vector2

CalcGlobalBoundingRect()

Gets the axis-aligned bounding rectangle based on LocalToWorldTransform.

public Rectangle CalcGlobalBoundingRect()

Returns

Rectangle

CalcHull(in Matrix32?)

public Quadrangle CalcHull(in Matrix32? transform = null)

Parameters

transform Matrix32?

Returns

Quadrangle

CalcHullInSpaceOf(Widget)

Calculates the widget's convex hull in the space of another widget.

public Quadrangle CalcHullInSpaceOf(Widget widget)

Parameters

widget Widget

Returns

Quadrangle

CalcLocalToParentTransform()

public Matrix32 CalcLocalToParentTransform()

Returns

Matrix32

CalcPositionInSpaceOf(Widget)

public Vector2 CalcPositionInSpaceOf(Widget widget)

Parameters

widget Widget

Returns

Vector2

CalcTransitionToSpaceOf(Widget)

Calculates the widget's transition to the space of another widget.

public Matrix32 CalcTransitionToSpaceOf(Widget widget)

Parameters

widget Widget

Returns

Matrix32

CenterOnParent()

public void CenterOnParent()

ClipRegionTest(Rectangle)

public bool ClipRegionTest(Rectangle clipRegion)

Parameters

clipRegion Rectangle

Returns

bool

Dispose()

Stops all tasks and calls Dispose of all descendants.

public override void Dispose()

ExpandToContainerWithAnchors()

public void ExpandToContainerWithAnchors()

GetEffectiveLayer()

public int GetEffectiveLayer()

Returns

int

GetPivotDefaultValue()

public static object GetPivotDefaultValue()

Returns

object

GetVisibilityIssues()

public virtual IEnumerable<string> GetVisibilityIssues()

Returns

IEnumerable<string>

HasInput()

public bool HasInput()

Returns

bool

IsFocused()

public bool IsFocused()

Returns

bool

IsRenderedToTexture()

protected virtual bool IsRenderedToTexture()

Returns

bool

LocalHitTest(ref HitTestArgs)

Performs hit test only for this widget and its descendants. Returns true if the widget or one of its decendants contains the given point. This method doesn't take in account if one of the widget's ancestors overlaps the widget.

public bool LocalHitTest(ref HitTestArgs args)

Parameters

args HitTestArgs

Returns

bool

LocalHitTest(Vector2)

Checks whether this widget or one of its descendents contains the given point. This method doesn't take in account if one of the widget's ancestors overlaps the widget.

public bool LocalHitTest(Vector2 point)

Parameters

point Vector2

Returns

bool

LocalMousePosition()

public Vector2 LocalMousePosition()

Returns

Vector2

OnParentChanged(Node)

Occurs when Parent property changes.

protected override void OnParentChanged(Node oldParent)

Parameters

oldParent Node

OnSizeChanged(Vector2)

protected virtual void OnSizeChanged(Vector2 sizeDelta)

Parameters

sizeDelta Vector2

PartialHitTest(ref HitTestArgs)

Checks whether this widget contains the given point.

protected override bool PartialHitTest(ref HitTestArgs args)

Parameters

args HitTestArgs

Returns

bool

PartialHitTestByContents(ref HitTestArgs)

protected virtual bool PartialHitTestByContents(ref HitTestArgs args)

Parameters

args HitTestArgs

Returns

bool

RaiseUpdated(float)

Raises Updated event in respect of animation speed.

public void RaiseUpdated(float delta)

Parameters

delta float

Time delta from last Update.

RaiseUpdating(float)

Raises Updating event in respect of animation speed.

public void RaiseUpdating(float delta)

Parameters

delta float

Time delta from last Update.

RecalcBoundingRect()

public void RecalcBoundingRect()

RecalcGloballyFrozen()

protected override void RecalcGloballyFrozen()

RecalcGloballyVisible()

protected virtual void RecalcGloballyVisible()

RefreshLayout()

public void RefreshLayout()

RevokeFocus()

public void RevokeFocus()

SetFocus()

public void SetFocus()

StaticScale(float, bool)

TODO: Add summary

public override void StaticScale(float ratio, bool roundCoordinates)

Parameters

ratio float
roundCoordinates bool

ToLocalMousePosition(Vector2)

public Vector2 ToLocalMousePosition(Vector2 mousePosition)

Parameters

mousePosition Vector2

Returns

Vector2

UpdateAncestorBoundingRect(Widget)

public override void UpdateAncestorBoundingRect(Widget ancestor)

Parameters

ancestor Widget

WasClicked()

public virtual bool WasClicked()

Returns

bool