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>

source§

fn view_data(&self) -> &ViewData

source§

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)

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 )

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 )

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.
source§

fn debug_name(&self) -> Cow<'static, str>

source§

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 more
source§

fn id(&self) -> Id

source§

fn view_style(&self) -> Option<Style>

source§

fn view_class(&self) -> Option<StyleClassRef>

source§

fn child(&self, id: Id) -> Option<&dyn View>

source§

fn child_mut(&mut self, id: Id) -> Option<&mut dyn View>

source§

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

Use this method to layout the view’s children. Usually you’ll do this by calling LayoutCx::layout_node. Read more
source§

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

Implement this to handle events and to pass them down to children Read more
source§

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.
source§

fn scroll_to( &mut self, cx: &mut AppState, target: Id, rect: Option<Rect> ) -> bool

Scrolls the view and all direct and indirect children to bring the target view to be visible. Returns true if this view contains or is the target.

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> 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<V> Decorators for V
where V: View,

source§

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

The visual style to apply when the mouse hovers over the element
source§

fn class<C: StyleClass>(self, _class: C) -> Self

source§

fn keyboard_navigatable(self) -> Self

Allows the element to be navigated to with the keyboard. Similar to setting tabindex=“0” in html.
source§

fn draggable(self) -> Self

source§

fn disabled(self, disabled_fn: impl Fn() -> bool + 'static) -> Self

source§

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

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

Add an handler for a specific key being released.
source§

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

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

Add an event handler for EventListener::Click.
source§

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

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

Add an event handler for EventListener::DoubleClick
source§

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

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

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

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

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.
source§

fn on_resize(self, action: impl Fn(Rect) + 'static) -> Self

source§

fn on_move(self, action: impl Fn(Point) + 'static) -> Self

source§

fn on_cleanup(self, action: impl Fn() + 'static) -> Self

source§

fn animation(self, anim: Animation) -> Self

source§

fn clear_focus(self, when: impl Fn() + 'static) -> Self

source§

fn request_focus(self, when: impl Fn() + 'static) -> Self

source§

fn window_scale(self, scale_fn: impl Fn() -> f64 + 'static) -> Self

source§

fn window_title(self, title_fn: impl Fn() -> String + 'static) -> Self

source§

fn window_menu(self, menu_fn: impl Fn() -> Menu + 'static) -> Self

source§

fn context_menu(self, menu: impl Fn() -> Menu + 'static) -> Self

Adds a secondary-click context menu to the view, which opens at the mouse position.
source§

fn popout_menu(self, menu: impl Fn() -> Menu + 'static) -> Self

Adds a primary-click context menu, which opens below the view.
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: 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>

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)

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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more