Search Results for

    Show / Hide Table of Contents

    Class ContainerControl

    Base class for all GUI controls that can contain child controls.

    Inheritance
    System.Object
    Control
    ContainerControl
    DragAreaControl
    CurveEditor<T>.ContentsBase
    ColorSelector
    Dialog
    DockPanel
    DockPanelProxy
    MainMenu
    StatusBar
    Table
    GradientEditor
    Media
    ToolStrip
    PluginsWindow.PluginEntry
    Timeline.Event
    Timeline.TrackLabel
    AlphaPanel
    BlurPanel
    Border
    CanvasScaler
    Dropdown
    DropPanel
    GridPanel
    Image
    Label
    PanelWithMargins
    ProgressBar
    RadialMenu
    RenderToTextureControl
    RootControl
    Slider
    Spacer
    TextBoxBase
    TilesPanel
    UniformGridPanel
    Implements
    System.IComparable
    IDrawable
    Inherited Members
    Control.Resize(Float2)
    Control.UpdateBounds()
    Control.UpdateTransform()
    Control.SetAnchorPreset(AnchorPresets, Boolean, Boolean)
    Control.Dispose()
    Control.Focus()
    Control.Defocus()
    Control.OnGotFocus()
    Control.OnLostFocus()
    Control.OnStartContainsFocus()
    Control.OnEndContainsFocus()
    Control.Focus(Control)
    Control.StartMouseCapture(Boolean)
    Control.EndMouseCapture()
    Control.OnEndMouseCapture()
    Control.GetNavTarget(NavDirection)
    Control.GetNavOrigin(NavDirection)
    Control.NavigationFocus()
    Control.OnSubmit()
    Control.OnTouchLeave()
    Control.DoDragDrop(DragData)
    Control.LinkTooltip(String, Tooltip)
    Control.UnlinkTooltip()
    Control.OnShowTooltip(String, Float2, Rectangle)
    Control.OnTooltipShown(Tooltip)
    Control.OnTestTooltipOverControl(Float2)
    Control.IntersectsContent(Float2, Float2)
    Control.PointToParent(ContainerControl, Float2)
    Control.PointToParent(Float2)
    Control.PointToParent(Float2)
    Control.PointFromParent(Float2)
    Control.PointFromParent(Float2)
    Control.PointFromParent(ContainerControl, Float2)
    Control.PointToWindow(Float2)
    Control.PointFromWindow(Float2)
    Control.PointToScreen(Float2)
    Control.PointFromScreen(Float2)
    Control.OnLocationChanged()
    Control.SetScaleInternal(Float2)
    Control.SetPivotInternal(Float2)
    Control.SetShearInternal(Float2)
    Control.SetRotationInternal(Single)
    Control.OnVisibleChanged()
    Control.OnParentChangedInternal()
    Control.AddUpdateCallbacks(RootControl)
    Control.RemoveUpdateCallbacks(RootControl)
    Control.SetUpdate(Control.UpdateDelegate, Control.UpdateDelegate)
    Control.OnParentResized()
    Control.CompareTo(Object)
    Control.Compare(Control)
    Control.Top
    Control.Bottom
    Control.Left
    Control.Right
    Control.UpperLeft
    Control.UpperRight
    Control.BottomRight
    Control.BottomLeft
    Control.Scale
    Control.Pivot
    Control.Shear
    Control.Rotation
    Control.HasParent
    Control.BackgroundColor
    Control.BackgroundBrush
    Control.Enabled
    Control.EnabledInHierarchy
    Control.Visible
    Control.VisibleInHierarchy
    Control.IsDisposing
    Control.Root
    Control.RootWindow
    Control.DpiScale
    Control.ScreenPos
    Control.AutoFocus
    Control.IsFocused
    Control.IsNavFocused
    Control.IsMouseOver
    Control.IsDragOver
    Control.Tooltip
    Control.ShowTooltip
    Control.EditorBounds
    Control.LocationChanged
    Control.SizeChanged
    Control.ParentChanged
    Control.VisibleChanged
    Namespace: FlaxEngine.GUI
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    public class ContainerControl : Control, IComparable, IDrawable

    Constructors

    ContainerControl()

    Initializes a new instance of the ContainerControl class.

    Declaration
    public ContainerControl()

    ContainerControl(Float2, Float2)

    Initializes a new instance of the ContainerControl class.

    Declaration
    public ContainerControl(Float2 location, Float2 size)
    Parameters
    Float2 location

    Float2 size

    ContainerControl(Rectangle)

    Init

    Declaration
    public ContainerControl(Rectangle bounds)
    Parameters
    Rectangle bounds

    Window bounds

    ContainerControl(Single, Single, Single, Single)

    Initializes a new instance of the ContainerControl class.

    Declaration
    public ContainerControl(float x, float y, float width, float height)
    Parameters
    System.Single x

    System.Single y

    System.Single width

    System.Single height

    Fields

    _children

    The children collection.

    Declaration
    [NoSerialize]
    protected readonly List<Control> _children
    Field Value
    System.Collections.Generic.List<Control>

    _containsFocus

    The contains focus cached flag.

    Declaration
    [NoSerialize]
    protected bool _containsFocus
    Field Value
    System.Boolean

    _isLayoutLocked

    The layout locking flag.

    Declaration
    [NoSerialize]
    protected bool _isLayoutLocked
    Field Value
    System.Boolean

    Properties

    Children

    Gets child controls list

    Declaration
    public List<Control> Children { get; }
    Property Value
    System.Collections.Generic.List<Control>

    ChildrenCount

    Gets amount of the children controls

    Declaration
    public int ChildrenCount { get; }
    Property Value
    System.Int32

    ClipChildren

    Gets or sets a value indicating whether apply clipping mask on children during rendering.

    Declaration
    [EditorOrder(530)]
    [Tooltip("If checked, control will apply clipping mask on children during rendering.")]
    public bool ClipChildren { get; set; }
    Property Value
    System.Boolean

    ContainsFocus

    Gets a value indicating whether the control, or one of its child controls, currently has the input focus.

    Declaration
    public override bool ContainsFocus { get; }
    Property Value
    System.Boolean

    Overrides
    Control.ContainsFocus

    CullChildren

    Gets or sets a value indicating whether perform view culling on children during rendering.

    Declaration
    [EditorOrder(540)]
    [Tooltip("If checked, control will perform view culling on children during rendering.")]
    public bool CullChildren { get; set; }
    Property Value
    System.Boolean

    HasChildren

    Checks if container has any child controls

    Declaration
    public bool HasChildren { get; }
    Property Value
    System.Boolean

    IsTouchOver

    Check if touch is over that item or its child items

    Declaration
    public override bool IsTouchOver { get; }
    Property Value
    System.Boolean

    Overrides
    Control.IsTouchOver

    Methods

    AddChild<T>()

    Creates a new control and adds it to the container.

    Declaration
    public T AddChild<T>()
        where T : Control
    Returns
    T

    The added control.

    Type Parameters
    T

    AddChild<T>(T)

    Adds the control to the container.

    Declaration
    public T AddChild<T>(T child)
        where T : Control
    Parameters
    T child

    The control to add.

    Returns
    T

    The added control.

    Type Parameters
    T

    CanNavigateChild(Control)

    Checks if this container control can more with focus navigation into the given child control.

    Declaration
    protected virtual bool CanNavigateChild(Control child)
    Parameters
    Control child

    The child.

    Returns
    System.Boolean

    True if can navigate to it, otherwise false.

    ClearState()

    Called to clear UI state. For example, removes mouse over state or drag and drop when control gets disabled or hidden (including hierarchy).

    Declaration
    public override void ClearState()
    Overrides
    Control.ClearState()

    ContainsPoint(ref Float2, Boolean)

    Checks if this control contains given point in local Control Space.

    Declaration
    public override bool ContainsPoint(ref Float2 location, bool precise = false)
    Parameters
    Float2 location

    Point location in Control Space to check

    System.Boolean precise

    True if perform precise intersection test against the control content (eg. with hit mask or transparency threshold). Otherwise, only simple bounds-check will be performed.

    Returns
    System.Boolean

    True if point is inside control's area, otherwise false.

    Overrides
    Control.ContainsPoint(ref Float2, Boolean)

    DisposeChildren()

    Removes and disposes all the child controls

    Declaration
    public virtual void DisposeChildren()

    Draw()

    Draw the control and the children.

    Declaration
    public override void Draw()
    Overrides
    Control.Draw()

    DrawChildren()

    Draws the children. Can be overridden to provide some customizations. Draw is performed with applied clipping mask for the client area.

    Declaration
    protected virtual void DrawChildren()

    DrawSelf()

    Draws the control.

    Declaration
    public virtual void DrawSelf()

    GetChild(Int32)

    Gets child control at given index.

    Declaration
    public Control GetChild(int index)
    Parameters
    System.Int32 index

    The control index.

    Returns
    Control

    The child control.

    GetChild<T>()

    Searches for a child control of a specific type. If there are multiple controls matching the type, only the first one found is returned.

    Declaration
    public T GetChild<T>()
        where T : Control
    Returns
    T

    The control instance if found, otherwise null.

    Type Parameters
    T

    The type of the control to search for. Includes any controls derived from the type.

    GetChildAt(Float2)

    Tries to find any child control at given point in control local coordinates

    Declaration
    public Control GetChildAt(Float2 point)
    Parameters
    Float2 point

    The local point to check.

    Returns
    Control

    The found control or null.

    GetChildAt(Float2, Func<Control, Boolean>)

    Tries to find valid child control at given point in control local coordinates. Uses custom callback method to test controls to pick.

    Declaration
    public Control GetChildAt(Float2 point, Func<Control, bool> isValid)
    Parameters
    Float2 point

    The local point to check.

    System.Func<Control, System.Boolean> isValid

    The control validation callback.

    Returns
    Control

    The found control or null.

    GetChildAtRecursive(Float2)

    Tries to find lowest child control at given point in control local coordinates.

    Declaration
    public Control GetChildAtRecursive(Float2 point)
    Parameters
    Float2 point

    The local point to check.

    Returns
    Control

    The found control or null.

    GetChildIndex(Control)

    Gets zero-based index in the list of control children.

    Declaration
    public int GetChildIndex(Control child)
    Parameters
    Control child

    The child control.

    Returns
    System.Int32

    The zero-based index in the list of control children.

    GetChildIndexAt(Float2)

    Tries to find any child control at given point in control local coordinates.

    Declaration
    public int GetChildIndexAt(Float2 point)
    Parameters
    Float2 point

    The local point to check.

    Returns
    System.Int32

    The found control index or -1 if failed.

    GetClientArea()

    Gets rectangle in local control coordinates with area for controls (without scroll bars, anchored controls, etc.).

    Declaration
    public Rectangle GetClientArea()
    Returns
    Rectangle

    The rectangle in local control coordinates with area for controls (without scroll bars etc.).

    GetDesireClientArea(out Rectangle)

    Gets the desire client area rectangle for all the controls.

    Declaration
    public virtual void GetDesireClientArea(out Rectangle rect)
    Parameters
    Rectangle rect

    The client area rectangle for child controls.

    IntersectsChildContent(Control, Float2, out Float2)

    Checks if given point in this container control space intersects with the child control content. Also calculates result location in child control space which can be used to feed control with event at that point.

    Declaration
    public virtual bool IntersectsChildContent(Control child, Float2 location, out Float2 childSpaceLocation)
    Parameters
    Control child

    The child control to check.

    Float2 location

    The location in this container control space.

    Float2 childSpaceLocation

    The output location in child control space.

    Returns
    System.Boolean

    True if point is over the control content, otherwise false.

    IsTouchPointerOver(Int32)

    Determines whether the given touch pointer is over the control.

    Declaration
    public override bool IsTouchPointerOver(int pointerId)
    Parameters
    System.Int32 pointerId

    The touch pointer identifier. Stable for the whole touch gesture/interaction.

    Returns
    System.Boolean

    True if given touch pointer is over the control, otherwise false.

    Overrides
    Control.IsTouchPointerOver(Int32)

    LockChildrenRecursive()

    Locks all child controls layout and itself.

    Declaration
    [NoAnimate]
    public void LockChildrenRecursive()

    NavigationWrap(NavDirection, Float2, List<Control>, out Float2)

    Wraps the navigation over the layout.

    Declaration
    protected virtual Control NavigationWrap(NavDirection direction, Float2 location, List<Control> visited, out Float2 rightMostLocation)
    Parameters
    NavDirection direction

    The navigation direction.

    Float2 location

    The navigation start location (in the control-space).

    System.Collections.Generic.List<Control> visited

    The list with visited controls. Used to skip recursive navigation calls when doing traversal across the UI hierarchy.

    Float2 rightMostLocation

    Returns the rightmost location of the parent container for the raycast used by the child container

    Returns
    Control

    The target navigation control or null if didn't performed any navigation.

    OnCharInput(Char)

    On input character

    Declaration
    public override bool OnCharInput(char c)
    Parameters
    System.Char c

    Input character

    Returns
    System.Boolean

    True if event has been handled, otherwise false

    Overrides
    Control.OnCharInput(Char)

    OnChildrenChanged()

    Called when children collection gets changed (child added or removed).

    Declaration
    [NoAnimate]
    public virtual void OnChildrenChanged()

    OnChildResized(Control)

    Called when child control gets resized.

    Declaration
    public virtual void OnChildResized(Control control)
    Parameters
    Control control

    The resized control.

    OnDestroy()

    Method called when managed instance should be destroyed

    Declaration
    public override void OnDestroy()
    Overrides
    Control.OnDestroy()

    OnDragDrop(ref Float2, DragData)

    When mouse dragging drops on control's area

    Declaration
    public override DragDropEffect OnDragDrop(ref Float2 location, DragData data)
    Parameters
    Float2 location

    Mouse location in Control Space

    DragData data

    The data. See DragDataText and DragDataFiles.

    Returns
    DragDropEffect

    The drag event result effect.

    Overrides
    Control.OnDragDrop(ref Float2, DragData)

    OnDragEnter(ref Float2, DragData)

    When mouse dragging enters control's area

    Declaration
    public override DragDropEffect OnDragEnter(ref Float2 location, DragData data)
    Parameters
    Float2 location

    Mouse location in Control Space

    DragData data

    The data. See DragDataText and DragDataFiles.

    Returns
    DragDropEffect

    The drag event result effect.

    Overrides
    Control.OnDragEnter(ref Float2, DragData)

    OnDragLeave()

    When mouse dragging leaves control's area

    Declaration
    public override void OnDragLeave()
    Overrides
    Control.OnDragLeave()

    OnDragMove(ref Float2, DragData)

    When mouse dragging moves over control's area

    Declaration
    public override DragDropEffect OnDragMove(ref Float2 location, DragData data)
    Parameters
    Float2 location

    Mouse location in Control Space

    DragData data

    The data. See DragDataText and DragDataFiles.

    Returns
    DragDropEffect

    The drag event result effect.

    Overrides
    Control.OnDragMove(ref Float2, DragData)

    OnKeyDown(KeyboardKeys)

    When key goes down

    Declaration
    public override bool OnKeyDown(KeyboardKeys key)
    Parameters
    KeyboardKeys key

    Key value

    Returns
    System.Boolean

    True if event has been handled, otherwise false

    Overrides
    Control.OnKeyDown(KeyboardKeys)

    OnKeyUp(KeyboardKeys)

    When key goes up

    Declaration
    public override void OnKeyUp(KeyboardKeys key)
    Parameters
    KeyboardKeys key

    Key value

    Overrides
    Control.OnKeyUp(KeyboardKeys)

    OnMouseDoubleClick(Float2, MouseButton)

    When mouse double clicks over control's area

    Declaration
    public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
    Parameters
    Float2 location

    Mouse location in Control Space

    MouseButton button

    Mouse buttons state (flags)

    Returns
    System.Boolean

    True if event has been handled, otherwise false

    Overrides
    Control.OnMouseDoubleClick(Float2, MouseButton)

    OnMouseDown(Float2, MouseButton)

    When mouse goes down over control's area

    Declaration
    public override bool OnMouseDown(Float2 location, MouseButton button)
    Parameters
    Float2 location

    Mouse location in Control Space

    MouseButton button

    Mouse buttons state (flags)

    Returns
    System.Boolean

    True if event has been handled, otherwise false

    Overrides
    Control.OnMouseDown(Float2, MouseButton)

    OnMouseEnter(Float2)

    When mouse enters control's area

    Declaration
    public override void OnMouseEnter(Float2 location)
    Parameters
    Float2 location

    Mouse location in Control Space

    Overrides
    Control.OnMouseEnter(Float2)

    OnMouseLeave()

    When mouse leaves control's area

    Declaration
    public override void OnMouseLeave()
    Overrides
    Control.OnMouseLeave()

    OnMouseMove(Float2)

    When mouse moves over control's area

    Declaration
    public override void OnMouseMove(Float2 location)
    Parameters
    Float2 location

    Mouse location in Control Space

    Overrides
    Control.OnMouseMove(Float2)

    OnMouseUp(Float2, MouseButton)

    When mouse goes up over control's area

    Declaration
    public override bool OnMouseUp(Float2 location, MouseButton button)
    Parameters
    Float2 location

    Mouse location in Control Space

    MouseButton button

    Mouse buttons state (flags)

    Returns
    System.Boolean

    True if event has been handled, otherwise false

    Overrides
    Control.OnMouseUp(Float2, MouseButton)

    OnMouseWheel(Float2, Single)

    When mouse wheel moves

    Declaration
    public override bool OnMouseWheel(Float2 location, float delta)
    Parameters
    Float2 location

    Mouse location in Control Space

    System.Single delta

    Mouse wheel move delta. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. Normalized to [-1;1] range.

    Returns
    System.Boolean

    True if event has been handled

    Overrides
    Control.OnMouseWheel(Float2, Single)

    OnNavigate(NavDirection, Float2, Control, List<Control>)

    Performs the UI navigation for this control.

    Declaration
    public override Control OnNavigate(NavDirection direction, Float2 location, Control caller, List<Control> visited)
    Parameters
    NavDirection direction

    The navigation direction.

    Float2 location

    The navigation start location (in the control-space).

    Control caller

    The control that calls the event.

    System.Collections.Generic.List<Control> visited

    The list with visited controls. Used to skip recursive navigation calls when doing traversal across the UI hierarchy.

    Returns
    Control

    The target navigation control or null if didn't performed any navigation.

    Overrides
    Control.OnNavigate(NavDirection, Float2, Control, List<Control>)

    OnSizeChanged()

    Called when control size gets changed.

    Declaration
    protected override void OnSizeChanged()
    Overrides
    Control.OnSizeChanged()

    OnTouchDown(Float2, Int32)

    When touch enters control's area.

    Declaration
    public override bool OnTouchDown(Float2 location, int pointerId)
    Parameters
    Float2 location

    Touch location in Control Space.

    System.Int32 pointerId

    The touch pointer identifier. Stable for the whole touch gesture/interaction.

    Returns
    System.Boolean

    True if event has been handled, otherwise false.

    Overrides
    Control.OnTouchDown(Float2, Int32)

    OnTouchEnter(Float2, Int32)

    When touch enters control's area

    Declaration
    public override void OnTouchEnter(Float2 location, int pointerId)
    Parameters
    Float2 location

    Touch location in Control Space

    System.Int32 pointerId

    The touch pointer identifier. Stable for the whole touch gesture/interaction.

    Overrides
    Control.OnTouchEnter(Float2, Int32)

    OnTouchLeave(Int32)

    When touch leaves control's area

    Declaration
    public override void OnTouchLeave(int pointerId)
    Parameters
    System.Int32 pointerId

    The touch pointer identifier. Stable for the whole touch gesture/interaction.

    Overrides
    Control.OnTouchLeave(Int32)

    OnTouchMove(Float2, Int32)

    When touch moves over control's area.

    Declaration
    public override void OnTouchMove(Float2 location, int pointerId)
    Parameters
    Float2 location

    Touch location in Control Space.

    System.Int32 pointerId

    The touch pointer identifier. Stable for the whole touch gesture/interaction.

    Overrides
    Control.OnTouchMove(Float2, Int32)

    OnTouchUp(Float2, Int32)

    When touch goes up over control's area.

    Declaration
    public override bool OnTouchUp(Float2 location, int pointerId)
    Parameters
    Float2 location

    Touch location in Control Space

    System.Int32 pointerId

    The touch pointer identifier. Stable for the whole touch gesture/interaction.

    Returns
    System.Boolean

    True if event has been handled, otherwise false.

    Overrides
    Control.OnTouchUp(Float2, Int32)

    PerformLayout(Boolean)

    Update control layout

    Declaration
    public override void PerformLayout(bool force = false)
    Parameters
    System.Boolean force

    True if perform layout by force even if cached state wants to skip it due to optimization.

    Overrides
    Control.PerformLayout(Boolean)

    PerformLayoutAfterChildren()

    Perform layout for that container control after performing it for child controls.

    Declaration
    protected virtual void PerformLayoutAfterChildren()

    PerformLayoutBeforeChildren()

    Perform layout for that container control before performing it for child controls.

    Declaration
    protected virtual void PerformLayoutBeforeChildren()

    RayCast(ref Float2, out Control)

    Performs a raycast against UI controls hierarchy to find any intersecting control content. Uses ContainsPoint(ref Float2, Boolean) with precise check (skips transparent surfaces and empty panels).

    Declaration
    public override bool RayCast(ref Float2 location, out Control hit)
    Parameters
    Float2 location

    The position to intersect UI with.

    Control hit

    The result control that intersects with the raycast.

    Returns
    System.Boolean

    True if ray hits any matching control, otherwise false.

    Overrides
    Control.RayCast(ref Float2, out Control)

    RemoveChild(Control)

    Removes control from the container.

    Declaration
    public void RemoveChild(Control child)
    Parameters
    Control child

    The control to remove.

    RemoveChildren()

    Unlinks all the child controls.

    Declaration
    [NoAnimate]
    public virtual void RemoveChildren()

    SortChildren()

    Sort child controls list

    Declaration
    [NoAnimate]
    public void SortChildren()

    SortChildrenRecursive()

    Sort children using recursion

    Declaration
    [NoAnimate]
    public void SortChildrenRecursive()

    UnlockChildrenRecursive()

    Unlocks all the child controls layout and itself.

    Declaration
    [NoAnimate]
    public void UnlockChildrenRecursive()

    Update(Single)

    Perform control update and all its children

    Declaration
    public override void Update(float deltaTime)
    Parameters
    System.Single deltaTime

    Delta time in seconds

    Overrides
    Control.Update(Single)

    UpdateChildrenBounds()

    Updates child controls bounds.

    Declaration
    protected void UpdateChildrenBounds()

    UpdateContainsFocus()

    Update contain focus state and all it's children

    Declaration
    protected void UpdateContainsFocus()

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.DeepClone<T>(T)
    Extensions.RawClone<T>(T)
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat