pub struct Stack<T> { /* private fields */ }Expand description
Stack of widgets
Stack provides an easy way to stack widgets on top of each other. Children are positioned relative to the container edges.
Children are either positioned or non-positioned.
Non-positioned children are used to compute the size of the Stack widget itself. They are aligned using the Stack::align setting.
Positioned children are layed-out after non-positioned
children. Their position is relative to the container edges (see
StackChildPosition).
Implementations§
Source§impl<T: Data> Stack<T>
impl<T: Data> Stack<T>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new Stack widget.
Child alignment is set to UnitPoint::TOP_LEFT, fit and
clip flags are set to false.
Sourcepub fn set_fit(&mut self, fit: bool)
pub fn set_fit(&mut self, fit: bool)
Set the fit attribute.
Fit non-positioned children to the size of the container.
Sourcepub fn set_clip(&mut self, clip: bool)
pub fn set_clip(&mut self, clip: bool)
Set the clip attribute.
Clip paint region at container boundaries.
Sourcepub fn align(self, align: UnitPoint) -> Self
pub fn align(self, align: UnitPoint) -> Self
Builder-style method for specifying the default child alignment.
Sourcepub fn with_child(self, child: impl Widget<T> + 'static) -> Self
pub fn with_child(self, child: impl Widget<T> + 'static) -> Self
Builder-style variant of add_child.
Sourcepub fn with_positioned_child(
self,
child: impl Widget<T> + 'static,
params: impl Into<StackChildParams<T>>,
) -> Self
pub fn with_positioned_child( self, child: impl Widget<T> + 'static, params: impl Into<StackChildParams<T>>, ) -> Self
Builder-style variant of add_positioned_child.
Sourcepub fn add_positioned_child(
&mut self,
child: impl Widget<T> + 'static,
params: impl Into<StackChildParams<T>>,
)
pub fn add_positioned_child( &mut self, child: impl Widget<T> + 'static, params: impl Into<StackChildParams<T>>, )
Add another positioned child.
Trait Implementations§
Source§impl<T: Data> Widget<T> for Stack<T>
impl<T: Data> Widget<T> for Stack<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, )
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, )
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
Source§fn paint(&mut self, ctx: &mut PaintCtx<'_, '_, '_>, data: &T, env: &Env)
fn paint(&mut self, ctx: &mut PaintCtx<'_, '_, '_>, data: &T, env: &Env)
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
Auto Trait Implementations§
impl<T> Freeze for Stack<T>
impl<T> !RefUnwindSafe for Stack<T>
impl<T> !Send for Stack<T>
impl<T> !Sync for Stack<T>
impl<T> Unpin for Stack<T>where
T: Unpin,
impl<T> !UnwindSafe for Stack<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
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, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
Source§fn round_into(self) -> U
fn round_into(self) -> U
Source§impl<T, W> TestWidgetExt<T> for W
impl<T, W> TestWidgetExt<T> for W
Source§impl<T, W> WidgetExt<T> for W
impl<T, W> WidgetExt<T> for W
fn on_command<CT: 'static>( self, selector: Selector<CT>, handler: impl Fn(&mut EventCtx<'_, '_>, &CT, &mut T) + 'static, ) -> ControllerHost<Self, OnCmd<CT, T>>
Source§fn on_change(
self,
f: impl Fn(&mut EventCtx<'_, '_>, &T, &mut T, &Env) + 'static,
) -> ControllerHost<Self, OnChange<T>>
fn on_change( self, f: impl Fn(&mut EventCtx<'_, '_>, &T, &mut T, &Env) + 'static, ) -> ControllerHost<Self, OnChange<T>>
Source§fn tooltip<LT: Into<LabelText<T>>>(
self,
text: LT,
) -> ControllerHost<Self, TooltipController<T>>
fn tooltip<LT: Into<LabelText<T>>>( self, text: LT, ) -> ControllerHost<Self, TooltipController<T>>
Source§fn on_monitor(self, parent: &WindowHandle) -> OnMonitor<Self>
fn on_monitor(self, parent: &WindowHandle) -> OnMonitor<Self>
Source§fn cancel_stack_tooltip(self) -> ControllerHost<Self, OnCmd<Point, T>>
fn cancel_stack_tooltip(self) -> ControllerHost<Self, OnCmd<Point, T>>
Source§fn stack_tooltip(self, label: impl Into<PlainOrRich>) -> StackTooltip<T>
fn stack_tooltip(self, label: impl Into<PlainOrRich>) -> StackTooltip<T>
Source§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>
Align widget, configured to align left.Source§fn align_right(self) -> Align<T>
fn align_right(self) -> Align<T>
Align widget, configured to align right.Source§fn align_vertical(self, align: UnitPoint) -> Align<T>
fn align_vertical(self, align: UnitPoint) -> Align<T>
Align widget, configured to align vertically.Source§fn align_horizontal(self, align: UnitPoint) -> Align<T>
fn align_horizontal(self, align: UnitPoint) -> Align<T>
Align widget, configured to align horizontally.Source§fn fix_width(self, width: impl Into<KeyOrValue<f64>>) -> SizedBox<T>
fn fix_width(self, width: impl Into<KeyOrValue<f64>>) -> SizedBox<T>
SizedBox with an explicit width.Source§fn fix_height(self, height: impl Into<KeyOrValue<f64>>) -> SizedBox<T>
fn fix_height(self, height: impl Into<KeyOrValue<f64>>) -> SizedBox<T>
SizedBox with an explicit height.Source§fn fix_size(
self,
width: impl Into<KeyOrValue<f64>>,
height: impl Into<KeyOrValue<f64>>,
) -> SizedBox<T>
fn fix_size( self, width: impl Into<KeyOrValue<f64>>, height: impl Into<KeyOrValue<f64>>, ) -> SizedBox<T>
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 foreground(self, brush: impl Into<BackgroundBrush<T>>) -> Container<T>
fn foreground(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>,
Controller.Source§fn on_added(
self,
f: impl Fn(&mut Self, &mut LifeCycleCtx<'_, '_>, &T, &Env) + 'static,
) -> ControllerHost<Self, Added<T, Self>>
fn on_added( self, f: impl Fn(&mut Self, &mut LifeCycleCtx<'_, '_>, &T, &Env) + 'static, ) -> ControllerHost<Self, Added<T, Self>>
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>
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>
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>
Source§fn debug_widget(self) -> EnvScope<T, Self>
fn debug_widget(self) -> EnvScope<T, Self>
DEBUG_WIDGET env variable for this widget (and its descendants). Read moreSource§fn with_id(self, id: WidgetId) -> IdentityWrapper<Self>
fn with_id(self, id: WidgetId) -> IdentityWrapper<Self>
Source§fn disabled_if(
self,
disabled_if: impl Fn(&T, &Env) -> bool + 'static,
) -> DisabledIf<T, Self>
fn disabled_if( self, disabled_if: impl Fn(&T, &Env) -> bool + 'static, ) -> DisabledIf<T, Self>
DisabledIf widget. Read more