abstract class vaseGui::Widget

sys::Obj
  vaseGui::Widget : vaseGui::Bindable

@Js
@Serializable

Widget is the base class for all UI widgets.

alpha

@Transient
Float? alpha

current alpha as animation target
range in [0,1]

bufferedHeight

Int bufferedHeight()

bufferedPrefSize

protected Size bufferedPrefSize(Int parentContentWidth := -1, Int parentContentHeight := -1)

preferred size with margin

bufferedWidth

Int bufferedWidth()

clicked

protected virtual Void clicked()

clip

Bool clip := true

current render effect

contains

Bool contains(Int rx, Int ry)

relative coordinate

contentHeight

Int contentHeight()

contentWidth

Int contentWidth()

detach

virtual Void detach(Bool doRelayout := true)

Detach from parent

doPaint

protected virtual Void doPaint(Graphics g)

dpToPixel

Int dpToPixel(Int d)

enabled

Bool enabled := true

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

findAt

virtual Widget? findAt(Int x, Int y)

findById

virtual Widget? findById(Str id)

Find widget by id in descendant

fireStateChange

protected Void fireStateChange(Obj? oldValue, Obj? newValue, Field? field)

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

focus

virtual Bool focus(Bool check := true)

Attempt for this widget to take the keyboard focus.

focusable

Bool focusable := false

focused

virtual Bool focused()

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

gestureEvent

protected virtual Void gestureEvent(GestureEvent e)

process gesture event

gestureFocusable

Bool gestureFocusable := false

getRoot

Widget? getRoot()

getRootView

Frame? getRootView()

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

getStyle

protected Style getStyle()

height

@Transient
protected Int height := 0

id

Str id := ""

The unique identifies of widget.

inlineStyle

Style? inlineStyle

keyEvent

protected virtual Void keyEvent(KeyEvent e)

Post key event

layout

Layout layout := Layout.<ctor>()

Layout params

layoutChildren

protected virtual Void layoutChildren(Bool force)

layout the children

layoutDirty

@Transient
protected Int layoutDirty := 1

mapToRelative

Bool mapToRelative(Coord p)

Translates absolute coordinates into coordinates in the coordinate space of this component.

mapToWidget

Bool mapToWidget(Coord p)

Translates absolute coordinates into relative this widget

margin

Insets margin := Insets.defVal

out side bounder

motionEvent

protected virtual Void motionEvent(MotionEvent e)

process motion event

mouseEnter

protected virtual Void mouseEnter()

Callback when mouse enters this widget's bounds.

mouseExit

protected virtual Void mouseExit()

Callback when mouse exits this widget's bounds.

onClick

Void onClick(Func<Void,Widget> c)

onClickCallback

@Transient
protected Func<Void,Widget>? onClickCallback := null

onFocusChanged

EventListeners onFocusChanged()

callback when lost focus or gains focus.

onLayout

protected virtual Void onLayout(Bool force)

onLongPress

Void onLongPress(Func<Void,Widget> c)

onLongPressCallback

@Transient
protected Func<Void,Widget>? onLongPressCallback := null

onMounted

protected virtual Void onMounted()

Callback this widget mounted.

onStateChanged

virtual override EventListeners onStateChanged()

Callback function when Widget state changed

padding

Insets padding := Insets.defVal

paddingLeft

Int paddingLeft()

paddingTop

Int paddingTop()

paint

Void paint(Graphics g)

Paints this component.

parent

@Transient
WidgetGroup? parent { private set }

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

pixelToDp

Int pixelToDp(Int d)

posOnWindow

Bool posOnWindow(Coord result)

Get the position of this widget relative to the window. If not on mounted on the screen then return null.

prefContentSize

protected virtual Size prefContentSize(Int hintsWidth := -1, Int hintsHeight := -1)

preferred size of content without padding

prefSize

virtual Size prefSize(Int parentContentWidth := -1, Int parentContentHeight := -1)

preferred size without margin

relayout

virtual Void relayout()

Requset relayout this widget

renderCacheDirty

@Transient
protected Bool renderCacheDirty := true

invalidate the renderCache bitmap image

repaint

virtual Void repaint(Rect? dirty := null)

Repaints the specified rectangle.

resetStyle

virtual Void resetStyle()

setLayout

Void setLayout(Int x, Int y, Int w, Int h, Bool force)

layout the children

style

Str style := ""

A name for style

transform

@Transient
Transform2D? transform

current transform as animation target

useRenderCache

protected Bool useRenderCache := false

flag for using renderCache

visible

Bool visible := true

Controls whether this widget is visible or hidden.

width

@Transient
protected Int width := 0

x

@Transient
protected Int x := 0

y

@Transient
protected Int y := 0