pub struct ToolbarEntry {
pub id: String,
pub label: String,
pub icon: Option<&'static Icon>,
pub items: Vec<ToolbarEntry>,
pub visible: bool,
}Expand description
A host button, or a dropdown when Self::items is nonempty.
Entries retain registration order and use the active theme. Ids must be unique within
the toolbar, including dropdown children. The host handles TopToolbarAction::Host.
use egui_charts::ui::top_toolbar::{TopToolbar, ToolbarEntry};
let mut toolbar = TopToolbar::new();
toolbar.host_entries.push(ToolbarEntry::new("research", "Research"));
toolbar.host_entries.push(ToolbarEntry::new("tools", "Host tools").with_items(vec![
ToolbarEntry::new("ticket", "Order ticket"),
]));
// toolbar.show_with_state(ui, app_state) returns TopToolbarAction::Host(id).Fields§
§id: StringStable id returned when this entry is chosen.
label: StringButton or menu label.
icon: Option<&'static Icon>Optional icon using the built-in size and tint.
items: Vec<ToolbarEntry>Dropdown choices in display order. Only top-level entries open dropdowns. An empty list makes this entry a button.
visible: boolWhether to show this entry. Hidden entries take no space and emit no actions.
Implementations§
Auto Trait Implementations§
impl Freeze for ToolbarEntry
impl RefUnwindSafe for ToolbarEntry
impl Send for ToolbarEntry
impl Sync for ToolbarEntry
impl Unpin for ToolbarEntry
impl UnsafeUnpin for ToolbarEntry
impl UnwindSafe for ToolbarEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more