Skip to main content

DockState

Struct DockState 

Source
pub struct DockState { /* private fields */ }
Expand description

the layout of a dock area: kept by the app and passed to dock_begin / dock_next / dock_end. save() / load() turn it into a few lines of text: dock 1, then side S SIZE COLLAPSED, group S TAG SIZE ACTIVE PANEL..., float SLOT X Y W H HOME HOMETAG ACTIVE PANEL..., hidden PANEL S TAG POS X Y W H HOME HOMETAG (unknown lines are skipped).

Implementations§

Source§

impl DockState

Source

pub fn new() -> DockState

the empty layout: every panel goes to its DockPanel place in the first frame

Source

pub fn reset(&mut self)

forget the layout: every panel goes to its DockPanel place in the next frame

Source

pub fn show(&mut self, id: u32)

show a hidden panel where it was, as the shown tab of its group

Source

pub fn hide(&mut self, id: u32)

hide a panel (show brings it back to the same place)

Source

pub fn toggle(&mut self, id: u32)

show a hidden panel, hide a visible one

Source

pub fn focus(&mut self, id: u32)

show the panel as the shown tab (a collapsed side expands) and give its tab strip the keyboard focus in the next pass (a floating window comes to the front)

Source

pub fn activate(&mut self, id: u32)

make the panel the shown tab of its group (a collapsed side expands)

Source

pub fn float(&mut self, id: u32, rect: Option<[i32; 4]>) -> bool

float the panel in a tool window: rect = x, y (DIP from the main window’s client origin), client width, height; None: cascaded from the top left -> false when every floating window of the area is in use

Source

pub fn dock_to(&mut self, id: u32, side: u8)

dock the panel to a side, as a new group at its end

Source

pub fn collapse(&mut self, side: u8, on: bool)

collapse a side to a rail of icon buttons, or expand it

Source

pub fn collapsed(&self, side: u8) -> bool

the side is collapsed

Source

pub fn size(&self, side: u8) -> i32

the width (left / right) or the height (bottom) of a side in DIP

Source

pub fn set_size(&mut self, side: u8, dip: i32)

set the width / height of a side (DIP)

Source

pub fn groups(&self, side: u8) -> Vec<Vec<u32>>

the tab groups of a side from start to end, each with its panels in tab order

Source

pub fn floats(&self) -> Vec<Vec<u32>>

the panels of every floating window

Source

pub fn hidden_panels(&self) -> Vec<u32>

the hidden panels

Source

pub fn side(&self, id: u32) -> Option<u8>

where the panel is: DOCK_LEFT / DOCK_RIGHT / DOCK_BOTTOM / DOCK_FLOAT (None: hidden or unknown)

Source

pub fn visible(&self, id: u32) -> bool

docked or floating (not hidden)

Source

pub fn front(&self, id: u32) -> bool

the shown tab of its group (also on a collapsed side)

Source

pub fn shown(&self, id: u32) -> bool

its content is on the screen: the front tab, on a side that is not collapsed (or floating)

Source

pub fn save(&self) -> String

the layout as text (see DockState)

Source

pub fn load(text: &str) -> Option<DockState>

a layout saved with save -> None when the text is no dock layout (version 1)

Trait Implementations§

Source§

impl Clone for DockState

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for DockState

Source§

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

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

impl Default for DockState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for DockState

Source§

impl PartialEq for DockState

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DockState

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> ErasedDestructor for T
where T: 'static,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.