Struct masonry::testing::ModularWidget
source · pub struct ModularWidget<S> { /* private fields */ }
Expand description
A widget that can be constructed from individual functions, builder-style.
This widget is generic over its state, which is passed in at construction time.
Implementations§
source§impl<S> ModularWidget<S>
impl<S> ModularWidget<S>
pub fn new(state: S) -> Self
pub fn pointer_event_fn( self, f: impl FnMut(&mut S, &mut EventCtx<'_>, &PointerEvent) + 'static ) -> Self
pub fn text_event_fn( self, f: impl FnMut(&mut S, &mut EventCtx<'_>, &TextEvent) + 'static ) -> Self
pub fn access_event_fn( self, f: impl FnMut(&mut S, &mut EventCtx<'_>, &AccessEvent) + 'static ) -> Self
pub fn status_change_fn( self, f: impl FnMut(&mut S, &mut LifeCycleCtx<'_>, &StatusChange) + 'static ) -> Self
pub fn lifecycle_fn( self, f: impl FnMut(&mut S, &mut LifeCycleCtx<'_>, &LifeCycle) + 'static ) -> Self
pub fn layout_fn( self, f: impl FnMut(&mut S, &mut LayoutCtx<'_>, &BoxConstraints) -> Size + 'static ) -> Self
pub fn paint_fn( self, f: impl FnMut(&mut S, &mut PaintCtx<'_>, &mut Scene) + 'static ) -> Self
pub fn role_fn(self, f: impl Fn(&S) -> Role + 'static) -> Self
pub fn access_fn( self, f: impl FnMut(&mut S, &mut AccessCtx<'_>) + 'static ) -> Self
pub fn children_fn( self, children: impl Fn(&S) -> SmallVec<[WidgetRef<'_, dyn Widget>; 16]> + 'static ) -> Self
Trait Implementations§
source§impl<S: 'static> Widget for ModularWidget<S>
impl<S: 'static> Widget for ModularWidget<S>
source§fn on_pointer_event(&mut self, ctx: &mut EventCtx<'_>, event: &PointerEvent)
fn on_pointer_event(&mut self, ctx: &mut EventCtx<'_>, event: &PointerEvent)
Handle an event - usually user interaction. Read more
fn on_text_event(&mut self, ctx: &mut EventCtx<'_>, event: &TextEvent)
source§fn on_access_event(&mut self, ctx: &mut EventCtx<'_>, event: &AccessEvent)
fn on_access_event(&mut self, ctx: &mut EventCtx<'_>, event: &AccessEvent)
Handle an event from the platform’s accessibility API.
fn on_status_change(&mut self, ctx: &mut LifeCycleCtx<'_>, event: &StatusChange)
source§fn lifecycle(&mut self, ctx: &mut LifeCycleCtx<'_>, event: &LifeCycle)
fn lifecycle(&mut self, ctx: &mut LifeCycleCtx<'_>, event: &LifeCycle)
Handle a lifecycle notification. Read more
source§fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size
fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size
Compute layout. Read more
fn accessibility_role(&self) -> Role
fn accessibility(&mut self, ctx: &mut AccessCtx<'_>)
source§fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut Scene)
fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut Scene)
Paint the widget appearance. Read more
source§fn children(&self) -> SmallVec<[WidgetRef<'_, dyn Widget>; 16]>
fn children(&self) -> SmallVec<[WidgetRef<'_, dyn Widget>; 16]>
Return references to this widget’s children. Read more
source§fn make_trace_span(&self) -> Span
fn make_trace_span(&self) -> Span
Return a span for tracing. Read more
Auto Trait Implementations§
impl<S> Freeze for ModularWidget<S>where
S: Freeze,
impl<S> !RefUnwindSafe for ModularWidget<S>
impl<S> !Send for ModularWidget<S>
impl<S> !Sync for ModularWidget<S>
impl<S> Unpin for ModularWidget<S>where
S: Unpin,
impl<S> !UnwindSafe for ModularWidget<S>
Blanket Implementations§
source§impl<T> AsAny for Twhere
T: Any,
impl<T> AsAny for Twhere
T: Any,
source§fn as_dyn_any(&self) -> &(dyn Any + 'static)
fn as_dyn_any(&self) -> &(dyn Any + 'static)
Return self.
source§fn as_mut_dyn_any(&mut self) -> &mut (dyn Any + 'static)
fn as_mut_dyn_any(&mut self) -> &mut (dyn Any + 'static)
Return self.
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