logo

abstract class

fwt::Widget

sys::Obj
  fwt::Widget

Widget is the base class for all UI widgets.

Slots

add

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.

Source

bounds

native Rect bounds

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

Source

children

Widget[] children()

Get the children widgets.

Source

each

Void each(|Widget, Int| f)

Iterate the children widgets.

Source

enabled

native Bool enabled

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

Source

onLayout

virtual Void onLayout()

Handle the layout event. The method is only called Pane containers. Custom panes must override this method to set the bounds on all their children.

Source

onPaint

virtual Void onPaint(Graphics g)

This callback is invoked when the widget should be repainted. The graphics context is initialized at the widget's origin with the clip bounds set to the widget's size.

Source

parent

readonly Widget parent

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

Source

pos

native Point pos

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

Source

posOnDisplay

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.

Source

prefSize

virtual native Size prefSize(Hints hints := Hints.def)

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.

Source

relayout

Void relayout()

Relayout this widget. This method is called when something has changed and we need to recompute the layout of this widget's children.

Source

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.

Source

removeAll

virtual This removeAll()

Remove all child widgets. Return this.

Source

repaint

Void repaint(Rect dirty := null)

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

Source

size

native Size size

Size of this widget.

Source

visible

native Bool visible

Controls whether this widget is visible or hidden.

Source

window

Window window()

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

Source