Skip to main content

Module compact

Module compact 

Source
Expand description

Controls for dense rows, where a control has a slot of a given size and no label beside it (a HUD’s parts, a property sheet, a card’s fold): a choice in a compact cell and a menu row. The scrub field is the slider’s scrub look, and a text in a compact cell the decorated input’s cell.

Experimental: may change in any release (docs/stability.md).
  • ChoiceCell: one of a few words in a slot, egui-pop’s combo_box sized to it. Its name is given to assistive technologies and shown in its tooltip; while it has the focus and its list is closed, Up and Down choose the previous and next word, Home and End the first and last, as a native drop-down does; Space or Enter opens the list.
  • MenuRow: a row the width of its room in the look of a menu’s items (the kit’s menu-item), its text at the start and a muted note at the end (a count, a key): an entry of a “More (n)” fold, a “Show all”. A button to assistive technologies, focused by Tab and pressed with Space or Enter.
  • RowButton: a button small enough for a list’s row (Cancel, Retry beside a job), the kit’s button around its words with a hairline’s padding, no taller than the row (Tokens’ size.row.height). A button to assistive technologies, named by its words, focused by Tab and pressed with Space or Enter.
use egui_pop_core::compact::{ChoiceCell, MenuRow, RowButton};

fn row(ui: &mut egui::Ui, mode: &mut usize) {
    let size = egui::vec2(120.0, 22.0);
    ChoiceCell::new("Blend mode", mode, &["Normal", "Multiply", "Screen"])
        .size(size)
        .show(ui);
    if ui.add(MenuRow::new("Show Contrast").note("hidden")).clicked() {
        // reveal it
    }
    if ui.add(RowButton::new("Cancel")).clicked() {
        // cancel the row's job
    }
}

Structs§

ChoiceCell
One of a few words in a compact cell (see the module).
MenuRow
A row in the look of a menu’s items (see the module).
RowButton
A button small enough for a list’s row (see the module).