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: usizeThe shown member of tabs.
pos: [f32; 2]Its top-left corner, in points from the workbench’s top-left.
pinned: boolPinned: it stays where it is and in sight (not dragged, not hidden with the others, not faded).
anchor: AnchorThe 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
impl FloatingGroup
Sourcepub fn cascade(n: usize) -> [f32; 2]
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.
Sourcepub fn panels(&self) -> impl Iterator<Item = &PanelId>
pub fn panels(&self) -> impl Iterator<Item = &PanelId>
Its panels, in order (a nested tab group’s tabs in their order).
Sourcepub fn member(&self, panel: &PanelId) -> Option<&Member>
pub fn member(&self, panel: &PanelId) -> Option<&Member>
The member holding a panel (a nested tab group for any of its tabs).
Sourcepub fn member_mut(&mut self, panel: &PanelId) -> Option<&mut Member>
pub fn member_mut(&mut self, panel: &PanelId) -> Option<&mut Member>
The member holding a panel, to change it.
Sourcepub fn rolled(&self, panel: &PanelId) -> bool
pub fn rolled(&self, panel: &PanelId) -> bool
Whether the member holding a panel is rolled up (false for a
panel not in it).
Sourcepub fn shown(&self) -> &PanelId
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).
Trait Implementations§
Source§impl Clone for FloatingGroup
impl Clone for FloatingGroup
Source§fn clone(&self) -> FloatingGroup
fn clone(&self) -> FloatingGroup
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more