Keyboard: Tab order, focus groups, panes and windows (F6), splitters (F8)#
Source: lib/ui/kbnav.rs
kbnav -- keyboard navigation between widgets: the Tab order with focus groups, panes and
windows (F6), splitters (F8), the menu key on every widget, the focus after its widget went
away, the first control of a new dialog window
App-facing:
focus_group_begin(id) / focus_group_end() the focusable widgets in between are one Tab
stop (a tool bar, a row of segments, a grid of buttons or swatches): the arrows move
inside (one row or column: Left / Up the previous, Right / Down the next, wrapping;
a grid: the nearest member in the arrow's direction), Home / End the first / last.
Tab enters a group at its current member (HB_CURRENT: the checked tool button, the
selected swatch), else at the member focused last, else at its first. Radios with
one variable, tool buttons with one variable and the swatches of one box are groups
by themselves (radios: the selection follows the arrows). Text boxes never join.
splitter_keys(ev, along_x) -> DIP the arrows on a focused splitter of the app
group_arrived(id) -> bool the arrows just focused this member (once):
selection-follows-focus widgets (tabs, radios) select it
focus_pane_begin(id) / focus_pane_end() a pane of the window: F6 / Shift+F6 go to the
next / previous pane (to the widget focused there last, else its first Tab stop),
past the last one on to the next window -- tool windows too, which then get the keys
until Esc, F6 or a click elsewhere; Ctrl+F6 / Ctrl+Shift+F6 switch the windows
directly. The document area and every group of a dock area and both sides of a
split view are panes by themselves.
Built in: Tab / Shift+Tab (Ctrl+Tab stays the app's); F8 / Shift+F8 the window's splitters
(HB_SPLITTER: the arrows move the focused one by 8 DIP, Shift+arrows by 1, Home / End to the
ends; Enter, Esc or F8 past the last return to the widget focused before); the menu key /
Shift+F10 that no widget took: a right click of the focused widget (EV_RCLICK, a focused
list passes it to its selected row; menu_popup then opens at the widget with its first row
focused); Tab after the focused widget went away goes on from its place; a dialog window
shown starts with the focus on its first control (the ring appears with the first key).
An app accelerator on F6 / F8 wins over these keys.
Tool windows that borrow their owner's keys (win.rs, U3) keep the navigation keys and hand
the others on (kb_take_rest).
impl Ui
fn focus_group_begin(&mut self, id: u32)focus_group_begin(id): the focusable widgets up to focus_group_end are one Tab stop, the arrows move inside (id 0: the current box's id)fn focus_group_end(&mut self)focus_group_endfn focus_pane_begin(&mut self, id: u32)focus_pane_begin(id): the widgets up to focus_pane_end are a pane (F6 / Shift+F6)fn focus_pane_end(&mut self)focus_pane_endfn group_arrived(&mut self, id: u32) -> boolgroup_arrived(id): the arrow keys of its focus group just moved the focus to widget id (true once; a widget whose selection follows the focus -- tabs, radios -- selects itself then)fn splitter_keys(&mut self, ev: u32, along_x: bool) -> i32splitter_keys(ev, along_x) -> how far (DIP, + right / down) the keys of this pass move a focused splitter of the app (a box with HB_SPLITTER, its events ev; along_x: it moves left / right); Home / End: i32::MIN / 2, i32::MAX / 2 (clamp it); Enter / Esc give the focus back to the widget focused before F8