Skip to main content

DeskState

Struct DeskState 

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

the windows of an area: kept by the app and passed to desk_begin / desk_next / desk_end / desk_taskbar. Plain data: save() / load() turn it into a few lines of text (desk 1, then win KEY X Y W H STATE from the bottom of the z-order to the top – x, y from the area’s start corner, outer size, all DIP; STATE the DW_* bits – and active KEY; unknown lines are skipped). The reserved strip is no part of it.

Implementations§

Source§

impl DeskState

Source

pub fn new() -> DeskState

no windows: every window goes cascaded to the front in its first frame

Source

pub fn reset(&mut self)

forget every window: each goes to its first place in the next frame

Source

pub fn set_reserve(&mut self, insets: [i32; 4])

the strip the area keeps free for a taskbar inside it (DIP: start, top, end, bottom): maximised and snapped windows leave it out, the title bars stay above it; not saved

Source

pub fn reserve(&self) -> [i32; 4]

the reserved strip (set_reserve)

Source

pub fn contains(&self, key: u32) -> bool

the state knows the window

Source

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

the windows from the bottom of the z-order to the top (minimised ones too)

Source

pub fn active(&self) -> u32

the active window (0: none)

Source

pub fn state(&self, key: u32) -> u32

DW_* bits of the window (0: a normal window, or an unknown one)

Source

pub fn rect(&self, key: u32) -> Option<[i32; 4]>

the normal place of the window: x, y from the area’s start corner, outer width and height (DIP) – what it comes back to from maximised, snapped or minimised

Source

pub fn set_rect(&mut self, key: u32, r: [i32; 4])

set the normal place of a window (DIP; see rect); a maximised or snapped one shows it once restored

Source

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

bring the window to the front and make it active (a minimised one comes back)

Source

pub fn minimize(&mut self, key: u32)

minimise the window (it keeps its place in the z-order; the topmost other one becomes active)

Source

pub fn maximize(&mut self, key: u32)

maximise the window (and activate it)

Source

pub fn restore(&mut self, key: u32)

a minimised window comes back (as it was: maximised stays maximised); else a maximised or snapped one goes back to its normal place; it becomes active

Source

pub fn toggle_max(&mut self, key: u32)

maximise the window, or restore a maximised (or snapped) one

Source

pub fn snap(&mut self, key: u32, half: u32)

snap the window to the start (DW_LEFT) or end (DW_RIGHT) half of the area, 0: back to its normal place

Source

pub fn cycle(&mut self, forward: bool) -> Option<u32>

the next window (forward: the active one goes to the back and the one below it comes to the front; back: the one at the back comes to the front) among the windows that are not minimised -> the window now active

Source

pub fn forget(&mut self, key: u32)

forget a window (a closed one: it comes back cascaded)

Source

pub fn save(&self) -> String

the state as text (see DeskState)

Source

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

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

Trait Implementations§

Source§

impl Clone for DeskState

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 DeskState

Source§

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

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

impl Default for DeskState

Source§

fn default() -> Self

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

impl Eq for DeskState

Source§

impl PartialEq for DeskState

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 DeskState

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.