public abstract class Widget
Base class for the window widgets.
The layout system stores all computed geometry directly on widgets so the native backend can consume the same contract later.
label = Label("Hello")
label.margin = (8, 4, 8, 4)
label.setBounds(10, 20, 120, 26)| Modifier and Type | Member | Description |
|---|---|---|
| public property | accentColoraccentColor as Color |
Accent color used by focused and primary controls. |
| public property | acceptFileDropsacceptFileDrops as Boolean = false |
Enables file drops on this widget and its descendants. |
| public property | backgroundColorbackgroundColor as Color |
Background color used by filled controls. |
| public property | borderColorborderColor as Color |
Border color used by framed controls. |
| public readonly property | bottombottom as Int |
Bottom edge of the widget. |
| public property | canFocuscanFocus as Boolean |
Whether the widget can own keyboard focus. |
| public property | cornerRadiuscornerRadius as Int |
Default corner radius for rounded controls. |
| public property | cursorcursor as String |
Mouse cursor displayed while the pointer is over this widget. |
| public property | fontfont as Font |
Default font used to render this widget. |
| public property | foregroundColorforegroundColor as Color |
Main text and icon color. |
| public property | hasFocushasFocus as Boolean |
Focus flag maintained by the GUI backend. |
| public property | heightheight as Int |
Computed height. |
| public property | isEnabledisEnabled as Boolean |
Enabled flag. |
| public property | isHoveredisHovered as Boolean |
Hover flag maintained by the GUI backend. |
| public property | isManagedisManaged as Boolean |
When false, layout managers ignore this widget. |
| public property | isPressedisPressed as Boolean |
Pressed-state flag consumed by the KSS :pressed pseudo-state. |
| public property | isTabStopisTabStop as Boolean |
Whether Tab/Shift+Tab navigation should stop on this widget. |
| public property | isVisibleisVisible as Boolean |
Whether this widget is displayed and participates in layout and input. |
| public property | layoutParamslayoutParams as Object = null |
Optional layout-specific metadata. |
| public property | margin | Outer margins expressed as (left, top, right, bottom). |
| public property | maxHeightmaxHeight as Int |
Maximal allowed height. |
| public property | maxWidthmaxWidth as Int |
Maximal allowed width. |
| public property | minHeightminHeight as Int |
Minimal allowed height. |
| public property | minWidthminWidth as Int |
Minimal allowed width. |
| public property | parentparent as Container |
Parent container of this widget. |
| public property | preferredHeightpreferredHeight as Int |
Preferred height used by layout managers. |
| public property | preferredWidthpreferredWidth as Int |
Preferred width used by layout managers. |
| public property | resolvedStyleCacheresolvedStyleCache as Object = null |
Internal resolved KSS style cache used by ThemeManager. |
| public property | resolvedStyleCacheAppearanceModeresolvedStyleCacheAppearanceMode as String = "" |
Internal appearance mode associated with resolvedStyleCache. |
| public property | resolvedStyleCacheFontresolvedStyleCacheFont as String = "" |
Internal font key associated with resolvedStyleCache. |
| public property | resolvedStyleCacheRevisionresolvedStyleCacheRevision as Int = -1 |
Internal KSS theme revision associated with resolvedStyleCache. |
| public property | resolvedStyleCacheStateKeyresolvedStyleCacheStateKey as Int = -1 |
Internal widget state key associated with resolvedStyleCache. |
| public property | resolvedStyleCacheStyleClassresolvedStyleCacheStyleClass as String = "" |
Internal KSS class key associated with resolvedStyleCache. |
| public property | resolvedStyleCacheZoomRevisionresolvedStyleCacheZoomRevision as Int = -1 |
Internal content zoom revision associated with resolvedStyleCache. |
| public readonly property | rightright as Int |
Right edge of the widget. |
| public property | size | Computed widget dimensions expressed as (width, height). |
| public property | sizePolicysizePolicy as Tuple<SizePolicy, SizePolicy> |
Layout growth policy expressed as (horizontal, vertical). |
| public property | styleClassstyleClass as String |
Optional KSS class name. |
| public property | toolTiptoolTip as String |
Optional text displayed in a floating tooltip while the pointer hovers over this widget. |
| public property | widthwidth as Int |
Computed width. |
| public property | windowwindow as Window |
Owning window, propagated when the widget is inserted in a window tree. |
| public property | xx as Int |
Computed left position. |
| public propert | yy y as Int |
Computed top position. |
| Modifier and Type | Member | Description |
|---|---|---|
| public event | filesDroppedfilesDropped as FilesDroppedEvent |
Receives files dropped by the user when this widget accepts file drops. |
| public event | focusGainedfocusGained as FocusEvent |
Focus event emitted when this widget becomes the keyboard target. |
| public event | focusLostfocusLost as FocusEvent |
Focus event emitted when this widget stops being the keyboard target. |
| public event | keyPressedkeyPressed as KeyEvent |
Keyboard press event emitted when this widget has focus. |
| public event | keyReleasedkeyReleased as KeyEvent |
Keyboard release event emitted when this widget has focus. |
| public event | mouseMovedmouseMoved as MouseEvent |
Mouse move event emitted while the pointer is over this widget. |
| public event | mousePressedmousePressed as MouseEvent |
Mouse button press event emitted for this widget. |
| public event | mouseReleasedmouseReleased as MouseEvent |
Mouse button release event emitted for this widget. |
| public event | mouseWheelmouseWheel as MouseWheelEvent |
Mouse wheel event emitted while the pointer is over this widget. |
| public event | paintRequestedpaintRequested as PaintEvent |
Paint request event emitted by notifyPaintRequested. |
| public event | resizedresized as ResizeEvent |
Resize event emitted when this widget's computed size changes. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | applyThemeMetrics | Applies theme-derived metrics that are specific to this widget type. |
| public | blurblur() as Void |
Clears keyboard focus on this widget. |
| public | containsPoint | Returns true when a point is inside this widget bounds. |
| public | emitFilesDropped | Dispatches user-selected files through the same event as native drops. |
| public | emitFocusGainedemitFocusGained(relatedTarget as Widget = null) as Void |
Native backend hook for a focus-gained transition. |
| public | emitFocusLostemitFocusLost(relatedTarget as Widget = null) as Void |
Native backend hook for a focus-lost transition. |
| public | emitKeyPressed | Native backend hook for key press dispatch. |
| public | emitKeyReleased | Native backend hook for key release dispatch. |
| public | emitMouseMoved | Native backend hook for mouse move dispatch. |
| public | emitMousePressed | Native backend hook for mouse press dispatch. |
| public | emitMouseReleased | Native backend hook for mouse release dispatch. |
| public | emitMouseWheel | Native backend hook for mouse wheel dispatch. |
| public | handleTabKey | Gives a focused widget a chance to consume Tab before focus navigation. |
| public | notifyPaintRequestednotifyPaintRequested(painter as Painter) as Void |
Emits paintRequested for the current widget bounds. |
| public | paintpaint(painter as Painter) as Void |
Paint hook used by the future graphical backend. |
| public | paintClippedpaintClipped(painter as Painter) as Void |
Paints this widget clipped to its computed bounds. |
| public | paintForegroundpaintForeground(painter as Painter) as Void |
Draws this widget's foreground decorations over its painted children. |
| public | paintOverlaypaintOverlay(painter as Painter) as Void |
Paints visual elements that must appear above the normal widget tree. |
| public | preferredSizeIncludesContentZoompreferredSizeIncludesContentZoom() as Boolean |
Indicates whether resolvePreferredWidth() and resolvePreferredHeight() already include the current content zoom. |
| public | repaintrepaint() as Void |
Requests a repaint of the owning window without changing layout. |
| public | requestFocusrequestFocus() as Boolean |
Requests keyboard focus for this widget. |
| public | resolvePreferredHeightresolvePreferredHeight() as Int |
Resolved preferred height after min/max constraints. |
| public | resolvePreferredWidthresolvePreferredWidth() as Int |
Resolved preferred width after min/max constraints. |
| public | resolvedFontresolvedFont() as String |
Returns the effective font description used by painter-based renderers. |
| public | setBounds | Updates the computed widget bounds. |