pub struct WindowOpened(/* private fields */);Expand description
Hookable: Triggers when a new window is opened
§Arguments
- The
Windowthat was created
One of the main reasons to use this hook is to push new
Widgets to a Window. That is, you can push outer
Widgets or inner Widgets, just like with
Handles.
Here’s how that works: Windows are divided into two main
regions, the inner “Buffer region”, and the outer “master
region”. This means that, on every Window, you’ll have a
collection of Buffers in the middle, with their satellite
Widgets, and various Widgets on the outer rims of the
Window, not necessarily associated with any single Buffer.
As an example, this is how the default layout of Duat is layed out:
╭┄┄┬┄┄┄┄┄┄┄┄┬┄┄┬┄┄┄┄┄┄┄┄┬───────╮
┊ │ │ │ ┊ │
┊LN│ │LN│ ┊ │
┊ │ Buffer │ │ Buffer ┊ │
┊VR│ │VR│ ┊LogBook│
┊ │ │ │ ┊ │
├┄┄┴┄┄┄┄┄┄┄┄┴┄┄┴┄┄┄┄┄┄┄┄┤ │
│ FooterWidgets │ │
╰───────────────────────┴───────╯In this configuration, you can see the delineation between the
“Buffer region” (surrounded by dotted lines) and the “master
region”, where:
-
For each
Buffer, we are adding aLineNumbers(LN) and aVertRule(VR)Widgets. Each of these is related to a specificBuffer, and if thatBuffermoves around, they will follow. -
On the outer edges, we have a
FooterWidgets, which includes aStatusLine,PromptLineandNotifications, as well as aLogBookon the side, which is hidden by default. TheseWidgets are not related to anyBuffer, and will not move around or be removed, unless directly.
So the distinction here is that, if you call
Window::push_inner, you will be pushing Widgets around
the “Buffer region”, but not within it. If you want to push to
specific Buffers, you should look at
Handle::push_inner_widget and Handle::push_outer_widget.
On the other hand, by calling Window::push_outer, you will be
pushing Widgets around the “master region”, so they will go on
the edges of the screen.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WindowOpened
impl !RefUnwindSafe for WindowOpened
impl Send for WindowOpened
impl Sync for WindowOpened
impl Unpin for WindowOpened
impl !UnwindSafe for WindowOpened
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> 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.