pub struct WidgetBar {
pub config: WidgetBarConfig,
pub icons: Vec<RightBarIcon>,
pub active_icon: Option<RightBarIcon>,
pub widgets: Vec<WidgetBarWidget>,
pub active_widget: Option<u64>,
pub notification_counts: HashMap<RightBarIcon, u32>,
/* private fields */
}Expand description
Right Edge Icon Bar
Fields§
§config: WidgetBarConfigDisplay and layout options for this component.
icons: Vec<RightBarIcon>Built-in entries shown, drawn in RightBarIcon order.
active_icon: Option<RightBarIcon>Currently open built-in panel. Clicks toggle this value; the host must keep it
in step with panels opened or closed elsewhere before calling show.
widgets: Vec<WidgetBarWidget>Host widget entries, empty until the host supplies them.
active_widget: Option<u64>Active host widget. Selecting a built-in entry clears it, and vice versa.
notification_counts: HashMap<RightBarIcon, u32>Badge counts keyed by built-in bar entry.
Implementations§
Source§impl WidgetBar
impl WidgetBar
Sourcepub fn with_config(self, config: WidgetBarConfig) -> Self
pub fn with_config(self, config: WidgetBarConfig) -> Self
Use the supplied display and layout options.
Sourcepub fn register_panel(
&mut self,
widget: WidgetBarWidget,
content: impl FnMut(&mut Ui) + 'static,
)
pub fn register_panel( &mut self, widget: WidgetBarWidget, content: impl FnMut(&mut Ui) + 'static, )
Register a host panel, using the widget tooltip as its title and accessible name.
Replacing an existing id preserves its position in the strip and its active state.
The callback may capture host state and runs only while this panel is open. Call
Self::show_panel after Self::show and before the central chart panel.
Hosts own the contents, data sources and persistence.
use egui_charts::icons::icons;
use egui_charts::ui::widget_bar::{WidgetBar, WidgetBarSection, WidgetBarWidget};
let mut bar = WidgetBar::new();
let mut notes = String::new();
bar.register_panel(WidgetBarWidget {
id: 42, icon: icons::WATCHLIST, tooltip: "Session notes".into(),
section: WidgetBarSection::Top,
}, move |ui| { ui.text_edit_multiline(&mut notes); });
// In each frame: bar.show(rail_ui); bar.show_panel(root_ui); then show the chart.Sourcepub fn show_panel(&mut self, ui: &mut Ui)
pub fn show_panel(&mut self, ui: &mut Ui)
Show the active registered panel beside the strip, with a themed title and close button.
Clicking the same strip entry or the close button closes it. Built-in selections clear the active host panel. Widget entries without a registered callback remain host-rendered. Panel width is resizable and retained by egui under the widget’s stable id.
Sourcepub fn set_control_visible(&mut self, control: Control, visible: bool)
pub fn set_control_visible(&mut self, control: Control, visible: bool)
Shows or hides Alerts, ObjectTree or Help and clears a hidden active entry. Other controls are ignored. Hosts close any corresponding panel they render.
Sourcepub fn set_notification_cnt(&mut self, icon: RightBarIcon, count: u32)
pub fn set_notification_cnt(&mut self, icon: RightBarIcon, count: u32)
Set the badge count for a built-in bar entry.
Sourcepub fn show(&mut self, ui: &mut Ui) -> WidgetBarAction
pub fn show(&mut self, ui: &mut Ui) -> WidgetBarAction
Show the bar, keeping the bottom section at the foot and scrolling if it cannot fit. Host widget clicks return their id; the host owns the corresponding panel contents.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for WidgetBar
impl !Send for WidgetBar
impl !Sync for WidgetBar
impl !UnwindSafe for WidgetBar
impl Freeze for WidgetBar
impl Unpin for WidgetBar
impl UnsafeUnpin for WidgetBar
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
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> ⓘ
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> ⓘ
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