CUI

Components / Developer tools

Keymap

A keyboard with the shortcuts on it.

Functions: cui_keymap

Keymap

Usage

static int mods = CUI_MOD_PRIMARY;
cui_keymap_result r = cui_keymap(ui, "keys", bindings, binding_count,
                                 .categories = categories, .category_count = 4, .mods = &mods);
if (r.clicked) start_rebinding(r.clicked, mods);

Each bound key shows its action, and a bar in its category's color. Tabs above it pick the modifiers, and each tab shows how many shortcuts use them. A key bound twice is outlined in red, and the count of conflicts is shown and returned. A hover lists every binding on the key, and a click returns it. Labels shrink to fit a key and then are cut short. The navigation cluster drops out below 600 points, and the keyboard scales to the width it gets. no_function_row leaves out the function keys.

Keyboard

  • Tab focuses the modifier tabs, and Left and Right move between them. The keys of the drawn keyboard are clicked with the pointer.

Options of cui_keymap

OptionTypeDefaultDescription
.widthcui_sizeWidth: CUI_FILL, CUI_FIT, CUI_PX(n) or CUI_PCT(n); unset uses the component's own.
.categoriesconst char *const *names for the legend
.category_countintnumber of categories
.modsint *the modifiers shown; NULL: kept for you
.no_function_rowboolleaves out the row of function keys

cui_keymap_binding

FieldTypeDescription
combocui_key_combothe modifiers and key the action is bound to
actionconst char *name of the action, shown on the key and in its tooltip
categoryintindex into the categories, colors the key

cui_keymap_result

FieldTypeDescription
clickedcui_keykey clicked this frame, or CUI_KEY_NONE
conflictsintbindings that repeat a combination another binding already uses

cui_key: CUI_KEY_NONE, CUI_KEY_TAB, CUI_KEY_ENTER, CUI_KEY_ESCAPE, CUI_KEY_BACKSPACE, CUI_KEY_DELETE, CUI_KEY_SPACE, CUI_KEY_LEFT, CUI_KEY_RIGHT, CUI_KEY_UP, CUI_KEY_DOWN, CUI_KEY_HOME, CUI_KEY_END, CUI_KEY_PAGE_UP, CUI_KEY_PAGE_DOWN, CUI_KEY_A, CUI_KEY_B, CUI_KEY_C, CUI_KEY_D, CUI_KEY_E, CUI_KEY_F, CUI_KEY_G, CUI_KEY_H, CUI_KEY_I, CUI_KEY_J, CUI_KEY_K, CUI_KEY_L, CUI_KEY_M, CUI_KEY_N, CUI_KEY_O, CUI_KEY_P, CUI_KEY_Q, CUI_KEY_R, CUI_KEY_S, CUI_KEY_T, CUI_KEY_U, CUI_KEY_V, CUI_KEY_W, CUI_KEY_X, CUI_KEY_Y, CUI_KEY_Z, CUI_KEY_0, CUI_KEY_1, CUI_KEY_2, CUI_KEY_3, CUI_KEY_4, CUI_KEY_5, CUI_KEY_6, CUI_KEY_7, CUI_KEY_8, CUI_KEY_9, CUI_KEY_MINUS, CUI_KEY_EQUAL, CUI_KEY_COMMA, CUI_KEY_PERIOD, CUI_KEY_SLASH, CUI_KEY_F1, CUI_KEY_F2, CUI_KEY_F3, CUI_KEY_F4, CUI_KEY_F5, CUI_KEY_F6, CUI_KEY_F7, CUI_KEY_F8, CUI_KEY_F9, CUI_KEY_F10, CUI_KEY_F11, CUI_KEY_F12, CUI_KEY_COUNT

Related

  • Commit graph: Version history with its branch lanes.
  • Schedule picker: A cron schedule edited through plain choices instead of the expression, with the next runs listed.
  • Dependency graph: Nodes and directed edges laid out in layers, for build targets, packages, services or call graphs.
  • Query builder: A filter built from conditions joined by all or any, in groups that nest.