Struct druid::tests::helpers::ModularWidget
source · pub struct ModularWidget<S, T> { /* 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, T> ModularWidget<S, T>
impl<S, T> ModularWidget<S, T>
pub fn new(state: S) -> Self
pub fn event_fn( self, f: impl FnMut(&mut S, &mut EventCtx<'_, '_>, &Event, &mut T, &Env) + 'static ) -> Self
pub fn lifecycle_fn( self, f: impl FnMut(&mut S, &mut LifeCycleCtx<'_, '_>, &LifeCycle, &T, &Env) + 'static ) -> Self
pub fn update_fn( self, f: impl FnMut(&mut S, &mut UpdateCtx<'_, '_>, &T, &T, &Env) + 'static ) -> Self
pub fn layout_fn( self, f: impl FnMut(&mut S, &mut LayoutCtx<'_, '_>, &BoxConstraints, &T, &Env) -> Size + 'static ) -> Self
pub fn paint_fn( self, f: impl FnMut(&mut S, &mut PaintCtx<'_, '_, '_>, &T, &Env) + 'static ) -> Self
Trait Implementations§
source§impl<S, T: Data> Widget<T> for ModularWidget<S, T>
impl<S, T: Data> Widget<T> for ModularWidget<S, T>
source§fn event(
&mut self,
ctx: &mut EventCtx<'_, '_>,
event: &Event,
data: &mut T,
env: &Env
)
fn event( &mut self, ctx: &mut EventCtx<'_, '_>, event: &Event, data: &mut T, env: &Env )
Handle an event. Read more
source§fn lifecycle(
&mut self,
ctx: &mut LifeCycleCtx<'_, '_>,
event: &LifeCycle,
data: &T,
env: &Env
)
fn lifecycle( &mut self, ctx: &mut LifeCycleCtx<'_, '_>, event: &LifeCycle, data: &T, env: &Env )
Handle a life cycle notification. Read more
source§fn layout(
&mut self,
ctx: &mut LayoutCtx<'_, '_>,
bc: &BoxConstraints,
data: &T,
env: &Env
) -> Size
fn layout( &mut self, ctx: &mut LayoutCtx<'_, '_>, bc: &BoxConstraints, data: &T, env: &Env ) -> Size
Compute layout. Read more
source§fn paint(&mut self, ctx: &mut PaintCtx<'_, '_, '_>, data: &T, env: &Env)
fn paint(&mut self, ctx: &mut PaintCtx<'_, '_, '_>, data: &T, env: &Env)
Paint the widget appearance. Read more
source§fn compute_max_intrinsic(
&mut self,
axis: Axis,
ctx: &mut LayoutCtx<'_, '_>,
bc: &BoxConstraints,
data: &T,
env: &Env
) -> f64
fn compute_max_intrinsic( &mut self, axis: Axis, ctx: &mut LayoutCtx<'_, '_>, bc: &BoxConstraints, data: &T, env: &Env ) -> f64
Computes max intrinsic/preferred dimension of a widget on the provided axis. Read more
Auto Trait Implementations§
impl<S, T> !RefUnwindSafe for ModularWidget<S, T>
impl<S, T> !Send for ModularWidget<S, T>
impl<S, T> !Sync for ModularWidget<S, T>
impl<S, T> Unpin for ModularWidget<S, T>where S: Unpin,
impl<S, T> !UnwindSafe for ModularWidget<S, T>
Blanket Implementations§
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> RoundFrom<T> for T
impl<T> RoundFrom<T> for T
§fn round_from(x: T) -> T
fn round_from(x: T) -> T
Performs the conversion.
§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere U: RoundFrom<T>,
§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.