Panel

Trait Panel 

Source
pub trait Panel:
    EventEmitter<PanelEvent>
    + Render
    + Focusable {
Show 14 methods // Required method fn panel_name(&self) -> &'static str; // Provided methods fn tab_name(&self, cx: &App) -> Option<SharedString> { ... } fn title(&self, window: &Window, cx: &App) -> AnyElement { ... } fn title_style(&self, cx: &App) -> Option<TitleStyle> { ... } fn title_suffix( &self, window: &mut Window, cx: &mut App, ) -> Option<AnyElement> { ... } fn closable(&self, cx: &App) -> bool { ... } fn zoomable(&self, cx: &App) -> Option<PanelControl> { ... } fn visible(&self, cx: &App) -> bool { ... } fn set_active(&mut self, active: bool, window: &mut Window, cx: &mut App) { ... } fn set_zoomed(&mut self, zoomed: bool, window: &mut Window, cx: &mut App) { ... } fn popup_menu( &self, this: PopupMenu, window: &Window, cx: &App, ) -> PopupMenu { ... } fn toolbar_buttons( &self, window: &mut Window, cx: &mut App, ) -> Option<Vec<Button>> { ... } fn dump(&self, cx: &App) -> PanelState { ... } fn inner_padding(&self, cx: &App) -> bool { ... }
}
Expand description

The Panel trait used to define the panel.

Required Methods§

Source

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

The name of the panel used to serialize, deserialize and identify the panel.

This is used to identify the panel when deserializing the panel. Once you have defined a panel name, this must not be changed.

Provided Methods§

Source

fn tab_name(&self, cx: &App) -> Option<SharedString>

The name of the tab of the panel, default is None.

Used to display in the already collapsed tab panel.

Source

fn title(&self, window: &Window, cx: &App) -> AnyElement

The title of the panel

Source

fn title_style(&self, cx: &App) -> Option<TitleStyle>

The theme of the panel title, default is None.

Source

fn title_suffix(&self, window: &mut Window, cx: &mut App) -> Option<AnyElement>

The suffix of the panel title, default is None.

This is used to add a suffix element to the panel title.

Source

fn closable(&self, cx: &App) -> bool

Whether the panel can be closed, default is true.

This method called in Panel render, we should make sure it is fast.

Source

fn zoomable(&self, cx: &App) -> Option<PanelControl>

Return PanelControl if the panel is zoomable, default is PanelControl::Menu.

This method called in Panel render, we should make sure it is fast.

Source

fn visible(&self, cx: &App) -> bool

Return false to hide panel, true to show panel, default is true.

This method called in Panel render, we should make sure it is fast.

Source

fn set_active(&mut self, active: bool, window: &mut Window, cx: &mut App)

Set active state of the panel.

This method will be called when the panel is active or inactive.

The last_active_panel and current_active_panel will be touched when the panel is active.

Source

fn set_zoomed(&mut self, zoomed: bool, window: &mut Window, cx: &mut App)

Set zoomed state of the panel.

This method will be called when the panel is zoomed or unzoomed.

Only current Panel will touch this method.

Source

fn popup_menu(&self, this: PopupMenu, window: &Window, cx: &App) -> PopupMenu

The addition popup menu of the panel, default is None.

Source

fn toolbar_buttons( &self, window: &mut Window, cx: &mut App, ) -> Option<Vec<Button>>

The addition toolbar buttons of the panel used to show in the right of the title bar, default is None.

Source

fn dump(&self, cx: &App) -> PanelState

Dump the panel, used to serialize the panel.

Source

fn inner_padding(&self, cx: &App) -> bool

Whether the panel has inner padding when the panel is in the tabs layout, default is true.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§