pub struct RootWidget<RootElem: Element<NoEvent, ()> + Clone + 'static> {
pub root_element: RootElem,
pub root_state: RootElem::AggregateChildrenState,
pub vdom: Option<RootElem::BuildOutput>,
pub default_widget: WidgetPod<DruidAppData, Flex<DruidAppData>>,
pub widget: Option<WidgetPod<DruidAppData, FlexWidget<<<RootElem as Element<NoEvent, ()>>::BuildOutput as VirtualDom<NoEvent, ()>>::TargetWidgetSeq>>>,
}Expand description
Implements druid::Widget from a component
You should probably use RootHandler directly instead.
Fields§
§root_element: RootElem§root_state: RootElem::AggregateChildrenState§vdom: Option<RootElem::BuildOutput>§default_widget: WidgetPod<DruidAppData, Flex<DruidAppData>>§widget: Option<WidgetPod<DruidAppData, FlexWidget<<<RootElem as Element<NoEvent, ()>>::BuildOutput as VirtualDom<NoEvent, ()>>::TargetWidgetSeq>>>Implementations§
Source§impl<Comp: Component<Props = ()>> RootWidget<ComponentHolder<Comp, NoEvent, ()>>
impl<Comp: Component<Props = ()>> RootWidget<ComponentHolder<Comp, NoEvent, ()>>
pub fn new(_root_component: Comp) -> Self
Sourcepub fn with_initial_state(self, comp_local_state: Comp::LocalState) -> Self
pub fn with_initial_state(self, comp_local_state: Comp::LocalState) -> Self
Set the local state of the root component to a value other than default
Trait Implementations§
Source§impl<RootElem: Element<NoEvent, ()> + Clone + 'static> Widget<DruidAppData> for RootWidget<RootElem>
impl<RootElem: Element<NoEvent, ()> + Clone + 'static> Widget<DruidAppData> for RootWidget<RootElem>
Source§fn event(
&mut self,
ctx: &mut EventCtx<'_, '_>,
event: &Event,
data: &mut DruidAppData,
env: &Env,
)
fn event( &mut self, ctx: &mut EventCtx<'_, '_>, event: &Event, data: &mut DruidAppData, env: &Env, )
Handle an event. Read more
Source§fn lifecycle(
&mut self,
ctx: &mut LifeCycleCtx<'_, '_>,
event: &LifeCycle,
data: &DruidAppData,
env: &Env,
)
fn lifecycle( &mut self, ctx: &mut LifeCycleCtx<'_, '_>, event: &LifeCycle, data: &DruidAppData, env: &Env, )
Handle a life cycle notification. Read more
Source§fn update(
&mut self,
ctx: &mut UpdateCtx<'_, '_>,
_old_data: &DruidAppData,
data: &DruidAppData,
env: &Env,
)
fn update( &mut self, ctx: &mut UpdateCtx<'_, '_>, _old_data: &DruidAppData, data: &DruidAppData, env: &Env, )
Source§fn layout(
&mut self,
ctx: &mut LayoutCtx<'_, '_>,
bc: &BoxConstraints,
data: &DruidAppData,
env: &Env,
) -> Size
fn layout( &mut self, ctx: &mut LayoutCtx<'_, '_>, bc: &BoxConstraints, data: &DruidAppData, env: &Env, ) -> Size
Compute layout. Read more
Auto Trait Implementations§
impl<RootElem> Freeze for RootWidget<RootElem>where
RootElem: Freeze,
<RootElem as Element>::AggregateChildrenState: Freeze,
<RootElem as Element>::BuildOutput: Freeze,
<<RootElem as Element>::BuildOutput as VirtualDom<NoEvent, ()>>::TargetWidgetSeq: Freeze,
impl<RootElem> !RefUnwindSafe for RootWidget<RootElem>
impl<RootElem> !Send for RootWidget<RootElem>
impl<RootElem> !Sync for RootWidget<RootElem>
impl<RootElem> Unpin for RootWidget<RootElem>where
RootElem: Unpin,
<RootElem as Element>::AggregateChildrenState: Unpin,
<RootElem as Element>::BuildOutput: Unpin,
<<RootElem as Element>::BuildOutput as VirtualDom<NoEvent, ()>>::TargetWidgetSeq: Unpin,
impl<RootElem> !UnwindSafe for RootWidget<RootElem>
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<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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, W> WidgetExt<T> for W
impl<T, W> WidgetExt<T> for W
Source§fn align_left(self) -> Align<T>
fn align_left(self) -> Align<T>
Wrap this widget in an
Align widget, configured to align left.Source§fn align_right(self) -> Align<T>
fn align_right(self) -> Align<T>
Wrap this widget in an
Align widget, configured to align right.Source§fn align_vertical(self, align: UnitPoint) -> Align<T>
fn align_vertical(self, align: UnitPoint) -> Align<T>
Wrap this widget in an
Align widget, configured to align vertically.Source§fn align_horizontal(self, align: UnitPoint) -> Align<T>
fn align_horizontal(self, align: UnitPoint) -> Align<T>
Wrap this widget in an
Align widget, configured to align horizontally.Source§fn fix_width(self, width: f64) -> SizedBox<T>
fn fix_width(self, width: f64) -> SizedBox<T>
Wrap this widget in a
SizedBox with an explicit width.Source§fn fix_height(self, height: f64) -> SizedBox<T>
fn fix_height(self, height: f64) -> SizedBox<T>
Wrap this widget in a
SizedBox with an explicit width.Source§fn fix_size(self, width: f64, height: f64) -> SizedBox<T>
fn fix_size(self, width: f64, height: f64) -> SizedBox<T>
Wrap this widget in an
SizedBox with an explicit width and heightSource§fn expand_width(self) -> SizedBox<T>
fn expand_width(self) -> SizedBox<T>
Source§fn expand_height(self) -> SizedBox<T>
fn expand_height(self) -> SizedBox<T>
Source§fn background(self, brush: impl Into<BackgroundBrush<T>>) -> Container<T>
fn background(self, brush: impl Into<BackgroundBrush<T>>) -> Container<T>
Source§fn border(
self,
color: impl Into<KeyOrValue<Color>>,
width: impl Into<KeyOrValue<f64>>,
) -> Container<T>
fn border( self, color: impl Into<KeyOrValue<Color>>, width: impl Into<KeyOrValue<f64>>, ) -> Container<T>
Source§fn controller<C>(self, controller: C) -> ControllerHost<Self, C>where
C: Controller<T, Self>,
fn controller<C>(self, controller: C) -> ControllerHost<Self, C>where
C: Controller<T, Self>,
Wrap this widget with the provided
Controller.Source§fn on_click(
self,
f: impl Fn(&mut EventCtx<'_, '_>, &mut T, &Env) + 'static,
) -> ControllerHost<Self, Click<T>>
fn on_click( self, f: impl Fn(&mut EventCtx<'_, '_>, &mut T, &Env) + 'static, ) -> ControllerHost<Self, Click<T>>
Source§fn debug_paint_layout(self) -> EnvScope<T, Self>
fn debug_paint_layout(self) -> EnvScope<T, Self>
Draw the
layout Rects of this widget and its children.Source§fn debug_widget_id(self) -> EnvScope<T, Self>
fn debug_widget_id(self) -> EnvScope<T, Self>
Display the
WidgetIds for this widget and its children, when hot. Read moreSource§fn debug_invalidation(self) -> DebugInvalidation<T, Self>
fn debug_invalidation(self) -> DebugInvalidation<T, Self>
Draw a color-changing rectangle over this widget, allowing you to see the
invalidation regions.
Source§fn debug_widget(self) -> EnvScope<T, Self>
fn debug_widget(self) -> EnvScope<T, Self>
Set the
DEBUG_WIDGET env variable for this widget (and its descendants). Read moreSource§fn parse(self) -> Parse<Self>
fn parse(self) -> Parse<Self>
👎Deprecated since 0.7.0: Use TextBox::with_formatter instead
Parse a
Widget<String>’s contents