abstract class fwt::Widget
sys::Obj fwt::Widget
@Js
Widget is the base class for all UI widgets.
See pod doc for details.
- add
-
@Operator
virtual This add(Widget? child)Add a child widget. If child is null, then do nothing. If child is already parented throw ArgErr. Return this.
- addAll
-
virtual This addAll(Widget?[] children)
Add all widgets in list by calling
add
on each widget. Return this. - bounds
-
Rect bounds
Position and size of this widget relative to its parent. If this a window, this is the position on the screen.
- children
-
Widget[] children()
Get the children widgets.
- cursor
-
Cursor? cursor
Mouse cursor to use when the mouse passes over the control. If not specified cursor of the parent control will appear.
- each
-
Iterate the children widgets.
- enabled
-
Bool enabled
Enabled is used to control whether this widget can accept user input. Disabled controls are "grayed out".
- focus
-
Void focus()
Attempt for this widget to take the keyboard focus.
- hasFocus
-
Bool hasFocus()
Return if this widget is the focused widget which is currently receiving all keyboard input.
- layout
-
Obj? layout := null
Meta-data that can be used by
Pane
for layout. - onBlur
-
EventListeners onBlur()
Callback for focus lost event on this widget.
Event id fired:
Event fields:
- none
- onFocus
-
EventListeners onFocus()
Callback for focus gained event on this widget.
Event id fired:
Event fields:
- none
- onKeyDown
-
EventListeners onKeyDown()
Callback for key pressed event on this widget. To cease propagation and processing of the event, then
consume
it.Event id fired:
Event fields:
Event.keyChar
: unicode character represented by key eventEvent.key
: key code including the modifiers
- onKeyUp
-
EventListeners onKeyUp()
Callback for key released events on this widget. To cease propagation and processing of the event, then
consume
it.Event id fired:
Event fields:
Event.keyChar
: unicode character represented by key eventEvent.key
: key code including the modifiers
- onMouseDown
-
EventListeners onMouseDown()
Callback for mouse button pressed event on this widget.
Event id fired:
Event fields:
Event.pos
: coordinate of mouseEvent.count
: number of clicksEvent.key
: key modifiers
- onMouseEnter
-
EventListeners onMouseEnter()
Callback when mouse enters this widget's bounds.
Event id fired:
Event fields:
Event.pos
: coordinate of mouse
- onMouseExit
-
EventListeners onMouseExit()
Callback when mouse exits this widget's bounds.
Event id fired:
Event fields:
Event.pos
: coordinate of mouse
- onMouseHover
-
EventListeners onMouseHover()
Callback when mouse hovers for a moment over this widget.
Event id fired:
Event fields:
Event.pos
: coordinate of mouse
- onMouseMove
-
EventListeners onMouseMove()
Callback when mouse moves over this widget.
Event id fired:
Event fields:
Event.pos
: coordinate of mouse
- onMouseUp
-
EventListeners onMouseUp()
Callback for mouse button released event on this widget.
Event id fired:
Event fields:
Event.pos
: coordinate of mouseEvent.count
: number of clicksEvent.key
: key modifiers
- onMouseWheel
-
EventListeners onMouseWheel()
Callback when mouse wheel is scrolled and this widget has focus.
Event id fired:
Event fields:
Event.pos
: coordinate of mouseEvent.count
: positive or negative number of scroll
- pack
-
This pack()
Set this widget's size to its preferred size. Return this.
- parent
-
@Transient
Widget? parent { private set }Get this widget's parent or null if not mounted.
- pos
-
Position of this widget relative to its parent. If this a window, this is the position on the screen.
- posOnDisplay
-
Point? posOnDisplay()
Get the position of this widget on the screen coordinate's system. If not on mounted on the screen then return null.
- posOnWindow
-
Point? posOnWindow()
Get the position of this widget relative to the window. If not on mounted on the screen then return null.
- prefSize
-
virtual Size prefSize(Hints hints := Hints.defVal)
Compute the preferred size of this widget. The hints indicate constraints the widget should consider in its calculations. If no constraints are known for width, then
hints.w
will be null. If no constraints are known for height, thenhints.h
will be null. - relayout
-
This relayout()
Relayout this widget. This method is called when something has changed and we need to recompute the layout of this widget's children. Return this.
- remove
-
virtual This remove(Widget? child)
Remove a child widget. If child is null, then do nothing. If this widget is not the child's current parent throw ArgErr. Return this.
- removeAll
-
virtual This removeAll()
Remove all child widgets. Return this.
- repaint
-
Void repaint(Rect? dirty := null)
Repaint this widget. If the dirty rectangle is null, then the whole widget is repainted.
- size
-
Size of this widget.
- visible
-
Bool visible
Controls whether this widget is visible or hidden.
- window
-
Window? window()
Get this widget's parent window or null if not mounted under a Window widget.