Struct floem::views::DynamicContainer
source · pub struct DynamicContainer<T: 'static> { /* private fields */ }
Expand description
A container for a dynamically updating View. See dyn_container
Trait Implementations§
source§impl<T: 'static> View for DynamicContainer<T>
impl<T: 'static> View for DynamicContainer<T>
fn view_data(&self) -> &ViewData
fn view_data_mut(&mut self) -> &mut ViewData
source§fn for_each_child<'a>(&'a self, for_each: &mut dyn FnMut(&'a dyn View) -> bool)
fn for_each_child<'a>(&'a self, for_each: &mut dyn FnMut(&'a dyn View) -> bool)
This method walks over children and must be implemented if the view has any children.
It should return children back to front and should stop if
_for_each
returns true
.source§fn for_each_child_mut<'a>(
&'a mut self,
for_each: &mut dyn FnMut(&'a mut dyn View) -> bool
)
fn for_each_child_mut<'a>( &'a mut self, for_each: &mut dyn FnMut(&'a mut dyn View) -> bool )
This method walks over children and must be implemented if the view has any children.
It should return children back to front and should stop if
_for_each
returns true
.source§fn for_each_child_rev_mut<'a>(
&'a mut self,
for_each: &mut dyn FnMut(&'a mut dyn View) -> bool
)
fn for_each_child_rev_mut<'a>( &'a mut self, for_each: &mut dyn FnMut(&'a mut dyn View) -> bool )
This method walks over children and must be implemented if the view has any children.
It should return children front to back and should stop if
_for_each
returns true
.fn debug_name(&self) -> Cow<'static, str>
source§fn update(&mut self, cx: &mut UpdateCx<'_>, state: Box<dyn Any>)
fn update(&mut self, cx: &mut UpdateCx<'_>, state: Box<dyn Any>)
Use this method to react to changes in view-related state.
You will usually send state to this hook manually using the
View
’s Id
handle Read morefn id(&self) -> Id
fn view_style(&self) -> Option<Style>
fn view_class(&self) -> Option<StyleClassRef>
fn child(&self, id: Id) -> Option<&dyn View>
fn child_mut(&mut self, id: Id) -> Option<&mut dyn View>
source§fn style(&mut self, cx: &mut StyleCx<'_>)
fn style(&mut self, cx: &mut StyleCx<'_>)
Use this method to style the view’s children. Read more
source§fn layout(&mut self, cx: &mut LayoutCx<'_>) -> Node
fn layout(&mut self, cx: &mut LayoutCx<'_>) -> Node
Use this method to layout the view’s children.
Usually you’ll do this by calling
LayoutCx::layout_node
. Read moresource§fn compute_layout(&mut self, cx: &mut ComputeLayoutCx<'_>) -> Option<Rect>
fn compute_layout(&mut self, cx: &mut ComputeLayoutCx<'_>) -> Option<Rect>
Responsible for computing the layout of the view’s children. Read more
source§fn event(
&mut self,
cx: &mut EventCx<'_>,
id_path: Option<&[Id]>,
event: Event
) -> EventPropagation
fn event( &mut self, cx: &mut EventCx<'_>, id_path: Option<&[Id]>, event: Event ) -> EventPropagation
Implement this to handle events and to pass them down to children Read more
source§fn paint(&mut self, cx: &mut PaintCx<'_>)
fn paint(&mut self, cx: &mut PaintCx<'_>)
View
-specific implementation. Will be called in PaintCx::paint_view
.
Usually you’ll call paint_view
for every child view. But you might also draw text, adjust the offset, clip
or draw text.Auto Trait Implementations§
impl<T> !RefUnwindSafe for DynamicContainer<T>
impl<T> !Send for DynamicContainer<T>
impl<T> !Sync for DynamicContainer<T>
impl<T> Unpin for DynamicContainer<T>
impl<T> !UnwindSafe for DynamicContainer<T>
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
source§impl<V> Decorators for Vwhere
V: View,
impl<V> Decorators for Vwhere
V: View,
source§fn style(self, style: impl Fn(Style) -> Style + 'static) -> Self
fn style(self, style: impl Fn(Style) -> Style + 'static) -> Self
Alter the style of the view. Read more
source§fn dragging_style(self, style: impl Fn(Style) -> Style + 'static) -> Self
fn dragging_style(self, style: impl Fn(Style) -> Style + 'static) -> Self
The visual style to apply when the mouse hovers over the element
fn class<C: StyleClass>(self, _class: C) -> Self
Allows the element to be navigated to with the keyboard. Similar to setting tabindex=“0” in html.
fn draggable(self) -> Self
fn disabled(self, disabled_fn: impl Fn() -> bool + 'static) -> Self
source§fn on_event(
self,
listener: EventListener,
action: impl Fn(&Event) -> EventPropagation + 'static
) -> Self
fn on_event( self, listener: EventListener, action: impl Fn(&Event) -> EventPropagation + 'static ) -> Self
Add an event handler for the given EventListener.
source§fn on_key_down(
self,
key: Key,
modifiers: ModifiersState,
action: impl Fn(&Event) + 'static
) -> Self
fn on_key_down( self, key: Key, modifiers: ModifiersState, action: impl Fn(&Event) + 'static ) -> Self
Add an handler for pressing down a specific key.
source§fn on_key_up(
self,
key: Key,
modifiers: ModifiersState,
action: impl Fn(&Event) + 'static
) -> Self
fn on_key_up( self, key: Key, modifiers: ModifiersState, action: impl Fn(&Event) + 'static ) -> Self
Add an handler for a specific key being released.
source§fn on_event_cont(
self,
listener: EventListener,
action: impl Fn(&Event) + 'static
) -> Self
fn on_event_cont( self, listener: EventListener, action: impl Fn(&Event) + 'static ) -> Self
Add an event handler for the given EventListener. This event will be handled with
the given handler and the event will continue propagating.
source§fn on_event_stop(
self,
listener: EventListener,
action: impl Fn(&Event) + 'static
) -> Self
fn on_event_stop( self, listener: EventListener, action: impl Fn(&Event) + 'static ) -> Self
Add an event handler for the given EventListener. This event will be handled with
the given handler and the event will stop propagating.
source§fn on_click(self, action: impl Fn(&Event) -> EventPropagation + 'static) -> Self
fn on_click(self, action: impl Fn(&Event) -> EventPropagation + 'static) -> Self
Add an event handler for EventListener::Click.
source§fn on_click_cont(self, action: impl Fn(&Event) + 'static) -> Self
fn on_click_cont(self, action: impl Fn(&Event) + 'static) -> Self
Add an event handler for EventListener::Click. This event will be handled with
the given handler and the event will continue propagating.
source§fn on_click_stop(self, action: impl Fn(&Event) + 'static) -> Self
fn on_click_stop(self, action: impl Fn(&Event) + 'static) -> Self
Add an event handler for EventListener::Click. This event will be handled with
the given handler and the event will stop propagating.
source§fn on_double_click(
self,
action: impl Fn(&Event) -> EventPropagation + 'static
) -> Self
fn on_double_click( self, action: impl Fn(&Event) -> EventPropagation + 'static ) -> Self
Add an event handler for EventListener::DoubleClick
source§fn on_double_click_cont(self, action: impl Fn(&Event) + 'static) -> Self
fn on_double_click_cont(self, action: impl Fn(&Event) + 'static) -> Self
Add an event handler for EventListener::DoubleClick. This event will be handled with
the given handler and the event will continue propagating.
source§fn on_double_click_stop(self, action: impl Fn(&Event) + 'static) -> Self
fn on_double_click_stop(self, action: impl Fn(&Event) + 'static) -> Self
Add an event handler for EventListener::DoubleClick. This event will be handled with
the given handler and the event will stop propagating.
source§fn on_secondary_click(
self,
action: impl Fn(&Event) -> EventPropagation + 'static
) -> Self
fn on_secondary_click( self, action: impl Fn(&Event) -> EventPropagation + 'static ) -> Self
Add an event handler for EventListener::SecondaryClick. This is most often the “Right” click.
source§fn on_secondary_click_cont(self, action: impl Fn(&Event) + 'static) -> Self
fn on_secondary_click_cont(self, action: impl Fn(&Event) + 'static) -> Self
Add an event handler for EventListener::SecondaryClick. This is most often the “Right” click.
This event will be handled with the given handler and the event will continue propagating.
source§fn on_secondary_click_stop(self, action: impl Fn(&Event) + 'static) -> Self
fn on_secondary_click_stop(self, action: impl Fn(&Event) + 'static) -> Self
Add an event handler for EventListener::SecondaryClick. This is most often the “Right” click.
This event will be handled with the given handler and the event will stop propagating.
fn on_resize(self, action: impl Fn(Rect) + 'static) -> Self
fn on_move(self, action: impl Fn(Point) + 'static) -> Self
fn on_cleanup(self, action: impl Fn() + 'static) -> Self
fn animation(self, anim: Animation) -> Self
fn clear_focus(self, when: impl Fn() + 'static) -> Self
fn request_focus(self, when: impl Fn() + 'static) -> Self
fn window_scale(self, scale_fn: impl Fn() -> f64 + 'static) -> Self
fn window_title(self, title_fn: impl Fn() -> String + 'static) -> Self
Adds a secondary-click context menu to the view, which opens at the mouse position.
Adds a primary-click context menu, which opens below the view.
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.