Class CheckBox
Check box control.
Implements
Namespace: FlaxEngine.GUI
Assembly: FlaxEngine.CSharp.dll
Syntax
[ActorToolbox("GUI")]
public class CheckBox : Control, IComparable, IDrawable
Constructors
CheckBox()
CheckBox(Single, Single, Boolean, Single)
Initializes a new instance of the CheckBox class.
Declaration
public CheckBox(float x, float y, bool isChecked = false, float size = 18F)
Parameters
System.Single
x
The x. |
System.Single
y
The y. |
System.Boolean
isChecked
if set to |
System.Single
size
The checkbox size. |
Fields
_box
_boxSize
The box size.
Declaration
protected float _boxSize
Field Value
System.Single
|
_isPressed
True if checked is being pressed (by mouse or touch).
Declaration
protected bool _isPressed
Field Value
System.Boolean
|
_mouseOverBox
The mouse over box state.
Declaration
protected bool _mouseOverBox
Field Value
System.Boolean
|
_state
Properties
BorderColor
Gets or sets the color of the border.
Declaration
[EditorDisplay("Border Style", null)]
[EditorOrder(2012)]
public Color BorderColor { get; set; }
Property Value
Color
|
BorderColorHighlighted
Gets or sets the border color when checkbox is hovered.
Declaration
[EditorDisplay("Border Style", null)]
[EditorOrder(2013)]
public Color BorderColorHighlighted { get; set; }
Property Value
Color
|
BorderThickness
Gets or sets the border thickness.
Declaration
[EditorDisplay("Border Style", null)]
[EditorOrder(2011)]
[Tooltip("The thickness of the border.")]
[Limit(0F, 3.40282347E+38F, 1F)]
public float BorderThickness { get; set; }
Property Value
System.Single
|
BoxSize
Gets or sets the size of the box.
Declaration
[EditorOrder(20)]
public float BoxSize { get; set; }
Property Value
System.Single
|
CheckedImage
Gets or sets the image used to render checkbox checked state.
Declaration
[EditorDisplay("Image Style", null)]
[EditorOrder(2021)]
[Tooltip("The image used to render checkbox checked state.")]
public IBrush CheckedImage { get; set; }
Property Value
IBrush
|
HasBorder
Gets or sets whether to have a border.
Declaration
[EditorDisplay("Border Style", null)]
[EditorOrder(2010)]
[Tooltip("Whether to have a border.")]
[ExpandGroups]
public bool HasBorder { get; set; }
Property Value
System.Boolean
|
ImageColor
Gets or sets the color of the checkbox icon.
Declaration
[EditorDisplay("Image Style", null)]
[EditorOrder(2020)]
[ExpandGroups]
public Color ImageColor { get; set; }
Property Value
Color
|
IntermediateImage
Gets or sets the image used to render checkbox intermediate state.
Declaration
[EditorDisplay("Image Style", null)]
[EditorOrder(2022)]
[Tooltip("The image used to render checkbox intermediate state.")]
public IBrush IntermediateImage { get; set; }
Property Value
IBrush
|
State
Gets or sets the state of the checkbox.
Declaration
[EditorOrder(10)]
public CheckBoxState State { get; set; }
Property Value
CheckBoxState
|
Methods
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
Draw()
OnClick()
Called when mouse or touch clicks the checkbox.
Declaration
protected virtual void OnClick()
OnLostFocus()
When control losts input focus
Declaration
public override void OnLostFocus()
Overrides
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
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
OnMouseLeave()
When mouse leaves control's area
Declaration
public override void OnMouseLeave()
Overrides
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
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
OnPressBegin()
Called when checkbox starts to be pressed by the used (via mouse or touch).
Declaration
protected virtual void OnPressBegin()
OnPressEnd()
Called when checkbox ends to be pressed by the used (via mouse or touch).
Declaration
protected virtual void OnPressEnd()
OnSizeChanged()
Called when control size gets changed.
Declaration
protected override void OnSizeChanged()
Overrides
OnSubmit()
Generic user interaction event for a control used by UI navigation (eg. user submits on the currently focused control).
Declaration
public override void OnSubmit()
Overrides
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
OnTouchLeave()
When all touch leaves control's area
Declaration
public override void OnTouchLeave()
Overrides
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
Toggle()
Toggles the checked state.
Declaration
public void Toggle()
Events
StateChanged
Event fired when 'checked' state gets changed.
Declaration
public event Action<CheckBox> StateChanged
Event Type
System.Action<CheckBox>
|