pub struct BoundStateful<S>where
S: StateTransitions,{ /* private fields */ }Expand description
A bound stateful element that maintains shared storage with an ElementRef
This wrapper is returned by Stateful::bind() and provides the same
fluent API as Stateful, but all modifications go through shared storage
accessible via the original ElementRef.
Implementations§
Source§impl<S> BoundStateful<S>where
S: StateTransitions,
impl<S> BoundStateful<S>where
S: StateTransitions,
Sourcepub fn on_state<F>(self, callback: F) -> BoundStateful<S>
pub fn on_state<F>(self, callback: F) -> BoundStateful<S>
Set the state callback (builder pattern)
Sourcepub fn w(self, px: f32) -> BoundStateful<S>
pub fn w(self, px: f32) -> BoundStateful<S>
Set width (builder pattern)
Sourcepub fn h(self, px: f32) -> BoundStateful<S>
pub fn h(self, px: f32) -> BoundStateful<S>
Set height (builder pattern)
Sourcepub fn w_full(self) -> BoundStateful<S>
pub fn w_full(self) -> BoundStateful<S>
Set width to 100% (builder pattern)
Sourcepub fn h_full(self) -> BoundStateful<S>
pub fn h_full(self) -> BoundStateful<S>
Set height to 100% (builder pattern)
Sourcepub fn size(self, w: f32, h: f32) -> BoundStateful<S>
pub fn size(self, w: f32, h: f32) -> BoundStateful<S>
Set both width and height (builder pattern)
Sourcepub fn square(self, size: f32) -> BoundStateful<S>
pub fn square(self, size: f32) -> BoundStateful<S>
Set square size (builder pattern)
Sourcepub fn flex_row(self) -> BoundStateful<S>
pub fn flex_row(self) -> BoundStateful<S>
Set flex direction to row (builder pattern)
Sourcepub fn flex_col(self) -> BoundStateful<S>
pub fn flex_col(self) -> BoundStateful<S>
Set flex direction to column (builder pattern)
Sourcepub fn flex_grow(self) -> BoundStateful<S>
pub fn flex_grow(self) -> BoundStateful<S>
Set flex grow (builder pattern)
Sourcepub fn w_fit(self) -> BoundStateful<S>
pub fn w_fit(self) -> BoundStateful<S>
Set width to fit content (builder pattern)
Sourcepub fn h_fit(self) -> BoundStateful<S>
pub fn h_fit(self) -> BoundStateful<S>
Set height to fit content (builder pattern)
Sourcepub fn p(self, units: f32) -> BoundStateful<S>
pub fn p(self, units: f32) -> BoundStateful<S>
Set padding all sides (builder pattern)
Sourcepub fn px(self, units: f32) -> BoundStateful<S>
pub fn px(self, units: f32) -> BoundStateful<S>
Set horizontal padding (builder pattern)
Sourcepub fn py(self, units: f32) -> BoundStateful<S>
pub fn py(self, units: f32) -> BoundStateful<S>
Set vertical padding (builder pattern)
Sourcepub fn gap(self, units: f32) -> BoundStateful<S>
pub fn gap(self, units: f32) -> BoundStateful<S>
Set gap (builder pattern)
Sourcepub fn items_center(self) -> BoundStateful<S>
pub fn items_center(self) -> BoundStateful<S>
Center items (builder pattern)
Sourcepub fn justify_center(self) -> BoundStateful<S>
pub fn justify_center(self) -> BoundStateful<S>
Center justify (builder pattern)
Sourcepub fn justify_between(self) -> BoundStateful<S>
pub fn justify_between(self) -> BoundStateful<S>
Space between (builder pattern)
Sourcepub fn bg(self, color: impl Into<Brush>) -> BoundStateful<S>
pub fn bg(self, color: impl Into<Brush>) -> BoundStateful<S>
Set background (builder pattern)
Sourcepub fn rounded(self, radius: f32) -> BoundStateful<S>
pub fn rounded(self, radius: f32) -> BoundStateful<S>
Set corner radius (builder pattern)
Sourcepub fn border(self, width: f32, color: Color) -> BoundStateful<S>
pub fn border(self, width: f32, color: Color) -> BoundStateful<S>
Set border with color and width (builder pattern)
Sourcepub fn border_color(self, color: Color) -> BoundStateful<S>
pub fn border_color(self, color: Color) -> BoundStateful<S>
Set border color only (builder pattern)
Sourcepub fn border_width(self, width: f32) -> BoundStateful<S>
pub fn border_width(self, width: f32) -> BoundStateful<S>
Set border width only (builder pattern)
Sourcepub fn shadow(self, shadow: Shadow) -> BoundStateful<S>
pub fn shadow(self, shadow: Shadow) -> BoundStateful<S>
Set shadow (builder pattern)
Sourcepub fn shadow_sm(self) -> BoundStateful<S>
pub fn shadow_sm(self) -> BoundStateful<S>
Set small shadow (builder pattern)
Sourcepub fn shadow_md(self) -> BoundStateful<S>
pub fn shadow_md(self) -> BoundStateful<S>
Set medium shadow (builder pattern)
Sourcepub fn shadow_lg(self) -> BoundStateful<S>
pub fn shadow_lg(self) -> BoundStateful<S>
Set large shadow (builder pattern)
Sourcepub fn shadow_xl(self) -> BoundStateful<S>
pub fn shadow_xl(self) -> BoundStateful<S>
Set extra-large shadow (builder pattern)
Sourcepub fn opacity(self, opacity: f32) -> BoundStateful<S>
pub fn opacity(self, opacity: f32) -> BoundStateful<S>
Set opacity (builder pattern)
Sourcepub fn flex_shrink(self) -> BoundStateful<S>
pub fn flex_shrink(self) -> BoundStateful<S>
Set flex shrink (builder pattern)
Sourcepub fn flex_shrink_0(self) -> BoundStateful<S>
pub fn flex_shrink_0(self) -> BoundStateful<S>
Set flex shrink to 0 (builder pattern)
Sourcepub fn transform_style(self, xform: Transform) -> BoundStateful<S>
pub fn transform_style(self, xform: Transform) -> BoundStateful<S>
Set transform (builder pattern)
Sourcepub fn overflow_clip(self) -> BoundStateful<S>
pub fn overflow_clip(self) -> BoundStateful<S>
Set overflow to clip (clips children to container bounds)
Sourcepub fn cursor(self, cursor: CursorStyle) -> BoundStateful<S>
pub fn cursor(self, cursor: CursorStyle) -> BoundStateful<S>
Set cursor style (builder pattern)
Sourcepub fn cursor_pointer(self) -> BoundStateful<S>
pub fn cursor_pointer(self) -> BoundStateful<S>
Set cursor to pointer (hand) - convenience for clickable elements
Sourcepub fn cursor_text(self) -> BoundStateful<S>
pub fn cursor_text(self) -> BoundStateful<S>
Set cursor to text (I-beam) - for text input areas
Sourcepub fn child(self, child: impl ElementBuilder + 'static) -> BoundStateful<S>
pub fn child(self, child: impl ElementBuilder + 'static) -> BoundStateful<S>
Add child (builder pattern)
Sourcepub fn on_click<F>(self, handler: F) -> BoundStateful<S>
pub fn on_click<F>(self, handler: F) -> BoundStateful<S>
Register a click handler (builder pattern)
Sourcepub fn on_mouse_down<F>(self, handler: F) -> BoundStateful<S>
pub fn on_mouse_down<F>(self, handler: F) -> BoundStateful<S>
Register a mouse down handler (builder pattern)
Sourcepub fn on_mouse_up<F>(self, handler: F) -> BoundStateful<S>
pub fn on_mouse_up<F>(self, handler: F) -> BoundStateful<S>
Register a mouse up handler (builder pattern)
Sourcepub fn on_hover_enter<F>(self, handler: F) -> BoundStateful<S>
pub fn on_hover_enter<F>(self, handler: F) -> BoundStateful<S>
Register a hover enter handler (builder pattern)
Sourcepub fn on_hover_leave<F>(self, handler: F) -> BoundStateful<S>
pub fn on_hover_leave<F>(self, handler: F) -> BoundStateful<S>
Register a hover leave handler (builder pattern)
Sourcepub fn on_focus<F>(self, handler: F) -> BoundStateful<S>
pub fn on_focus<F>(self, handler: F) -> BoundStateful<S>
Register a focus handler (builder pattern)
Sourcepub fn on_blur<F>(self, handler: F) -> BoundStateful<S>
pub fn on_blur<F>(self, handler: F) -> BoundStateful<S>
Register a blur handler (builder pattern)
Sourcepub fn on_mount<F>(self, handler: F) -> BoundStateful<S>
pub fn on_mount<F>(self, handler: F) -> BoundStateful<S>
Register a mount handler (builder pattern)
Sourcepub fn on_unmount<F>(self, handler: F) -> BoundStateful<S>
pub fn on_unmount<F>(self, handler: F) -> BoundStateful<S>
Register an unmount handler (builder pattern)
Sourcepub fn on_key_down<F>(self, handler: F) -> BoundStateful<S>
pub fn on_key_down<F>(self, handler: F) -> BoundStateful<S>
Register a key down handler (builder pattern)
Sourcepub fn on_key_up<F>(self, handler: F) -> BoundStateful<S>
pub fn on_key_up<F>(self, handler: F) -> BoundStateful<S>
Register a key up handler (builder pattern)
Sourcepub fn on_scroll<F>(self, handler: F) -> BoundStateful<S>
pub fn on_scroll<F>(self, handler: F) -> BoundStateful<S>
Register a scroll handler (builder pattern)
Sourcepub fn on_mouse_move<F>(self, handler: F) -> BoundStateful<S>
pub fn on_mouse_move<F>(self, handler: F) -> BoundStateful<S>
Register a mouse move handler (builder pattern)
Sourcepub fn on_resize<F>(self, handler: F) -> BoundStateful<S>
pub fn on_resize<F>(self, handler: F) -> BoundStateful<S>
Register a resize handler (builder pattern)
Sourcepub fn on_event<F>(self, event_type: u32, handler: F) -> BoundStateful<S>
pub fn on_event<F>(self, event_type: u32, handler: F) -> BoundStateful<S>
Register a handler for a specific event type (builder pattern)
Sourcepub fn on_layout<F>(self, callback: F) -> BoundStateful<S>
pub fn on_layout<F>(self, callback: F) -> BoundStateful<S>
Set a layout callback that fires synchronously after each layout computation (builder pattern)
Trait Implementations§
Source§impl<S> ElementBuilder for BoundStateful<S>where
S: StateTransitions + Default,
impl<S> ElementBuilder for BoundStateful<S>where
S: StateTransitions + Default,
Source§fn build(&self, tree: &mut LayoutTree) -> LayoutNodeId
fn build(&self, tree: &mut LayoutTree) -> LayoutNodeId
Source§fn render_props(&self) -> RenderProps
fn render_props(&self) -> RenderProps
Source§fn children_builders(&self) -> &[Box<dyn ElementBuilder>]
fn children_builders(&self) -> &[Box<dyn ElementBuilder>]
Source§fn element_type_id(&self) -> ElementTypeId
fn element_type_id(&self) -> ElementTypeId
Source§fn layout_animation_config(&self) -> Option<LayoutAnimationConfig>
fn layout_animation_config(&self) -> Option<LayoutAnimationConfig>
Source§fn visual_animation_config(&self) -> Option<VisualAnimationConfig>
fn visual_animation_config(&self) -> Option<VisualAnimationConfig>
Source§fn text_render_info(&self) -> Option<TextRenderInfo>
fn text_render_info(&self) -> Option<TextRenderInfo>
Source§fn styled_text_render_info(&self) -> Option<StyledTextRenderInfo>
fn styled_text_render_info(&self) -> Option<StyledTextRenderInfo>
Source§fn svg_render_info(&self) -> Option<SvgRenderInfo>
fn svg_render_info(&self) -> Option<SvgRenderInfo>
Source§fn image_render_info(&self) -> Option<ImageRenderInfo>
fn image_render_info(&self) -> Option<ImageRenderInfo>
Source§fn canvas_render_info(
&self,
) -> Option<Rc<dyn Fn(&mut dyn DrawContext, CanvasBounds)>>
fn canvas_render_info( &self, ) -> Option<Rc<dyn Fn(&mut dyn DrawContext, CanvasBounds)>>
Source§fn event_handlers(&self) -> Option<&EventHandlers>
fn event_handlers(&self) -> Option<&EventHandlers>
Source§fn scroll_info(&self) -> Option<ScrollRenderInfo>
fn scroll_info(&self) -> Option<ScrollRenderInfo>
Source§fn scroll_physics(&self) -> Option<Arc<Mutex<ScrollPhysics>>>
fn scroll_physics(&self) -> Option<Arc<Mutex<ScrollPhysics>>>
Source§fn motion_animation_for_child(
&self,
_child_index: usize,
) -> Option<MotionAnimation>
fn motion_animation_for_child( &self, _child_index: usize, ) -> Option<MotionAnimation>
Source§fn motion_bindings(&self) -> Option<MotionBindings>
fn motion_bindings(&self) -> Option<MotionBindings>
Source§fn motion_stable_id(&self) -> Option<&str>
fn motion_stable_id(&self) -> Option<&str>
Source§fn motion_should_replay(&self) -> bool
fn motion_should_replay(&self) -> bool
Source§fn motion_is_suspended(&self) -> bool
fn motion_is_suspended(&self) -> bool
Source§fn motion_is_exiting(&self) -> bool
fn motion_is_exiting(&self) -> bool
Use query_motion(key).exit() to explicitly trigger motion exit
Source§fn layout_bounds_storage(&self) -> Option<Arc<Mutex<Option<ElementBounds>>>>
fn layout_bounds_storage(&self) -> Option<Arc<Mutex<Option<ElementBounds>>>>
Source§fn layout_bounds_callback(
&self,
) -> Option<Arc<dyn Fn(ElementBounds) + Send + Sync>>
fn layout_bounds_callback( &self, ) -> Option<Arc<dyn Fn(ElementBounds) + Send + Sync>>
Source§fn semantic_type_name(&self) -> Option<&'static str>
fn semantic_type_name(&self) -> Option<&'static str>
Source§fn set_auto_id(&mut self, _id: String) -> bool
fn set_auto_id(&mut self, _id: String) -> bool
Source§fn children_builders_mut(&mut self) -> &mut [Box<dyn ElementBuilder>]
fn children_builders_mut(&mut self) -> &mut [Box<dyn ElementBuilder>]
Source§fn element_classes(&self) -> &[String]
fn element_classes(&self) -> &[String]
Source§fn bound_scroll_ref(&self) -> Option<&ScrollRef>
fn bound_scroll_ref(&self) -> Option<&ScrollRef>
Source§fn motion_on_ready_callback(
&self,
) -> Option<Arc<dyn Fn(ElementBounds) + Send + Sync>>
fn motion_on_ready_callback( &self, ) -> Option<Arc<dyn Fn(ElementBounds) + Send + Sync>>
Auto Trait Implementations§
impl<S> Freeze for BoundStateful<S>
impl<S> RefUnwindSafe for BoundStateful<S>
impl<S> !Send for BoundStateful<S>
impl<S> !Sync for BoundStateful<S>
impl<S> Unpin for BoundStateful<S>
impl<S> UnsafeUnpin for BoundStateful<S>
impl<S> UnwindSafe for BoundStateful<S>
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.