Fantom

 

abstract class

fwt::Widget

sys::Obj
  fwt::Widget

@Js

Widget is the base class for all UI widgets.

See pod doc for details.

Slots

addSource

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.

boundsSource

Rect bounds

Position and size of this widget relative to its parent. If this a window, this is the position on the screen.

childrenSource

Widget[] children()

Get the children widgets.

eachSource

Void each(|Widget, Int| f)

Iterate the children widgets.

enabledSource

native Bool enabled

Enabled is used to control whether this widget can accept user input. Disabled controls are "grayed out".

focusSource

native Void focus()

Attempt for this widget to take the keyboard focus.

hasFocusSource

native Bool hasFocus()

Return if this widget is the focused widget which is currently receiving all keyboard input.

onBlurSource

@Transient
readonly EventListeners onBlur := EventListeners()

Callback for focus lost event on this widget.

Event id fired:

Event fields:

  • none
onFocusSource

@Transient
readonly EventListeners onFocus := EventListeners()

Callback for focus gained event on this widget.

Event id fired:

Event fields:

  • none
onKeyDownSource

@Transient
readonly EventListeners onKeyDown := EventListeners()

Callback for key pressed event on this widget. To cease propagation and processing of the event, then consume it.

Event id fired:

Event fields:

onKeyUpSource

@Transient
readonly EventListeners onKeyUp := EventListeners()

Callback for key released events on this widget. To cease propagation and processing of the event, then consume it.

Event id fired:

Event fields:

onMouseDownSource

@Transient
readonly EventListeners onMouseDown := EventListeners()

Callback for mouse button pressed event on this widget.

Event id fired:

Event fields:

onMouseEnterSource

@Transient
readonly EventListeners onMouseEnter := EventListeners()

Callback when mouse enters this widget's bounds.

Event id fired:

Event fields:

onMouseExitSource

@Transient
readonly EventListeners onMouseExit := EventListeners()

Callback when mouse exits this widget's bounds.

Event id fired:

Event fields:

onMouseHoverSource

@Transient
readonly EventListeners onMouseHover := EventListeners()

Callback when mouse hovers for a moment over this widget.

Event id fired:

Event fields:

onMouseMoveSource

@Transient
readonly EventListeners onMouseMove := EventListeners()

Callback when mouse moves over this widget.

Event id fired:

Event fields:

onMouseUpSource

@Transient
readonly EventListeners onMouseUp := EventListeners()

Callback for mouse button released event on this widget.

Event id fired:

Event fields:

onMouseWheelSource

@Transient
readonly EventListeners onMouseWheel := EventListeners()

Callback when mouse wheel is scrolled and this widget has focus.

Event id fired:

Event fields:

packSource

native This pack()

Set this widget's size to its preferred size. Return this.

parentSource

@Transient
readonly Widget? parent

Get this widget's parent or null if not mounted.

posSource

@Transient
native Point pos

Position of this widget relative to its parent. If this a window, this is the position on the screen.

posOnDisplaySource

native Point? posOnDisplay()

Get the position of this widget on the screen coordinate's system. If not on mounted on the screen then return null.

prefSizeSource

virtual native 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, then hints.h will be null.

relayoutSource

native 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.

removeSource

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.

removeAllSource

virtual This removeAll()

Remove all child widgets. Return this.

repaintSource

native Void repaint(Rect? dirty := null)

Repaint this widget. If the dirty rectangle is null, then the whole widget is repainted.

sizeSource

@Transient
native Size size

Size of this widget.

visibleSource

native Bool visible

Controls whether this widget is visible or hidden.

windowSource

Window? window()

Get this widget's parent window or null if not mounted under a Window widget.