pub fn roving<R>(
ui: &mut Ui,
name: &str,
axis: Axis,
add: impl FnOnce(&mut Ui) -> R,
) -> RExpand description
Draws add as a roving group named name: one Tab stop for all its
widgets, the arrows going between them (a toolbar, a strip of icons, a
status bar), as ARIA’s toolbar pattern has it.
- Tab from any of its widgets leaves the group, past its last widget, and Shift+Tab before its first.
- Tab coming in, either way, lands on the widget focused there last; on its first the first time.
- The arrows along it (Left and Right for
Axis::Horizontal, Up and Down forAxis::Vertical) go to the widget placed before or after, round from one end to the other; Home and End to its ends. The other arrows are left to egui (and stay in their region).
Its widgets are those drawn inside add that can take the focus, so a
disabled one is passed over. An open menu or popup keeps the arrows, and a
focused text field every key. Name each group of a window apart: the widget
focused last is remembered by name.
It needs the focus plugin (focus::install; an
application has it): without it, the widgets stay stops of egui’s order.
use egui_pop_core::tab::{self, Axis};
fn tools(ui: &mut egui::Ui) {
tab::roving(ui, "tools", Axis::Horizontal, |ui| {
ui.horizontal(|ui| {
let _ = ui.button("Cut");
let _ = ui.button("Copy");
let _ = ui.button("Paste");
});
});
}