1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! Floating surfaces anchored to a control: [`Select`], [`Combobox`], [`Popover`] and the
//! [`help`] tooltip. Context menus built from a `MenuSpec` are
//! [`crate::commands::menu::context`].
//!
//! They share one behaviour: the surface opens below its anchor and flips above it when there is
//! more room there, Escape or a click outside closes it, it fades in and out with the
//! `enter_exit` motion token (a short fade under reduced motion) and asks for no frames once
//! settled. Options register as `<id>.option.<n>` for automation, where `n` is the option's
//! index in the slice the caller passed.
//!
//! ```
//! # use ashlar_ui::overlay::{Combobox, ComboboxState, Select};
//! # fn frame(ui: &mut egui::Ui, size: &mut usize, font: &mut ComboboxState) {
//! let sizes = ["Small", "Medium", "Large"];
//! if Select::new("size", &sizes, size).show(ui).changed() {
//! // sizes[*size] was chosen
//! }
//! let fonts = ["Inter", "Iosevka", "JetBrains Mono"];
//! if let Some(i) = Combobox::new("font", &fonts, font).show(ui).chosen {
//! // fonts[i] was chosen; font.text holds its label
//! }
//! # }
//! ```
pub use ;
pub use ;
pub use Select;
pub use help;
/// At most this many options are visible at once; the rest scroll.
pub const VISIBLE_OPTIONS: usize = 8;