pub struct Window(/* private fields */);Expand description
Implementations§
Source§impl Window
impl Window
Sourcepub fn push_inner<W: Widget>(
&self,
pa: &mut Pass,
widget: W,
specs: PushSpecs,
) -> Handle<W>
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.
Sourcepub fn push_outer<W: Widget>(
&self,
pa: &mut Pass,
widget: W,
specs: PushSpecs,
) -> Handle<W>
pub fn push_outer<W: Widget>( &self, pa: &mut Pass, widget: W, specs: PushSpecs, ) -> Handle<W>
Docs: TODO
Sourcepub fn handles<'a>(
&'a self,
pa: &'a Pass,
) -> impl Iterator<Item = &'a Handle<dyn Widget>>
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.
Sourcepub fn buffers(&self, pa: &Pass) -> Vec<Handle>
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§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.