[][src]Enum druid::LifeCycle

pub enum LifeCycle {
    WidgetAdded,
    Size(Size),
    HotChanged(bool),
    FocusChanged(bool),
    Internal(InternalLifeCycle),
}

Application life cycle events.

Unlike Events, LifeCycle events are generated by Druid, and may occur at different times during a given pass of the event loop. The LifeCycle::WidgetAdded event, for instance, may occur when the app first launches (during the handling of Event::WindowConnected) or it may occur during update cycle, if some widget has been added there.

Similarly the LifeCycle::Size method occurs during layout, and LifeCycle::HotChanged can occur both during event (if the mouse moves over a widget) or during layout, if a widget is resized and that moves it under the mouse.

Variants

WidgetAdded

Sent to a Widget when it is added to the widget tree. This should be the first message that each widget receives.

Widgets should handle this event in order to do any initial setup.

In addition to setup, this event is also used by the framework to track certain types of important widget state.

Registering children

Container widgets (widgets which use WidgetPod to manage children) must ensure that this event is forwarded to those children. The WidgetPod itself will handle registering those children with the system; this is required for things like correct routing of events.

Participating in focus

Widgets which wish to participate in automatic focus (using tab to change focus) must handle this event and call LifeCycleCtx::register_for_focus.

Size(Size)

Called when the Size of the widget changes.

This will be called after Widget::layout, if the Size returned by the widget differs from its previous size.

HotChanged(bool)

Called when the "hot" status changes.

This will always be called before the event that triggered it; that is, when the mouse moves over a widget, that widget will receive LifeCycle::HotChanged before it receives Event::MouseMove.

See is_hot for discussion about the hot status.

FocusChanged(bool)

Called when the focus status changes.

This will always be called immediately after a new widget gains focus. The newly focused widget will receive this with true and the widget that lost focus will receive this with false.

See EventCtx::is_focused for more information about focus.

Internal druid lifecycle event.

This should always be passed down to descendant WidgetPods.

Implementations

impl LifeCycle[src]

pub fn should_propagate_to_hidden(&self) -> bool[src]

Whether this event should be sent to widgets which are currently not visible (for example the hidden tabs in a tabs widget).

Trait Implementations

impl Clone for LifeCycle[src]

impl Debug for LifeCycle[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> RoundFrom<T> for T

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.