Skip to main content

PanelTabProps

Struct PanelTabProps 

Source
pub struct PanelTabProps {
Show 16 fields pub viewer: HtmlElement, pub panel_id: String, pub title: Option<String>, pub theme: Option<String>, pub active: bool, pub visible: bool, pub is_master: bool, pub single: bool, pub closable: bool, pub is_settings_open: bool, pub draggable: bool, pub on_select: Callback<String>, pub on_close: Callback<String>, pub on_open_settings: Callback<String>, pub on_context_menu: Callback<(String, f64, f64)>, pub on_rename: Callback<(String, Option<String>)>,
}
Expand description

A panel’s titlebar tab. The host is a <perspective-viewer-tab> custom element mounted in the viewer’s light DOM and forwarded into its <regular-layout-frame> titlebar via a <slot name="tab-{id}" slot="tab"> (rendered by MainPanel); the tab’s contents live in the host’s ShadowRoot, whose adoptedStyleSheets carry the structure CSS.

Keeping the host in the light DOM — like the plugin — is what lets document theme CSS (perspective-viewer [theme="X"]) reach it, so each panel’s chrome is themed by the native cascade instead of a runtime-inlined string; the --psp-* those rules set are inherited across the shadow boundary into the contents. The host carries part="tab", which <regular-layout-frame>’s pointer handler treats as a drag handle (regular-layout@>=0.6.0’s custom-tab contract); the title is pointer-events:none so clicks fall through to the host (like the built-in <regular-layout-tab>).

Fields§

§viewer: HtmlElement

The <perspective-viewer> host element; the tab is attached here as a light-DOM child (mirrors renderer::activate’s plugin mount).

§panel_id: String

The panel id. The tab is assigned to slot="tab-{panel_id}".

§title: Option<String>

The panel’s title; falls back to the id when None.

§theme: Option<String>

This panel’s effective theme. Reflected onto the host’s theme attribute so the document theme rules (perspective-viewer [theme="X"]) theme the tab per-panel via the native cascade.

§active: bool

true when this is the active panel (toolbar target / selected tab); drives the active-tab styling.

§visible: bool

true when this panel is visible — the front (selected) tab of its stack, or a lone panel. Hidden panels are those at an unselected index of a tab stack. Independent of active: every stack has a visible panel, but only one panel in the whole layout is active.

§is_master: bool

true when this panel is a master (filter-source) panel — shows the broadcast badge to the left of the close button.

§single: bool

true when this is the host viewer’s ONLY panel (one plugin child). Reflected on the host as a single/multi class — the same panel-count CSS hook Renderer::stamp_active stamps on the plugin — e.g. the caret is hidden on a lone tab (see panel-tab.css).

§closable: bool

false for a lone panel (which can’t be closed to zero) — hides the close button.

§is_settings_open: bool

true when the settings sidebar is open. When closed, the tab renders an open-settings button in place of the close button — the only affordance for opening the settings panel (there is deliberately none at zero panels).

§draggable: bool

false for a lone panel — suppresses the tab rearrange-drag. <regular-layout-frame> arms a drag from any part="tab" pointerdown, but a lone panel has nowhere to drop, so the host pointerdown handler stops the event before it reaches the frame (see create).

§on_select: Callback<String>

Select this panel in the layout (brings its frame forward within a stack and activates it). Wired by MainPanel to RegularLayout::select.

§on_close: Callback<String>

Remove this panel from the layout. Wired by MainPanel to the root ClosePanel message (which mutates the Workspace model first, then syncs the slave regular-layout — NOT RegularLayout::remove_panel directly; see the app-initiated-layout-change invariant).

§on_open_settings: Callback<String>

Open the settings sidebar targeting this panel. Wired by MainPanel to select this panel in the layout, activate it (so the sidebar binds its engines), then toggle the sidebar open.

§on_context_menu: Callback<(String, f64, f64)>

Open the panel context menu at (client_x, client_y). Wired here on the tab host because the tab’s content is a create_portal subtree, so its events don’t reach the frame’s main-tree oncontextmenu (unlike the imperatively-mounted plugin body).

§on_rename: Callback<(String, Option<String>)>

Commit a new title for this panel. Wired by MainPanel to this panel’s own Session::set_title. (panel_id, new_title); None clears it back to the id fallback.

Trait Implementations§

Source§

impl PartialEq for PanelTabProps

Source§

fn eq(&self, other: &PanelTabProps) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Properties for PanelTabProps

Source§

type Builder = PanelTabPropsBuilder

Builder that will be used to construct properties
Source§

fn builder() -> Self::Builder

Entrypoint for building properties
Source§

impl StructuralPartialEq for PanelTabProps

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<Token, Builder, How> AllPropsFor<Builder, How> for Token
where Builder: Buildable<Token>, <Builder as Buildable<Token>>::WrappedToken: HasAllProps<<Builder as Buildable<Token>>::Output, How>,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> HasAllProps<(), T> for T

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> IntoPropValue<Option<T>> for T

Source§

fn into_prop_value(self) -> Option<T>

Convert self to a value of a Properties struct.
Source§

impl<T> IntoPropValue<T> for T

Source§

fn into_prop_value(self) -> T

Convert self to a value of a Properties struct.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more