Skip to main content

Panel

Trait Panel 

Source
pub trait Panel: Downcast {
Show 14 methods // Required methods fn state(&self) -> &PanelState; fn state_mut(&mut self) -> &mut PanelState; // Provided methods fn title(&self) -> &'static str { ... } fn icon_only(&self) -> Option<&'static str> { ... } fn title_and_icon(&self) -> String { ... } fn hotkey_name(&self) -> Option<HotkeyName> { ... } fn render_menu( &mut self, _ui: &mut Ui, _data: &mut LivePlotData<'_>, _collapsed: bool, _tooltip: &str, ) { ... } fn render_panel(&mut self, _ui: &mut Ui, _data: &mut LivePlotData<'_>) { ... } fn draw( &mut self, _plot_ui: &mut PlotUi<'_>, _scope: &ScopeData, _traces: &TracesCollection, ) { ... } fn legend_entries( &self, _scope: &ScopeData, _traces: &TracesCollection, _out: &mut Vec<LegendEntryData>, ) { ... } fn update_data(&mut self, _data: &mut LivePlotData<'_>) { ... } fn clear_all(&mut self) { ... } fn settings_snapshot(&self, _data: &LivePlotData<'_>) -> Option<String> { ... } fn show_detached_dialog( &mut self, ctx: &Context, data: &mut LivePlotData<'_>, ) { ... }
}
Expand description

Trait for modular panels that can be docked, detached, and rendered.

Required Methods§

Source

fn state(&self) -> &PanelState

Source

fn state_mut(&mut self) -> &mut PanelState

Provided Methods§

Source

fn title(&self) -> &'static str

Source

fn icon_only(&self) -> Option<&'static str>

Icon only: returns Optional icon glyph that can be used in compact UI tabs.

Source

fn title_and_icon(&self) -> String

Title combined with optional icon (e.g., “⌨️ Hotkeys”). Returns an owned String so callers can use it directly in ui.button, ui.label, etc.

Source

fn hotkey_name(&self) -> Option<HotkeyName>

Return the HotkeyName associated with this panel, if any.

Override in panels that have a dedicated keyboard shortcut so that the UI can include the hotkey in button tooltips.

Source

fn render_menu( &mut self, _ui: &mut Ui, _data: &mut LivePlotData<'_>, _collapsed: bool, _tooltip: &str, )

Render the panel’s top-bar menu button.

collapsed – when true the button label should show only the panel icon. tooltip – hover-text for the menu button (title + hotkey).

Source

fn render_panel(&mut self, _ui: &mut Ui, _data: &mut LivePlotData<'_>)

Source

fn draw( &mut self, _plot_ui: &mut PlotUi<'_>, _scope: &ScopeData, _traces: &TracesCollection, )

Source

fn legend_entries( &self, _scope: &ScopeData, _traces: &TracesCollection, _out: &mut Vec<LegendEntryData>, )

Report the legend entries for the items Panel::draw adds to scope.

liveplot renders its own scrollable legend overlay (egui_plot’s item list is not public), so panels that draw named plot items must mirror them here — with the same canonical .id() set on the drawn items — or they will not appear in the legend.

Source

fn update_data(&mut self, _data: &mut LivePlotData<'_>)

Source

fn clear_all(&mut self)

Clear all internal runtime state / events / buffers specific to the panel. Default: no-op. Panels with internal collections override this.

Source

fn settings_snapshot(&self, _data: &LivePlotData<'_>) -> Option<String>

Returns a lightweight serialized snapshot of this panel’s settings for undo change detection. Returns None for panels with no serializable settings (e.g. export panel, hotkeys panel).

The snapshot should exclude visibility/detach state (that’s not part of undo) and only include user-configurable plot settings.

Source

fn show_detached_dialog(&mut self, ctx: &Context, data: &mut LivePlotData<'_>)

Implementations§

Source§

impl dyn Panel

Source

pub fn is<__T: Panel>(&self) -> bool

Returns true if the trait object wraps an object of type __T.

Source

pub fn downcast<__T: Panel>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn’t.

Source

pub fn downcast_rc<__T: Panel>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn’t.

Source

pub fn downcast_ref<__T: Panel>(&self) -> Option<&__T>

Returns a reference to the object within the trait object if it is of type __T, or None if it isn’t.

Source

pub fn downcast_mut<__T: Panel>(&mut self) -> Option<&mut __T>

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn’t.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§