Skip to main content

FloatingGroup

Struct FloatingGroup 

Source
pub struct FloatingGroup {
    pub members: Vec<Member>,
    pub arrangement: Arrangement,
    pub active: usize,
    pub pos: [f32; 2],
    pub pinned: bool,
    pub anchor: Anchor,
    pub size: Option<[f32; 2]>,
}
Expand description

Panels floating over the interface as one unit: a palette alone (a group of one), or palettes stacked in a column or held as tabs. A stack’s member may itself be a tab group (Member::tabs): one level of nesting, a tab group never holding a stack. The group moves, pins, anchors and is resized as one; each member rolls up on its own.

Saved as the floating panel it was before groups (its first member’s panel and rolled, the group’s pos, pinned and anchor), the other members under group: an application that predates groups reads the first member and floats the others again as new palettes. A nested tab group is saved as its first tab with the others under tabs (see Member).

use egui_pop_model::ids::PanelId;
use egui_pop_model::layout::{Arrangement, FloatingGroup};

let tools = PanelId::from_static("app.tools");
let g = FloatingGroup::lone(tools.clone(), [16.0, 16.0]);
assert_eq!(g.panels().collect::<Vec<_>>(), [&tools]);
assert_eq!(g.arrangement, Arrangement::Stack);

Fields§

§members: Vec<Member>

Its members, in order (never empty): top to bottom in a stack, start to end as tabs.

§arrangement: Arrangement§active: usize

The shown member of tabs.

§pos: [f32; 2]

Its top-left corner, in points from the workbench’s top-left.

§pinned: bool

Pinned: it stays where it is and in sight (not dragged, not hidden with the others, not faded).

§anchor: Anchor

The workbench edges it sticks to: set when it is dropped on them, kept as the window is resized or the layout restored.

§size: Option<[f32; 2]>

Its size, in points, once the user resized it (its frame, bands included); None: sized by its content.

Implementations§

Source§

impl FloatingGroup

Source

pub fn lone(panel: PanelId, pos: [f32; 2]) -> FloatingGroup

A palette floating alone at pos.

Source

pub fn cascade(n: usize) -> [f32; 2]

Where the nth palette opens when it has no place yet: down and right from the workbench’s top-left, one step each.

Source

pub fn panels(&self) -> impl Iterator<Item = &PanelId>

Its panels, in order (a nested tab group’s tabs in their order).

Source

pub fn holds(&self, panel: &PanelId) -> bool

Whether a panel is one of its panels.

Source

pub fn member(&self, panel: &PanelId) -> Option<&Member>

The member holding a panel (a nested tab group for any of its tabs).

Source

pub fn member_mut(&mut self, panel: &PanelId) -> Option<&mut Member>

The member holding a panel, to change it.

Source

pub fn rolled(&self, panel: &PanelId) -> bool

Whether the member holding a panel is rolled up (false for a panel not in it).

Source

pub fn lead(&self) -> &PanelId

Its first member’s first panel: the one that names it in steps.

Source

pub fn shown(&self) -> &PanelId

The member shown: the active tab, or the first of a stack (its shown tab, for a nested tab group).

Source

pub fn show(&mut self, panel: &PanelId) -> bool

Shows a panel: the tab it is in a group of tabs, or its tab in a nested tab group; whether it is one of its panels.

Source

pub fn is_lone(&self) -> bool

A palette alone, not grouped with others.

Trait Implementations§

Source§

impl Clone for FloatingGroup

Source§

fn clone(&self) -> FloatingGroup

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 FloatingGroup

Source§

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

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

impl<'de> Deserialize<'de> for FloatingGroup

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for FloatingGroup

Source§

fn eq(&self, other: &FloatingGroup) -> 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 FloatingGroup

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 FloatingGroup

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,