pub struct WidgetCreated<W: Widget<U>, U: Ui>(/* private fields */);Expand description
Hookable: Triggers when a Widget’s cfg is created
§Arguments
§Aliases
Since every Widget implements the HookAlias trait, instead
of writing this in the config crate:
setup_duat!(setup);
use duat::prelude::*;
fn setup() {
hook::add::<WidgetCreated<LineNumbers<Ui>>>(|pa, (ln, _)| ln.rel_abs());
}You can just write this:
setup_duat!(setup);
use duat::prelude::*;
fn setup() {
hook::add::<LineNumbers<Ui>>(|_, (ln, _)| ln.rel_abs());
}§Changing the layout
Assuming you are using duat-term, you could make it so every
LineNumbers comes with a VertRule on the right, like this:
setup_duat!(setup);
use duat::prelude::*;
fn setup() {
hook::add::<LineNumbers<Ui>>(|_, (ln, builder)| {
builder.push(VertRule::cfg().on_the_right());
ln
});
}Now, every time a LineNumberss Widget is inserted in Duat,
a VertRule will be pushed on the right of it. You could even
further add a hook on VertRule, that would push further
Widgets if you wanted to.
Trait Implementations§
Auto Trait Implementations§
impl<W, U> !Freeze for WidgetCreated<W, U>
impl<W, U> !RefUnwindSafe for WidgetCreated<W, U>
impl<W, U> !Send for WidgetCreated<W, U>
impl<W, U> !Sync for WidgetCreated<W, U>
impl<W, U> Unpin for WidgetCreated<W, U>
impl<W, U> !UnwindSafe for WidgetCreated<W, U>
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
Mutably borrows from an owned value. Read more