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 to the “buffer area” of a Window

If this Widget is being pushed to a Buffer’s group, then this Widget will be included in that Buffer’s group. This means that, if that Buffer is moved around or deleted, this Widget (and all others in its group) will follow suit.

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 A to the left, then you push widget B to the bottom, you will get this layout:

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

Here’s an example of such a layout:

setup_duat!(setup);
use duat::prelude::*;

fn setup() {
    hook::remove("BufferWidgets");
    hook::add::<Buffer>(|pa, handle| {
        LineNumbers::builder().push_on(pa, handle);
        status!("{name_txt} {selections_txt} {main_txt}").push_on(pa, handle);
        Ok(())
    });
}

In this case, each buffer will have LineNumbers with relative/absolute numbering, and a StatusLine showing the buffer’s name, how many selections are in it, and its main selection.

Source

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

Docs: TODO

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 + Send + Sync>

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.