Window

Struct Window 

Source
pub struct Window(/* private fields */);
Expand description

A region containing Handles

This is like a browser tab, it can contain any number of regular and spawned Handles.

Implementations§

Source§

impl Window

Source

pub fn push_inner<W: Widget>( &self, pa: &mut Pass, widget: W, specs: PushSpecs, ) -> Handle<W>

Pushes a Widget around the “buffer area” of a Window

When you push a Widget, it is placed on an edge of the area, and a new parent area may be created to hold both widgets. If created, that new area will be used for pushing widgets in the future.

This means that, if you push widget B to the bottom, then you push widget A to the left, you will get this layout:

╭───┬───────────╮
│   │           │
│ A │  Buffers  │
│   │           │
├───┴───────────┤
│       B       │
╰───────────────╯

The Buffers region here represents a central area that all Windows contain, where all the Buffers are placed alongside their satellite Widgets. When you push Widgets to the Window, instead of to a Handle, those widgets are placed in the outer region, not being associated with any particular Buffer.

In this case, each Window will have a LogBook on the left side as well as FooterWidgets on the bottom.

Source

pub fn push_outer<W: Widget>( &self, pa: &mut Pass, widget: W, specs: PushSpecs, ) -> Handle<W>

Pushes a Widget to the edges of a Window

When you push a Widget, it is placed on an edge of the area, and a new parent area may be created to hold both widgets. If created, that new area will be used for pushing widgets in the future.

This means that, if you push widget B to the bottom, then you push widget A to the left, you will get this layout:

╭───┬───────────╮
│   │           │
│   │  Buffers  │
│ A │           │
│   ├───────────┤
│   │     B     │
╰───┴───────────╯

The Buffers region here represents a central area that all Windows contain, where all the Buffers are placed alongside their satellite Widgets. When you push Widgets to the Window, instead of to a Handle, those widgets are placed in the outer region, not being associated with any particular Buffer.

In this case, each Window will have a LogBook on the left side as well as FooterWidgets on the bottom.

Source

pub fn spawn<W: Widget>( &self, pa: &mut Pass, widget: W, specs: StaticSpawnSpecs, ) -> Handle<W>

Spawns a new static Widget on this Window

This Widget, unlike all other kinds, does not follow changes in the layout by the resizing or closure of other Widgets. It instead stays in a single Coord, its width and height being predefined.

There is one circumstance in which this Widget will move, however: when the window resizes. In this circumstance, the Widget will be relocated as to be placed in relatively the same place on screen, in relation to the bottom right corner of the screen.

Source

pub fn handles<'a>( &'a self, pa: &'a Pass, ) -> impl Iterator<Item = &'a Handle<dyn Widget>>

An Iterator over all Handles in a Window

Each Handle takes care of one Widget, if you want to see which one exactly is being used, you can use the Handle::try_downcast and Handle::read_as methods.

If you just want an iterator over the Buffers, then check out Window::buffers.

Source

pub fn buffers(&self, pa: &Pass) -> Vec<Handle>

The Buffers in a single Window

They will be ordered by where the "next-buffer" command focus on. This usually follows the order by which they were created, but it can be altered if you use the "swap" command.

If you want an Iterator over all Handles, see Window::handles.

Trait Implementations§

Source§

impl Clone for Window

Source§

fn clone(&self) -> Window

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 PushTarget for Window

Source§

fn try_downcast<W: Widget>(&self) -> Option<Handle<W>>

Tries to downcast to a Handle of some W
Source§

fn push_inner<PW: Widget>( &self, pa: &mut Pass, widget: PW, specs: PushSpecs, ) -> Handle<PW>

Pushes a Widget around self Read more
Source§

fn push_outer<PW: Widget>( &self, pa: &mut Pass, widget: PW, specs: PushSpecs, ) -> Handle<PW>

Pushes a Widget around the “master region” of self Read more

Auto Trait Implementations§

§

impl Freeze for Window

§

impl !RefUnwindSafe for Window

§

impl Send for Window

§

impl Sync for Window

§

impl Unpin for Window

§

impl !UnwindSafe for Window

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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.