Guide API
Skip to main content

Module widgets

Module widgets 

Source
Expand description

Widget implementations — the leaf views (buttons, input lines, lists, editors, scrollbars, and more).

Each submodule holds one widget. The canonical embed pattern is: state: ViewState, impl View returning it from state/state_mut, implement draw through DrawCtx, and handle events through Context.

Guide: Controls.

§Deliberate omissions

Turbo Vision’s TMonoSelector — a cluster-based picker for monochrome screen attributes, used only inside the old color dialog — is intentionally not ported. The color picker was rebuilt (see crate::dialog::ColorPicker) and needs no mono-attribute selector; the general tabbed-selection idiom is covered by TabBar.

Re-exports§

pub use list_viewer::FindMode;
pub use list_viewer::ListRoles;
pub use list_viewer::ListViewer;
pub use list_viewer::ListViewerState;
pub use outline::Node;
pub use outline::Outline;
pub use outline::OutlineViewer;
pub use outline::OutlineViewerState;
pub use outline::ov_update;
pub use splitter::Constraints;
pub use splitter::DividerStyle;
pub use splitter::Orientation;
pub use splitter::Splitter;
pub use table::Align;
pub use table::ColumnSpec;
pub use table::ColumnState;
pub use table::RowKey;
pub use table::SelectionMode;
pub use table::Separators;
pub use table::SortDir;
pub use table::SortKey;
pub use table::Table;
pub use table::TableModel;
pub use table::ValidatorFactory;
pub use table::VecModel;
pub use terminal::Terminal;
pub use terminal::TextDevice;

Modules§

list_viewer
The abstract base for every list widget (ListBox, history viewers, color/file lists). It lays out range items in num_cols columns, tracks a focused item and a top_item scroll offset, and drives two sibling scroll bars that live on the window frame.
outline
A collapsible tree view: Node, OutlineViewer, and Outline.
splitter
A resizable multi-pane layout: Splitter arranges N panes along one axis, separated by 1-cell dividers that the user drags (or moves from the keyboard in resize mode) to resize the panes. Constraints bound each pane’s size, DividerStyle sets how each divider looks and whether it moves, and Splitter::joined connects the divider lines to the window frame and to each other through the junction glyph selectors.
table
A multi-column table: a column header with click-to-sort over a scrolling row list, with single or multi selection that follows a stable row key across sorting and reloads.
terminal
A scrolling text terminal: TextDevice (the output trait) and Terminal (a ring-buffer view that shows the most recent lines).

Structs§

Button
A clickable command button: a 2+-row box with a centered (or left-justified) title, a drop shadow, and an ~-marked hotkey. Pressing it (mouse, Alt+hotkey, focused-Space, or — for the default button — the Command::DEFAULT broadcast) fires its command, either posted as an Event::Command or broadcast.
ButtonFlags
Button flags — the decoration/behavior flags as a struct-of-bools.
CheckBoxes
A group of independent on/off checkboxes; cluster.value is a bitmask where bit i is set when item i is checked.
Cluster
The cluster engine (state + layout + nav + draw + events).
EditWindow
A Window hosting a FileEditor with two scroll bars and an Indicator. An embed-and-delegate wrapper over Window; the constructor wires the editor to the (initially hidden) scroll bars and indicator by id.
Editor
A gap-buffer text editor: a leaf View holding a single Vec<u8> split by a movable gap, with a cursor, a selection, single-level undo, and a viewport (delta) onto a content extent (limit). It references two sibling scroll bars and an indicator on the window frame, runs Find / Replace dialogs, and cuts/copies/pastes through a shared internal clipboard editor.
FileEditor
An Editor backed by a file on disk. An embed-and-delegate wrapper; the editor runs in file-editor mode (growable buffer plus save commands).
HistoryViewer
A read-only single-column list over the global history store, shown in a modal recall popup when a user drops down an input field.
HistoryWindow
The modal window hosting a HistoryViewer recall list.
Indicator
A 1-row strip that displays an editor’s current cursor position (row:col). It is owned by the editor and updated through Indicator::set_value.
InputLine
A single-line text-entry field with selection, horizontal scrolling, an optional Validator, and the typed value/ set_value data protocol.
Label
A single-line caption that links to a control: clicking it (or pressing its ~-marked hotkey) focuses the linked control, and the label highlights while that control is focused.
ListBox
A concrete list viewer that owns a Vec<String> as its item source.
MaskedInput
A masked text field with a reveal eye: an InputLine (masked) plus a RevealEye in its last column, bundled as one group so the eye is its own Tab stop and reveal is wired internally.
Memo
A single-field multi-line editor for use inside a dialog. An embed-and-delegate wrapper over Editor; the only behavioural differences from the base editor are: it swallows a plain Tab keypress (so Tab navigates the dialog rather than inserting), and it exposes its text as a typed FieldValue for dialog gather/scatter.
MultiCheckBoxes
Checkboxes where each item cycles through more than two states; cluster.value packs an n-bit state field per item into a single u32.
PageStack
A content multiplexer: a group of child “page” Views of which exactly one is visible at a time.
ParamText
A dynamic-text variant of StaticText whose content is set at run time. It embeds a StaticText and delegates everything to it; only the text is replaceable.
RadioButtons
A group of mutually-exclusive radio buttons; cluster.value is the index of the currently selected button (0-based).
RevealEye
A one-cell focusable “reveal” eye for masked InputLine fields.
RevealEyeConfig
Behaviour of a RevealEye. The eye glyphs are theme-controlled (Glyphs::reveal_eye_hidden / reveal_eye_revealed), so this config carries only the interaction knobs.
ScrollBar
A single-axis scroll-bar widget: a draggable thumb between two step-arrows, with paging troughs on either side.
Scroller
The base scrollable-content view.
SortedListBox
A list viewer with incremental type-to-search over a case-insensitively sorted string list. A direct ListViewer impl (like ListBox); the search state machine lives as the sorted_handle_event / sorted_cursor free functions over the SortedSearch sub-trait, which this widget implements.
StaticText
A read-only, word-wrapped text block. No events; not selectable.
THistory
THistory — the dropdown-arrow icon placed next to a InputLine.
TabBar
A horizontal single-row tab selector: corner-cap active tab (┌Label┐), ←/→/hotkey/click selection.

Enums§

ClusterKind
Selects which of the three cluster behaviors the Cluster engine applies.
Encoding
How multibyte characters are stepped over.
LimitMode
How the limit constructor argument is interpreted — which of the three internal caps it sets.
LineEnding
How line breaks are stored when text is inserted.
ValuePosition
Where View::set_value leaves a field: which end of the text is on screen.

Constants§

SM_DOUBLE
Word-granular selection (double-click): snap both ends to word boundaries.
SM_EXTEND
Extend the current selection to the new cursor position, instead of collapsing it to a point at p.
SM_TRIPLE
Line-granular selection (triple-click): snap both ends to line boundaries.

Functions§

clear_history
Remove every stored history entry across all channel ids.
history_add
Add str to the history channel identified by id.
history_count
Return the number of history entries for id.
history_str
Return the entry at index (oldest-first) for id, or None if out of range.