Module: ui.widget
Source: ./ui/widget.reef
Overview
ui/widget.reef - Widget types and base functionality Part of reef-stdlib UI module
This module defines widget IDs/state and two bases:
- WidgetBase (struct) — still embedded by checkbox/slider/etc.
- Widget (passive object) — hierarchy for Label/Button/Panel.
Types
WidgetId
Fields:
| Name | Type |
|---|---|
value |
int |
WidgetState (enum)
Variants:
NormalHoveredPressedFocusedDisabled
Size
Fields:
| Name | Type |
|---|---|
width |
float |
height |
float |
SizeConstraints
Fields:
| Name | Type |
|---|---|
min_width |
float |
max_width |
float |
min_height |
float |
max_height |
float |
EventResultKind (enum)
Variants:
IgnoredHandledRequestFocusReleaseFocus
EventResult
Fields:
| Name | Type |
|---|---|
kind |
EventResultKind |
WidgetBase
Fields:
| Name | Type |
|---|---|
id |
WidgetId |
bounds |
core.Rect |
state |
WidgetState |
visible |
bool |
enabled |
bool |
focusable |
bool |
tab_index |
int |
Objects
Widget
Fields:
| Name | Type |
|---|---|
id |
WidgetId |
bounds |
core.Rect |
wstate |
WidgetState |
visible |
bool |
enabled |
bool |
focusable |
bool |
tab_index |
int |
proc init(id: WidgetId)
Methods:
shared fn kind(): string
shared fn get_id(): WidgetId
shared fn get_bounds(): core.Rect
shared fn get_wstate(): WidgetState
exclusive proc set_bounds(bounds: core.Rect)
exclusive proc paint(surf: surface.Surface, th: theme.Theme)
Functions
fn widget_id(id: int): WidgetId
fn widget_id_value(id: WidgetId): int
fn widget_id_none(): WidgetId
fn widget_id_is_none(id: WidgetId): bool
fn state_normal(): WidgetState
fn state_hovered(): WidgetState
fn state_pressed(): WidgetState
fn state_focused(): WidgetState
fn state_disabled(): WidgetState
fn is_normal(s: WidgetState): bool
fn is_hovered(s: WidgetState): bool
fn is_pressed(s: WidgetState): bool
fn is_focused(s: WidgetState): bool
fn is_disabled(s: WidgetState): bool
fn size(width: float, height: float): Size
fn size_zero(): Size
fn size_width(s: Size): float
fn size_height(s: Size): float
fn constraints_tight(width: float, height: float): SizeConstraints
fn constraints_loose(max_width: float, max_height: float): SizeConstraints
fn constraints_expand(): SizeConstraints
fn constraints_min_width(c: SizeConstraints): float
fn constraints_max_width(c: SizeConstraints): float
fn constraints_min_height(c: SizeConstraints): float
fn constraints_max_height(c: SizeConstraints): float
fn constrain_size(c: SizeConstraints, s: Size): Size
fn event_ignored(): EventResult
fn event_handled(): EventResult
fn event_request_focus(): EventResult
fn event_release_focus(): EventResult
fn is_event_handled(r: EventResult): bool
fn requests_focus(r: EventResult): bool
fn releases_focus(r: EventResult): bool
fn new_widget_base(id: WidgetId): WidgetBase
fn widget_base_id(w: WidgetBase): WidgetId
fn widget_base_bounds(w: WidgetBase): core.Rect
fn widget_base_state(w: WidgetBase): WidgetState
fn widget_base_visible(w: WidgetBase): bool
fn widget_base_enabled(w: WidgetBase): bool
fn hit_test(bounds: core.Rect, x: float, y: float): bool
fn widget_kind(w: Widget): string
Procedures
proc widget_base_set_bounds(w: WidgetBase, bounds: core.Rect)
proc widget_base_set_state(w: WidgetBase, state: WidgetState)
proc widget_base_set_visible(w: WidgetBase, visible: bool)
proc widget_base_set_enabled(w: WidgetBase, enabled: bool)
Generated by reefc doc