Skip to main content

PanelSpec

Struct PanelSpec 

Source
pub struct PanelSpec {
Show 16 fields pub id: PanelId, pub title: String, pub area: Area, pub areas: Vec<Area>, pub commands: Vec<CommandId>, pub min_size: f32, pub default_size: Option<f32>, pub detachable: bool, pub icon: String, pub bare: bool, pub open: bool, pub palette: bool, pub floatable: bool, pub content: Option<Mountable>, pub kind: PanelKind, pub instances: Instances,
}
Expand description

A panel as declared: its id, title, areas, sizes, and whether it opens once or as many times as asked (PanelSpec::instances).

Need (layout): a panel opened several times at once, each instance with its own state.

Fields§

§id: PanelId§title: String§area: Area

Its default area.

§areas: Vec<Area>

The areas it may be moved to besides area; empty: any area.

§commands: Vec<CommandId>

Command ids the panel contributes (its toggle and focus commands are added by the shell).

§min_size: f32

The smallest size it may be given across its area (a side bar’s width, the bottom panel’s height), in points.

§default_size: Option<f32>

The size it asks for across its area when it opens there.

§detachable: bool

Whether it may be detached into a window of its own.

§icon: String

The icon naming it in strips (an egui_pop_core::icon::Icon name); empty: its title’s first letter.

§bare: bool

Drawn without a tab bar when it is alone in its area (the shell’s zones shown as panels).

§open: bool

Placed in its area at first; false: closed until asked for.

§palette: bool

A palette: it floats over the interface when it opens (a toolbox, a navigator); it may still be docked in its areas.

§floatable: bool

Whether it may float over the interface: every panel may unless it opts out (PanelSpec::floatable); a palette always may.

§content: Option<Mountable>

What its content needs (ADR 0013): checked against each host it is put in. None: a plain widget, any host of a panel.

§kind: PanelKind

What it does to what the application edits (PanelKind): a view unless declared.

§instances: Instances

Whether it opens once or as many times as asked (Instances).

Implementations§

Source§

impl PanelSpec

Source

pub fn new(id: PanelId, title: &str, area: Area) -> Self

Source

pub fn instances(self, instances: Instances) -> Self

Whether it opens once (the default) or as many times as asked: a new instance is <id>#<n>, made by pop.panel.open with instance: "new".

Source

pub fn instance_spec(&self, id: &PanelId, title: Option<&str>) -> PanelSpec

The spec of its instance id (<id>#<n>): the same panel, under that id, titled title (else its own title and n: “Gallery 2”), open where it is placed.

Source

pub fn kind(self, kind: PanelKind) -> Self

What it does to what the application edits: a control or mixed panel’s chrome shows an “edits” mark on its tab and its palette band.

Source

pub fn content(self, needs: Mountable) -> Self

What its content needs: a host refusing it refuses the panel.

Source

pub fn min_size(self, points: f32) -> Self

The smallest size across its area, in points.

Source

pub fn default_size(self, points: f32) -> Self

The size it asks for across its area, in points.

Source

pub fn detachable(self, on: bool) -> Self

Whether it may be detached into a window of its own.

Source

pub fn icon(self, name: &str) -> Self

Its icon in strips, by name (search, settings…).

Source

pub fn closed(self) -> Self

Closed until asked for (its command, a step): a new layout and a repaired one keep it closed.

Source

pub fn palette(self) -> Self

A palette: floats over the interface when it opens, never modal; its area is where it docks.

Source

pub fn floatable(self, on: bool) -> Self

Whether it may float over the interface: on unless turned off here (a view that would leave its area empty, the centre’s document); a palette always may.

Source

pub fn bare(self) -> Self

Drawn without a tab bar when alone in its area.

Source

pub fn refuses(&self, host: &PanelHost) -> Option<String>

Why it may not be put in a host, if it may not: an area it stays out of, floating or a window it is not allowed, or a host its content does not fit (with the rule, ADR 0013).

Source

pub fn only_in(self, areas: &[Area]) -> Self

Restricts where it may go (its default area always allowed).

Source

pub fn allows(&self, area: Area) -> bool

Whether the panel may live in an area.

Trait Implementations§

Source§

impl Clone for PanelSpec

Source§

fn clone(&self) -> PanelSpec

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PanelSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for PanelSpec

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for PanelSpec

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for PanelSpec

Auto Trait Implementations§

Blanket Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.