Module: ui.widgets.textfield
Source: ./ui/widgets/textfield.reef
Overview
ui/widgets/textfield.reef - Single-line text input Part of reef-stdlib UI module
The TextField widget provides single-line text editing capabilities. It supports text entry, cursor positioning, and basic editing operations.
TextField supports:
- Text input and display
- Cursor positioning and movement
- Text selection (planned)
- Placeholder text
- Password masking
- Focus handling
Types
TextFieldEventResultKind (enum)
Variants:
IgnoredHandledChanged
TextFieldEventResult
Fields:
| Name | Type |
|---|---|
kind |
TextFieldEventResultKind |
field |
TextField |
Objects
TextField
Extends: widget.Widget
Fields:
| Name | Type |
|---|---|
text |
string |
text_length |
int |
placeholder |
string |
cursor |
int |
focused |
bool |
password |
bool |
max_length |
int |
scroll_offset |
int |
padding_h |
float |
padding_v |
float |
proc init(id: widget.WidgetId)
Methods:
override shared fn kind(): string
override exclusive proc paint(surf: surface.Surface, th: theme.Theme)
Functions
fn textfield(): TextField
fn textfield_with_text(text: string): TextField
fn textfield_with_placeholder(placeholder: string): TextField
fn textfield_text(t: TextField): string
fn textfield_placeholder(t: TextField): string
fn textfield_cursor_position(t: TextField): int
fn textfield_is_focused(t: TextField): bool
fn textfield_is_enabled(t: TextField): bool
fn textfield_is_password(t: TextField): bool
fn textfield_set_text(t: TextField, text: string): TextField
fn textfield_set_placeholder(t: TextField, placeholder: string): TextField
fn textfield_set_cursor(t: TextField, position: int): TextField
fn textfield_set_enabled(t: TextField, enabled: bool): TextField
fn textfield_set_password(t: TextField, password: bool): TextField
fn textfield_set_max_length(t: TextField, max: int): TextField
fn textfield_with_focus(t: TextField, focused: bool): TextField
fn textfield_get_id(t: TextField): widget.WidgetId
fn textfield_get_state(t: TextField): widget.WidgetState
fn textfield_get_bounds(t: TextField): core.Rect
fn textfield_preferred_size(t: TextField, th: theme.Theme): core.Size
fn textfield_layout(t: TextField, constraints: layout.Constraints, th: theme.Theme): TextField
fn textfield_handle_event(t: TextField, e: event.Event): TextFieldEventResult
fn textfield_result_ignored(): TextFieldEventResult
fn textfield_result_handled(t: TextField): TextFieldEventResult
fn textfield_result_changed(t: TextField): TextFieldEventResult
fn is_textfield_changed(r: TextFieldEventResult): bool
fn textfield_result_field(r: TextFieldEventResult): TextField
fn textfield_result_to_widget_result(r: TextFieldEventResult): widget.EventResult
fn handle_mouse_event(t: TextField, me: event.MouseEvent, bounds: core.Rect): TextFieldEventResult
fn handle_key_event(t: TextField, ke: event.KeyEvent): TextFieldEventResult
fn handle_key_down(t: TextField, ke: event.KeyEvent): TextFieldEventResult
fn handle_focus_event(t: TextField, fe: event.FocusEvent): TextFieldEventResult
fn insert_char(t: TextField, c: char): TextField
fn delete_char_before(t: TextField): TextField
fn delete_char_at(t: TextField): TextField
fn get_background_color(t: TextField, colors: theme.ThemeColors): core.Color
fn get_border_color(t: TextField, colors: theme.ThemeColors): core.Color
fn get_text_color(t: TextField, colors: theme.ThemeColors): core.Color
fn calculate_cursor_from_x(t: TextField, mouse_x: float, bounds: core.Rect): int
fn is_printable(c: char): bool
fn point_in_rect(px: float, py: float, r: core.Rect): bool
fn string_length(s: string): int
Procedures
proc textfield_paint(t: TextField, surf: surface.Surface, th: theme.Theme)
proc draw_text_content(surf: surface.Surface, t: TextField, x: float, y: float, font_size: float, color: core.Color)
proc draw_placeholder(surf: surface.Surface, t: TextField, x: float, y: float, font_size: float, color: core.Color)
proc draw_cursor(surf: surface.Surface, t: TextField, x: float, y: float, font_size: float, color: core.Color)
proc draw_rect_border(surf: surface.Surface, x: float, y: float, w: float, h: float, color: core.Color, width: float)
Generated by reefc doc