[][src]Struct druid::WidgetPod

pub struct WidgetPod<T: Data, W: Widget<T>> { /* fields omitted */ }

A container for one widget in the hierarchy.

Generally, container widgets don't contain other widgets directly, but rather contain a WidgetPod, which has additional state needed for layout and for the widget to participate in event flow.

This struct also contains the previous data for a widget, which is essential for the update method, both to decide when the update needs to propagate, and to provide the previous data so that a widget can process a diff between the old value and the new.

Methods

impl<T: Data, W: Widget<T>> WidgetPod<T, W>[src]

pub fn new(inner: W) -> WidgetPod<T, W>[src]

Create a new widget pod.

In a widget hierarchy, each widget is wrapped in a WidgetPod so it can participate in layout and event flow. The process of adding a child widget to a container should call this method.

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

Query the "active" state of the widget.

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

Returns true if any descendant is active.

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

Query the "hot" state of the widget.

pub fn widget(&self) -> &W[src]

Return a reference to the inner widget.

pub fn widget_mut(&mut self) -> &mut W[src]

Return a mutable reference to the inner widget.

pub fn set_layout_rect(&mut self, layout_rect: Rect)[src]

Set layout rectangle.

Intended to be called on child widget in container's layout implementation.

pub fn get_layout_rect(&self) -> Rect[src]

Get the layout rectangle.

This will be same value as set by set_layout_rect.

pub fn paint(&mut self, paint_ctx: &mut PaintCtx, data: &T, env: &Env)[src]

Paint a child widget.

Generally called by container widgets as part of their paint method.

Note that this method does not apply the offset of the layout rect. If that is desired, use paint_with_offset instead.

pub fn paint_with_offset(
    &mut self,
    paint_ctx: &mut PaintCtx,
    data: &T,
    env: &Env
)
[src]

Paint the widget, translating it by the origin of its layout rectangle.

This will recursively paint widgets, stopping if a widget's layout rect is outside of the currently visible region.

pub fn paint_with_offset_always(
    &mut self,
    paint_ctx: &mut PaintCtx,
    data: &T,
    env: &Env
)
[src]

Paint the widget, even if its layout rect is outside of the currently visible region.

pub fn layout(
    &mut self,
    layout_ctx: &mut LayoutCtx,
    bc: &BoxConstraints,
    data: &T,
    env: &Env
) -> Size
[src]

Compute layout of a widget.

Generally called by container widgets as part of their layout method.

pub fn event(
    &mut self,
    ctx: &mut EventCtx,
    event: &Event,
    data: &mut T,
    env: &Env
)
[src]

Propagate an event.

Generally the event method of a container widget will call this method on all its children. Here is where a great deal of the event flow logic resides, particularly whether to continue propagating the event.

pub fn update(&mut self, ctx: &mut UpdateCtx, data: &T, env: &Env)[src]

Propagate a data update.

Generally called by container widgets as part of their update method.

impl<T: Data, W: Widget<T> + 'static> WidgetPod<T, W>[src]

pub fn boxed(self) -> BoxedWidget<T>[src]

Box the contained widget.

Convert a WidgetPod containing a widget of a specific concrete type into a dynamically boxed widget.

Auto Trait Implementations

impl<T, W> !RefUnwindSafe for WidgetPod<T, W>

impl<T, W> Send for WidgetPod<T, W> where
    T: Send,
    W: Send

impl<T, W> Sync for WidgetPod<T, W> where
    T: Sync,
    W: Sync

impl<T, W> Unpin for WidgetPod<T, W> where
    T: Unpin,
    W: Unpin

impl<T, W> !UnwindSafe for WidgetPod<T, W>

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, 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.