CUI

Components / Navigation

Status bar

The thin bar at the bottom of a window for state, counts and background progress.

Functions: cui_status_bar, cui_status_bar_item, cui_status_bar_progress, cui_status_bar_spacer, cui_status_bar_text

Status bar

Usage

cui_status_bar(ui, "status") {
    if (cui_status_bar_item(ui, branch, .icon = CUI_ICON_GIT_BRANCH, .tooltip = "Switch branch")) pick_branch();
    cui_status_bar_text(ui, "Saved", .icon = CUI_ICON_CHECK, .tone = CUI_TONE_SUCCESS);
    cui_status_bar_progress(ui, indexed, .label = "Indexing");
    cui_status_bar_spacer(ui);
    char pos[48];
    snprintf(pos, sizeof pos, "Ln %d, Col %d###pos", line, col);
    if (cui_status_bar_item(ui, pos)) go_to_line();
    if (cui_status_bar_item(ui, "UTF-8")) pick_encoding();
}

Items run left to right and cui_status_bar_spacer sends the rest to the right edge. Texts and items are 12 point with tabular figures, so a counting position keeps its width; give an item whose label changes a fixed key ("Ln 12, Col 4###pos") so it keeps its hover and focus. Items are in the Tab order and return true when clicked. tone colors a message's icon. The progress bar is 64 points wide (.width) and fills with the accent; .indeterminate slides a segment along it, which stays still with reduced motion.

Keyboard

  • Items are in the Tab order and return true when clicked.

Options of cui_status_bar

OptionTypeDefaultDescription
.no_borderboolDraws no border.

Options of cui_status_bar_item, cui_status_bar_text

OptionTypeDefaultDescription
.iconconst char *An icon: a CUI_ICON_* constant, or a string from another icon font.
.tonecui_toneOne of CUI_TONE_NEUTRAL, CUI_TONE_INFO, CUI_TONE_SUCCESS, CUI_TONE_WARNING, CUI_TONE_DANGER, CUI_TONE_VIOLET, CUI_TONE_TEAL, CUI_TONE_ROSE or CUI_TONE_ACCENT.
.tooltipconst char *Text shown when the pointer rests on it.
.disabledboolGreyed out, and takes no input.

Options of cui_status_bar_progress

OptionTypeDefaultDescription
.labelconst char *A label shown above or beside the control.
.indeterminateboolAn animation with no amount, for work of unknown length.
.widthfloatWidth in points; 0 uses the component's own.

Related

  • Docking: Panels the user arranges by dragging: split, tabbed and resized, with a layout you can save and load.
  • Document tabs: Closable tabs for open documents that can be dragged into a new order, as in an editor.
  • Toolbar: A row of small buttons, toggles and separators for an editor's most used commands.
  • Menu bar: The File, Edit, View row of a desktop app, with a menu under each title.