[−][src]Struct druid::WidgetPod
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]
&mut self,
paint_ctx: &mut PaintCtx,
data: &T,
env: &Env
)
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]
&mut self,
paint_ctx: &mut PaintCtx,
data: &T,
env: &Env
)
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]
&mut self,
layout_ctx: &mut LayoutCtx,
bc: &BoxConstraints,
data: &T,
env: &Env
) -> Size
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]
&mut self,
ctx: &mut EventCtx,
event: &Event,
data: &mut T,
env: &Env
)
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,
T: Send,
W: Send,
impl<T, W> Sync for WidgetPod<T, W> where
T: Sync,
W: Sync,
T: Sync,
W: Sync,
impl<T, W> Unpin for WidgetPod<T, W> where
T: Unpin,
W: Unpin,
T: Unpin,
W: Unpin,
impl<T, W> !UnwindSafe for WidgetPod<T, W>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> RoundFrom<T> for T
fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
fn round_into(self) -> U
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,