Module: ui.widgets.label
Source: ./ui/widgets/label.reef
Overview
ui/widgets/label.reef - Text display widget Part of reef-stdlib UI module
The Label widget displays static or dynamic text. It supports:
- Single-line and multi-line text
- Text alignment (left, center, right)
- Text wrapping
- Themed colors and fonts
Note: Text rendering requires a font to be loaded. The paint method draws a placeholder rectangle when no font is available.
Types
TextAlign (enum)
Variants:
LeftCenterRight
Objects
Label
Extends: widget.Widget
Fields:
| Name | Type |
|---|---|
text |
string |
align |
TextAlign |
multiline |
bool |
wrap |
bool |
custom_color |
core.Color |
use_custom_color |
bool |
font_size |
float |
use_custom_font |
bool |
proc init(id: widget.WidgetId, text: string)
Methods:
override shared fn kind(): string
override exclusive proc paint(surf: surface.Surface, th: theme.Theme)
Functions
fn text_align_left(): TextAlign
fn text_align_center(): TextAlign
fn text_align_right(): TextAlign
fn label(text: string): Label
fn label_with_align(text: string, align: TextAlign): Label
fn label_multiline(text: string, wrap: bool): Label
fn label_text(l: Label): string
fn label_align(l: Label): TextAlign
fn label_is_multiline(l: Label): bool
fn label_wraps(l: Label): bool
fn label_set_text(l: Label, text: string): Label
fn label_set_align(l: Label, align: TextAlign): Label
fn label_set_multiline(l: Label, multiline: bool): Label
fn label_set_wrap(l: Label, wrap: bool): Label
fn label_set_color(l: Label, color: core.Color): Label
fn label_set_font_size(l: Label, size: float): Label
fn label_get_id(l: Label): widget.WidgetId
fn label_get_state(l: Label): widget.WidgetState
fn label_get_bounds(l: Label): core.Rect
fn label_preferred_size(l: Label, th: theme.Theme): core.Size
fn label_layout(l: Label, constraints: layout.Constraints, th: theme.Theme): Label
fn label_handle_event(l: Label, e: event.Event): widget.EventResult
fn get_text_color(l: Label, th: theme.Theme): core.Color
fn get_font_size(l: Label, th: theme.Theme): float
fn string_length(s: string): int
String length helper (count characters until null)
Procedures
proc label_paint(l: Label, surf: surface.Surface, th: theme.Theme)
Generated by reefc doc