-
Notifications
You must be signed in to change notification settings - Fork 0
Control
Home | API by Category | Complete API Index | API Compatibility
| Field | Value |
|---|---|
| Full name | Electron2D.Control |
| Namespace | Electron2D |
| Kind | class |
| Category | UI and Text |
Provides the Electron2D base node for 2D user interface controls.
public class Electron2D.Control : Electron2D.CanvasItemControl inherits from Electron2D.CanvasItem and adds a rectangular
UI area, theme font overrides, GUI input callbacks, mouse filtering and
focus ownership used by Electron2D UI nodes.
Anchors, containers, keyboard navigation graphs and full widgets are later UI tasks, but the baseline input pipeline can already route mouse and focused keyboard events to controls.
This type is not synchronized. Create and mutate controls on the main scene thread.
This type is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItemElectron2D.Label
| Member | Kind | Summary |
|---|---|---|
FocusMode |
Property | Gets or sets how this control can receive focus. |
MouseFilter |
Property | Gets or sets how this control receives and consumes mouse input. |
Position |
Property | Gets or sets the local position of this control. |
Size |
Property | Gets or sets the local size of this control. |
Electron2D.Control() |
Constructor | Initializes a new instance of the Control type. |
AcceptEvent() |
Method | Marks the current GUI input event as handled. |
AddThemeFontOverride(System.String, Electron2D.Font) |
Method | Adds or replaces a font theme override for this control. |
AddThemeFontSizeOverride(System.String, System.Int32) |
Method | Adds or replaces a font size theme override for this control. |
GetThemeFont(System.String) |
Method | Gets a font theme override by name. |
GetThemeFontSize(System.String) |
Method | Gets a font size theme override by name. |
GrabFocus() |
Method | Gives keyboard and gamepad focus to this control. |
HasFocus() |
Method | Checks whether this control currently owns focus in its viewport. |
ReleaseFocus() |
Method | Releases focus from this control when it currently owns it. |
_GuiInput(Electron2D.InputEvent) |
Method | Called when a GUI input event is delivered to this control. |
Kind: Property
public Electron2D.FocusMode FocusMode { get; set; }Gets or sets how this control can receive focus.
Focus is owned by the nearest Electron2D.Viewport. Only one visible
control inside that viewport can report Electron2D.Control.HasFocus at a
time.
Electron2D.FocusMode.Click and
Electron2D.FocusMode.All allow mouse press events to focus
this control before Electron2D.Control._GuiInput(Electron2D.InputEvent) is called.
The current Electron2D.FocusMode value. The default is
Electron2D.FocusMode.None.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.Control.FocusModeElectron2D.Control.GrabFocusElectron2D.Control.HasFocus
Kind: Property
public Electron2D.MouseFilter MouseFilter { get; set; }Gets or sets how this control receives and consumes mouse input.
The root Electron2D.Viewport reads this property while routing
Electron2D.InputEventMouse events to Electron2D.Control._GuiInput(Electron2D.InputEvent).
Electron2D.MouseFilter.Stop handles the event after this control
receives it. Electron2D.MouseFilter.Pass lets unhandled events bubble
to the parent control. Electron2D.MouseFilter.Ignore skips this
control for mouse hit-testing.
The current Electron2D.Control.MouseFilter value. The default is
Electron2D.MouseFilter.Stop.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.Control.MouseFilterElectron2D.Control._GuiInput(Electron2D.InputEvent)
Kind: Property
public Electron2D.Vector2 Position { get; set; }Gets or sets the local position of this control.
This property follows the validation and lifetime rules of its declaring type.
The current position value.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.Control
Kind: Property
public Electron2D.Vector2 Size { get; set; }Gets or sets the local size of this control.
This property follows the validation and lifetime rules of its declaring type.
The current size value.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.Control
Kind: Constructor
public Electron2D.Control()Initializes a new instance of the Control type.
The new instance follows the lifetime and validation rules of its declaring type.
This member is not synchronized. Call it from the thread that owns the related object unless the declaring type states otherwise.
This API is available since Electron2D 0.1.0 Preview.
Electron2D.Control
Kind: Method
public System.Void AcceptEvent()()Marks the current GUI input event as handled.
This method forwards to Electron2D.Viewport.SetInputAsHandled on the
containing viewport. It has no effect when this control is outside a
scene tree or when no input event is currently being dispatched.
This method is not synchronized. Call it on the main scene thread while
handling Electron2D.Control._GuiInput(Electron2D.InputEvent).
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Control._GuiInput(Electron2D.InputEvent)Electron2D.Viewport.SetInputAsHandled
Kind: Method
public System.Void AddThemeFontOverride(System.String, Electron2D.Font)(System.String name, Electron2D.Font font)Adds or replaces a font theme override for this control.
This method follows the validation and lifetime rules of its declaring type.
-
name: The theme font name, for examplefont. -
font: The font resource to use.
-
System.ArgumentException: Thrown whennameisnull, empty or whitespace. -
System.ArgumentNullException: Thrown whenfontisnull.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Control
Kind: Method
public System.Void AddThemeFontSizeOverride(System.String, System.Int32)(System.String name, System.Int32 fontSize)Adds or replaces a font size theme override for this control.
This method follows the validation and lifetime rules of its declaring type.
-
name: The theme font size name, for examplefont_size. -
fontSize: The font size in pixels. It must be greater than zero.
-
System.ArgumentException: Thrown whennameisnull, empty or whitespace. -
System.ArgumentOutOfRangeException: Thrown whenfontSizeis less than or equal to zero.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Control
Kind: Method
public Electron2D.Font GetThemeFont(System.String)(System.String name)Gets a font theme override by name.
This method follows the validation and lifetime rules of its declaring type.
-
name: The theme font name.
The overridden font, or null when no override exists.
-
System.ArgumentException: Thrown whennameisnull, empty or whitespace.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Control
Kind: Method
public System.Int32 GetThemeFontSize(System.String)(System.String name)Gets a font size theme override by name.
This method follows the validation and lifetime rules of its declaring type.
-
name: The theme font size name.
The overridden font size in pixels, or 16 when no override exists.
-
System.ArgumentException: Thrown whennameisnull, empty or whitespace.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Control
Kind: Method
public System.Void GrabFocus()()Gives keyboard and gamepad focus to this control.
The control must be inside a scene tree, visible in that tree and have
Electron2D.Control.FocusMode set to a value other than
Electron2D.FocusMode.None. If any of those conditions is
not met, the call has no effect.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Control.FocusModeElectron2D.Control.HasFocusElectron2D.Control.ReleaseFocus
Kind: Method
public System.Boolean HasFocus()()Checks whether this control currently owns focus in its viewport.
Hidden controls and controls outside a scene tree do not report focus, even if they were the last control selected before becoming invalid for focus dispatch.
true when this control is the focused visible control in its
viewport; otherwise, false.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Control.GrabFocusElectron2D.Control.ReleaseFocus
Kind: Method
public System.Void ReleaseFocus()()Releases focus from this control when it currently owns it.
Calling this method on a control that does not currently own focus is a no-op.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Control.GrabFocusElectron2D.Control.HasFocus
Kind: Method
public System.Void _GuiInput(Electron2D.InputEvent)(Electron2D.InputEvent inputEvent)Called when a GUI input event is delivered to this control.
Mouse events reach this method when the event position falls inside the
control rectangle and Electron2D.Control.MouseFilter is not
Electron2D.MouseFilter.Ignore. Non-mouse events reach only the
currently focused control.
Call Electron2D.Control.AcceptEvent to stop further propagation of the
current event.
-
inputEvent: The input event delivered by the containingElectron2D.Viewport.
This method is not synchronized. It is called on the main scene thread during input dispatch.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Control.AcceptEventElectron2D.Control.FocusModeElectron2D.Control.MouseFilter
Electron2D 0.1.0 Preview API reference. Generated from 175 public runtime types.