Widget
class in package klyn.gui.windows

    public abstract class Widget:

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)

Properties

Modifier and Type | Member | Description
--- | --- | ---
public property | accentColor `accentColor as Color` | Accent color used by focused and primary controls.
public property | backgroundColor `backgroundColor as Color` | Background color used by filled controls.
public property | borderColor `borderColor as Color` | Border color used by framed controls.
public readonly property | bottom `bottom as Int:` | Bottom edge of the widget.
public property | canFocus `canFocus as Boolean` | Whether the widget can own keyboard focus.
public property | cornerRadius `cornerRadius as Int` | Default corner radius for rounded controls.
public property | font `font as String` | Default font used to render this widget.
public property | foregroundColor `foregroundColor as Color` | Main text and icon color.
public property | hasFocus `hasFocus as Boolean` | Focus flag maintained by the GUI backend.
public property | height `height as Int` | Computed height.
public property | isEnabled `isEnabled as Boolean` | Enabled flag.
public property | isHovered `isHovered as Boolean` | Hover flag maintained by the GUI backend.
public property | isManaged `isManaged as Boolean` | When false, layout managers ignore this widget.
public property | isVisible `isVisible as Boolean` | Visibility flag.
public property | layoutParams `layoutParams as Object = null` | Optional layout-specific metadata.
public property | margin `margin as IList<Int>` | Outer margins expressed as `(left, top, right, bottom)`.
public property | maxHeight `maxHeight as Int` | Maximal allowed height.
public property | maxWidth `maxWidth as Int` | Maximal allowed width.
public property | minHeight `minHeight as Int` | Minimal allowed height.
public property | minWidth `minWidth as Int` | Minimal allowed width.
public property | parent `parent as Container` | Parent container of this widget.
public property | preferredHeight `preferredHeight as Int` | Preferred height used by layout managers.
public property | preferredWidth `preferredWidth as Int` | Preferred width used by layout managers.
public readonly property | right `right as Int:` | Right edge of the widget.
public property | sizePolicy `sizePolicy as Tuple<SizePolicy, SizePolicy>` | Layout growth policy expressed as `(horizontal, vertical)`.
public property | styleClass `styleClass as String` | Optional KSS class name.
public property | width `width as Int` | Computed width.
public property | window `window as Window` | Owning window, propagated when the widget is inserted in a window tree.
public property | x `x as Int` | Computed left position.
public propert | y `y y as Int` | Computed top position.

Constructors

Modifier and Type | Member | Description
--- | --- | ---
public | Widget `Widget():` | No summary.

Methods

Modifier and Type | Member | Description
--- | --- | ---
public | blur `blur() as Void:` | Clears keyboard focus on this widget.
public | containsPoint `containsPoint(x as Int, y as Int) as Boolean:` | Returns true when a point is inside this widget bounds.
public | paint `paint(painter as Painter) as Void:` | Paint hook used by the future graphical backend.
public | repaint `repaint() as Void:` | Requests a repaint of the owning window without changing layout.
public | requestFocus `requestFocus() as Boolean:` | Requests keyboard focus for this widget.
public | resolvePreferredHeight `resolvePreferredHeight() as Int:` | Resolved preferred height after min/max constraints.
public | resolvePreferredWidth `resolvePreferredWidth() as Int:` | Resolved preferred width after min/max constraints.
public | resolvedFont `resolvedFont() as String:` | Returns the effective font description used by painter-based renderers.
public | setBounds `setBounds(x as Int, y as Int, width as Int, height as Int) as Void:` | Updates the computed widget bounds.