Struct WidgetCreated

Source
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, handle)| ln.rel_abs());
}

You can just write this:

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

fn setup() {
    hook::add::<LineNumbers<Ui>>(|pa, (ln, handle)| ln.rel_abs());
}

Do note that this hook doesn’t let you change the layout of the pushed Widgets, only their configuration. So if one of these changes changed the direction where the Widget was pushed, for example, the layout could get messed up.

If you want to change the layout of the Widgets in a controled fashion, look at OnFileOpen and OnWindowOpen.

Trait Implementations§

Source§

impl<W: Widget<U>, U: Ui> Hookable for WidgetCreated<W, U>

Source§

type Input<'h> = (<W as Widget<U>>::Cfg, Option<&'h FileHandle<U>>)

The arguments that are passed to each hook.
Source§

type Output = <W as Widget<U>>::Cfg

The output of triggering hooks. Mostly never used Read more
Source§

fn get_input(&mut self) -> Self::Input<'_>

How to get the arguments from the Hookable
Source§

fn take_output_back(&mut self, output: Self::Output)

When a Hookable has an Output, you can define how it takes it back Read more

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>
where <W as Widget<U>>::Cfg: Unpin, <U as Ui>::Area: Unpin,

§

impl<W, U> !UnwindSafe for WidgetCreated<W, U>

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<H, U> HookAlias<U> for H
where H: Hookable, U: Ui,

Source§

type Hookable = H

The actual Hookable that this HookAlias is supposed to map to
Source§

type Input<'h> = <H as Hookable>::Input<'h>

Just a shorthand for less boilerplate in the function definition
Source§

type Output = <H as Hookable>::Output

Just a shorthand for less boilerplate in the function definition
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, 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.