Module: reefvision.widgets.combo
Source: ./reefvision/widgets/combo.reef
Overview
reefvision.widgets.combo — one-line field + scrollable dropdown
object ComboBox extends view.View. Closed: current item + ▼. Open: ListBox paints below the field (Group/Window overlay pass). Down / Enter / Space / click toggles. Esc closes. Overlay mouse hits the list even though bounds.h is 1.
Usage: let cb = new combo.ComboBox(cell.rect(1, 2, 24, 1), 16, 8) let _ = cb.add_item("Cobalt") win.add(cb)
Objects
ComboBox
Extends: view.View
Fields:
| Name | Type |
|---|---|
list |
listbox.ListBox |
drop_rows |
int |
is_open |
bool |
proc init(bounds: cell.Rect, capacity: int, drop_rows: int)
Methods:
override shared fn wants_focus(): bool
override shared fn captures_mouse(): bool
override shared fn overlay_open(): bool
override shared fn overlay_rect(): cell.Rect
shared fn count(): int
shared fn selected(): int
shared fn item(idx: int): option.Option[string]
shared fn item_or(idx: int, fallback: string): string
shared fn selected_text(): option.Option[string]
The selected row's text, or None when the list is empty.
ROADMAP 8.2b called this the case the conversion actually improves: it
is self.list.item(self.list.selected), a sentinel index feeding a
sentinel string. selected is 0 on an empty list, so the old "" could
mean "nothing is selected" OR "the selected row is empty text", and no
caller could tell.
shared fn selected_text_or(fallback: string): string
exclusive fn add_item(text: string): bool
exclusive proc clear()
exclusive proc set_selected(idx: int)
exclusive proc select_text(text: string)
exclusive proc close_list()
exclusive proc open_list()
exclusive proc sync_list_bounds()
override exclusive proc draw(buf: cell.CellBuffer, abs: cell.Rect, clip: cell.Rect, focused: bool, th: theme.Theme)
override exclusive proc draw_overlay(buf: cell.CellBuffer, abs: cell.Rect, clip: cell.Rect, focused: bool, th: theme.Theme)
override exclusive fn handle_event(e: event.Event): view.EventResult
exclusive fn handle_mouse(e: event.Event): view.EventResult
Functions
fn arrow_ch(): int
fn is_space_key(e: event.Event): bool
fn click_in_list_row(e: event.Event, list_bounds: cell.Rect, drop_rows: int): bool
Generated by reefc doc