Shell parts: navigation, command bar, splitter, breadcrumb, wizard steps#
Source: lib/ui/shell.rs
shell -- the parts of an application shell: navigation pane, command bar, splitter,
breadcrumb, segmented control, wizard step list
nav_begin(id, &mut NavState) vertical navigation pane (next_size sets its width;
the style's surface), items scroll when they do not fit
nav_toggle(id, label) the pane's menu button: toggles NavState::compact
nav_section(label) a group caption (compact: a divider)
nav_item(id, icon, label, selected, badge) -> EV EV_ACT when clicked; badge: a count
nav_footer() the items after it stay at the bottom of the pane
nav_end()
command_bar(id, items) -> Option<id> a row of subtle icon + label buttons; what does not
fit goes into a "…" menu; CBI_END starts the group
aligned to the end, CBI_SEP a separator; ST_ACCENT /
ST_DISABLED / ST_CHECKED per item
split_begin(id, pos, vertical) two panes: the first `pos` DIP wide (vertical: high),
split_next() a draggable grip, the second fills
split_end(&mut pos) -> changed the dragged position (DIP)
breadcrumb(id, parts) -> Option<i> path of links, the last part is the current page
segmented(id, &mut sel, items) -> EV a segmented control (EV_ACT when sel changed)
wizard_steps(id, steps, current, states) -> Option<i> vertical step list; a click on
a done step (or one before the current) returns it
Ids: parts (id << 3 | k) | 0x80000000; items of segmented / wizard / breadcrumb id + 1 + i.
struct CmdItem<'a>an item of a command barid: u32icon: u32label: &'a strflags: u32-- ST_ACCENT, ST_DISABLED, ST_CHECKED, CBI_SEP, CBI_END
impl<'a> CmdItem<'a>
const fn new(id: u32, icon: u32, label: &'a str) -> CmdItem<'a>const fn flags(mut self, f: u32) -> CmdItem<'a>add flags (ST_ACCENT, CBI_SEP, ...; in any order with enabled())const fn enabled(mut self, on: bool) -> CmdItem<'a>disabled unlesson
impl Ui
fn command_bar(&mut self, id: u32, items: &[CmdItem]) -> Option<u32>ui_command_bar(id, items) -> the id of the item clicked in this passfn split_begin(&mut self, id: u32, pos: i32, vertical: bool)ui_split_begin(id, pos, vertical): two panes, the firstposDIP wide (vertical: high); emit the first pane, split_next, the second pane, split_endfn split_next(&mut self)ui_split_next: the grip, then the second panefn split_end(&mut self, pos: &mut i32) -> boolui_split_end(&mut pos) -> the grip moved (pos updated, DIP; the mouse or the keyboard: F8 focuses the grip, arrows move it)fn segmented(&mut self, id: u32, sel: &mut i32, items: &[&str]) -> u32ui_segmented(id, &mut sel, items) -> EV_* (EV_ACT when sel changed)fn wizard_steps(&mut self, id: u32, steps: &[&str], current: usize, states: &[i32]) -> Option<usize>ui_wizard_steps(id, steps, current, states) -> a step to go back to (clicked); states: WS_* per step (missing: done before the current, todo after it)fn page_header(&mut self, title: &str, subtitle: &str)ui_page_header(title, subtitle): a page title (TS_TITLE) with an optional secondary line under itfn key_value(&mut self, key: &str, value: &str, key_width: i32)ui_key_value(key, value, key_width): a "label: value" row (TS_BODY, the key in the secondary colour, key_width DIP)fn empty_state(&mut self, icon: u32, title: &str, text: &str)ui_empty_state(icon, title, text): a centred hint for an empty view (icon 0 = none); the text wraps at 360 DIP, or at the enclosing box's width when that is narrower