pub trait WidgetBuilder:
Widget
+ Sized
+ 'static {
Show 65 methods
// Provided methods
fn on_tap(
self,
f: impl FnMut(&TapEvent, &mut EventContext<'_>) + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn on_double_tap(
self,
f: impl FnMut(&TapEvent, &mut EventContext<'_>) + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn on_triple_tap(
self,
f: impl FnMut(&TapEvent, &mut EventContext<'_>) + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn on_long_press(
self,
f: impl FnMut(&TapEvent, &mut EventContext<'_>) + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn accept_tap_buttons(
self,
mask: impl Into<ButtonMask>,
) -> WidgetWithHandlers<Self> { ... }
fn accept_double_tap_buttons(
self,
mask: impl Into<ButtonMask>,
) -> WidgetWithHandlers<Self> { ... }
fn accept_triple_tap_buttons(
self,
mask: impl Into<ButtonMask>,
) -> WidgetWithHandlers<Self> { ... }
fn accept_long_press_buttons(
self,
mask: impl Into<ButtonMask>,
) -> WidgetWithHandlers<Self> { ... }
fn dim_when_inactive(self, factor: f32) -> DimWhenInactive { ... }
fn dim_when_inactive_default(self) -> DimWhenInactive { ... }
fn on_drag(
self,
f: impl FnMut(DragPhase, &mut EventContext<'_>) + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn on_swipe(
self,
f: impl FnMut(SwipeDirection, f32, &mut EventContext<'_>) + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn on_pinch(
self,
f: impl FnMut(PinchPhase, &mut EventContext<'_>) + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn on_focus(
self,
f: impl FnMut(bool, &mut EventContext<'_>) + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn on_key(
self,
f: impl FnMut(&WidgetEvent, &mut EventContext<'_>) -> EventResponse + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn on_key_preview(
self,
f: impl FnMut(&WidgetEvent, &mut EventContext<'_>) -> EventResponse + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn on_pointer_event(
self,
f: impl FnMut(&WidgetEvent, &mut EventContext<'_>) -> EventResponse + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn on_hover(
self,
f: impl FnMut(bool, &mut EventContext<'_>) + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn on_scroll(
self,
f: impl FnMut(&WidgetEvent, &mut EventContext<'_>) -> EventResponse + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn on_access_action(
self,
f: impl FnMut(Action, &mut EventContext<'_>) -> EventResponse + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn focusable(self, focusable: bool) -> WidgetWithHandlers<Self> { ... }
fn tab_index(self, index: i32) -> WidgetWithHandlers<Self> { ... }
fn cursor(self, cursor: CursorIcon) -> WidgetWithHandlers<Self> { ... }
fn clips_children_on(self, clips: bool) -> WidgetWithHandlers<Self> { ... }
fn ime_input(self, ctx: ImeContext) -> WidgetWithHandlers<Self> { ... }
fn event_pass_through(self, pass_through: bool) -> WidgetWithHandlers<Self> { ... }
fn gesture_dead_zone(self, dead_zone: bool) -> WidgetWithHandlers<Self> { ... }
fn keyboard_capture(self, capture: bool) -> WidgetWithHandlers<Self> { ... }
fn hit_transparent(self, transparent: bool) -> WidgetWithHandlers<Self> { ... }
fn context_menu(
self,
factory: impl Fn(Point, &mut EventContext<'_>) -> Option<Box<dyn Widget>> + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn focus_within(self, signal: Signal<bool>) -> WidgetWithHandlers<Self> { ... }
fn hover_within(self, signal: Signal<bool>) -> WidgetWithHandlers<Self> { ... }
fn visible_when(
self,
state: impl Into<Prop<bool>>,
) -> WidgetWithHandlers<Self> { ... }
fn on_drag_hover(
self,
f: impl FnMut(&DragPayload, Point, &mut EventContext<'_>) -> DropFeedback + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn on_drag_leave(
self,
f: impl FnMut(&mut EventContext<'_>) + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn on_drag_tick(
self,
f: impl FnMut(Point, &mut EventContext<'_>) + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn on_drop(
self,
f: impl FnMut(DragPayload, Point, &mut EventContext<'_>) -> bool + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn on_drag_ended(
self,
f: impl FnMut(DropOutcome, &mut EventContext<'_>) + 'static,
) -> WidgetWithHandlers<Self> { ... }
fn access_label(
self,
label: impl Into<Prop<String>>,
) -> WidgetWithHandlers<Self> { ... }
fn access_description(
self,
description: impl Into<Prop<String>>,
) -> WidgetWithHandlers<Self> { ... }
fn access_hint(
self,
hint: impl Into<Prop<String>>,
) -> WidgetWithHandlers<Self> { ... }
fn access_value(
self,
value: impl Into<Prop<String>>,
) -> WidgetWithHandlers<Self> { ... }
fn access_role(self, role: Role) -> WidgetWithHandlers<Self> { ... }
fn access_hidden(
self,
hidden: impl Into<Prop<bool>>,
) -> WidgetWithHandlers<Self> { ... }
fn access_disabled(self, disabled: bool) -> WidgetWithHandlers<Self> { ... }
fn access_identifier(
self,
id: impl Into<String>,
) -> WidgetWithHandlers<Self> { ... }
fn access_controls(self, target: WidgetId) -> WidgetWithHandlers<Self> { ... }
fn access_described_by(self, target: WidgetId) -> WidgetWithHandlers<Self> { ... }
fn access_labelled_by(self, target: WidgetId) -> WidgetWithHandlers<Self> { ... }
fn access_live(self, mode: Live) -> WidgetWithHandlers<Self> { ... }
fn access_current(self, current: AriaCurrent) -> WidgetWithHandlers<Self> { ... }
fn access_shortcut_literal(
self,
shortcut: impl Into<String>,
) -> WidgetWithHandlers<Self> { ... }
fn access_shortcut_id(
self,
id: impl Into<String>,
) -> WidgetWithHandlers<Self> { ... }
fn access_has_popup(self, kind: HasPopup) -> WidgetWithHandlers<Self> { ... }
fn access_orientation(
self,
orientation: Orientation,
) -> WidgetWithHandlers<Self> { ... }
fn access_exclude_subtree(self) -> WidgetWithHandlers<Self> { ... }
fn access_merge_subtree(self) -> WidgetWithHandlers<Self> { ... }
fn access_subtree(self, mode: AccessSubtreeMode) -> WidgetWithHandlers<Self> { ... }
fn access_numeric_value(self, value: f64) -> WidgetWithHandlers<Self> { ... }
fn access_numeric_range(
self,
min: f64,
max: f64,
) -> WidgetWithHandlers<Self> { ... }
fn access_numeric_step(self, step: f64) -> WidgetWithHandlers<Self> { ... }
fn access_action<F>(
self,
action: Action,
handler: F,
) -> WidgetWithHandlers<Self>
where F: FnMut(&mut EventContext<'_>) + 'static { ... }
fn access_remove_action(self, action: Action) -> WidgetWithHandlers<Self> { ... }
fn access_custom_action<F>(
self,
label: impl Into<Prop<String>>,
handler: F,
) -> WidgetWithHandlers<Self>
where F: FnMut(&mut EventContext<'_>) + 'static { ... }
fn access_customize<F>(self, f: F) -> WidgetWithHandlers<Self>
where F: Fn(&mut AccessNodeBuilder) + 'static { ... }
}Expand description
Blanket trait providing attached handler methods for all Widget types.
The first builder method call wraps the widget in WidgetWithHandlers.
Provided Methods§
fn on_tap( self, f: impl FnMut(&TapEvent, &mut EventContext<'_>) + 'static, ) -> WidgetWithHandlers<Self>
fn on_double_tap( self, f: impl FnMut(&TapEvent, &mut EventContext<'_>) + 'static, ) -> WidgetWithHandlers<Self>
fn on_triple_tap( self, f: impl FnMut(&TapEvent, &mut EventContext<'_>) + 'static, ) -> WidgetWithHandlers<Self>
fn on_long_press( self, f: impl FnMut(&TapEvent, &mut EventContext<'_>) + 'static, ) -> WidgetWithHandlers<Self>
Restrict (or extend) the set of pointer buttons that fire
on_tap. Default is ButtonMask::PRIMARY.
Restrict (or extend) the set of pointer buttons that fire
on_double_tap. Default ButtonMask::PRIMARY.
Restrict (or extend) the set of pointer buttons that fire
on_triple_tap. Default ButtonMask::PRIMARY.
Restrict (or extend) the set of pointer buttons that fire
on_long_press. Default ButtonMask::PRIMARY.
Sourcefn dim_when_inactive(self, factor: f32) -> DimWhenInactive
fn dim_when_inactive(self, factor: f32) -> DimWhenInactive
Dim this widget’s subtree to factor opacity whenever the host window
is inactive (not focused / occluded), restoring full opacity when it
becomes active again. The opt-in, per-widget layer of the window-active
appearance model — for custom content an app wants to fade back when its
window isn’t the active one. Stock widgets handle their own
inactive appearance (caret hiding, selection desaturation) and need no
wrapping. Layout- and a11y-transparent; the opacity snaps (no tween),
which is correct under prefers-reduced-motion. See
DimWhenInactive.
Sourcefn dim_when_inactive_default(self) -> DimWhenInactive
fn dim_when_inactive_default(self) -> DimWhenInactive
dim_when_inactive with the default factor
(DEFAULT_DIM_FACTOR, 70 %).
fn on_drag( self, f: impl FnMut(DragPhase, &mut EventContext<'_>) + 'static, ) -> WidgetWithHandlers<Self>
fn on_swipe( self, f: impl FnMut(SwipeDirection, f32, &mut EventContext<'_>) + 'static, ) -> WidgetWithHandlers<Self>
fn on_pinch( self, f: impl FnMut(PinchPhase, &mut EventContext<'_>) + 'static, ) -> WidgetWithHandlers<Self>
fn on_focus( self, f: impl FnMut(bool, &mut EventContext<'_>) + 'static, ) -> WidgetWithHandlers<Self>
fn on_key( self, f: impl FnMut(&WidgetEvent, &mut EventContext<'_>) -> EventResponse + 'static, ) -> WidgetWithHandlers<Self>
Sourcefn on_key_preview(
self,
f: impl FnMut(&WidgetEvent, &mut EventContext<'_>) -> EventResponse + 'static,
) -> WidgetWithHandlers<Self>
fn on_key_preview( self, f: impl FnMut(&WidgetEvent, &mut EventContext<'_>) -> EventResponse + 'static, ) -> WidgetWithHandlers<Self>
Strict-ancestor key preview. See HandlerSet::on_key_preview.
fn on_pointer_event( self, f: impl FnMut(&WidgetEvent, &mut EventContext<'_>) -> EventResponse + 'static, ) -> WidgetWithHandlers<Self>
fn on_hover( self, f: impl FnMut(bool, &mut EventContext<'_>) + 'static, ) -> WidgetWithHandlers<Self>
fn on_scroll( self, f: impl FnMut(&WidgetEvent, &mut EventContext<'_>) -> EventResponse + 'static, ) -> WidgetWithHandlers<Self>
fn on_access_action( self, f: impl FnMut(Action, &mut EventContext<'_>) -> EventResponse + 'static, ) -> WidgetWithHandlers<Self>
fn focusable(self, focusable: bool) -> WidgetWithHandlers<Self>
fn tab_index(self, index: i32) -> WidgetWithHandlers<Self>
fn cursor(self, cursor: CursorIcon) -> WidgetWithHandlers<Self>
fn clips_children_on(self, clips: bool) -> WidgetWithHandlers<Self>
Sourcefn ime_input(self, ctx: ImeContext) -> WidgetWithHandlers<Self>
fn ime_input(self, ctx: ImeContext) -> WidgetWithHandlers<Self>
Declare this node a text-input surface, enabling the OS input method
(with ctx’s purpose) while it is focused. See crate::ime.
Sourcefn event_pass_through(self, pass_through: bool) -> WidgetWithHandlers<Self>
fn event_pass_through(self, pass_through: bool) -> WidgetWithHandlers<Self>
Make the widget invisible to pointer hit-testing. See
HandlerSet::event_pass_through.
Sourcefn gesture_dead_zone(self, dead_zone: bool) -> WidgetWithHandlers<Self>
fn gesture_dead_zone(self, dead_zone: bool) -> WidgetWithHandlers<Self>
Mark this widget’s subtree a gesture dead zone. See
HandlerSet::gesture_dead_zone.
Sourcefn keyboard_capture(self, capture: bool) -> WidgetWithHandlers<Self>
fn keyboard_capture(self, capture: bool) -> WidgetWithHandlers<Self>
Mark this widget a keyboard capture surface (terminals, game
viewports): while focused, KeyDowns bypass shortcut resolution.
See HandlerSet::keyboard_capture.
Sourcefn hit_transparent(self, transparent: bool) -> WidgetWithHandlers<Self>
fn hit_transparent(self, transparent: bool) -> WidgetWithHandlers<Self>
Make this widget and its whole subtree invisible to pointer
hit-testing (decorative overlays). See
HandlerSet::hit_transparent.
Set a context-menu factory. See
HandlerSet::context_menu for the full contract.
Sourcefn focus_within(self, signal: Signal<bool>) -> WidgetWithHandlers<Self>
fn focus_within(self, signal: Signal<bool>) -> WidgetWithHandlers<Self>
Bind a Signal<bool> the framework writes when a strict
descendant has focus. See HandlerSet::focus_within.
Sourcefn hover_within(self, signal: Signal<bool>) -> WidgetWithHandlers<Self>
fn hover_within(self, signal: Signal<bool>) -> WidgetWithHandlers<Self>
Bind a Signal<bool> the framework writes when a strict
descendant is hovered. See HandlerSet::hover_within.
Sourcefn visible_when(self, state: impl Into<Prop<bool>>) -> WidgetWithHandlers<Self>
fn visible_when(self, state: impl Into<Prop<bool>>) -> WidgetWithHandlers<Self>
Bind this node’s visibility (bool / Signal<bool> / Prop<bool>) as
a builder property, so teksu! can write visible_when: sig. Equivalent
to ctx.visible_when(id, ..). See HandlerSet::visible_when.
fn on_drag_hover( self, f: impl FnMut(&DragPayload, Point, &mut EventContext<'_>) -> DropFeedback + 'static, ) -> WidgetWithHandlers<Self>
fn on_drag_leave( self, f: impl FnMut(&mut EventContext<'_>) + 'static, ) -> WidgetWithHandlers<Self>
fn on_drag_tick( self, f: impl FnMut(Point, &mut EventContext<'_>) + 'static, ) -> WidgetWithHandlers<Self>
fn on_drop( self, f: impl FnMut(DragPayload, Point, &mut EventContext<'_>) -> bool + 'static, ) -> WidgetWithHandlers<Self>
Sourcefn on_drag_ended(
self,
f: impl FnMut(DropOutcome, &mut EventContext<'_>) + 'static,
) -> WidgetWithHandlers<Self>
fn on_drag_ended( self, f: impl FnMut(DropOutcome, &mut EventContext<'_>) + 'static, ) -> WidgetWithHandlers<Self>
Set the drag-ended handler on a drag source. See
HandlerSet::on_drag_ended.
fn access_label( self, label: impl Into<Prop<String>>, ) -> WidgetWithHandlers<Self>
fn access_description( self, description: impl Into<Prop<String>>, ) -> WidgetWithHandlers<Self>
fn access_hint(self, hint: impl Into<Prop<String>>) -> WidgetWithHandlers<Self>
fn access_value( self, value: impl Into<Prop<String>>, ) -> WidgetWithHandlers<Self>
fn access_role(self, role: Role) -> WidgetWithHandlers<Self>
fn access_disabled(self, disabled: bool) -> WidgetWithHandlers<Self>
fn access_identifier(self, id: impl Into<String>) -> WidgetWithHandlers<Self>
fn access_controls(self, target: WidgetId) -> WidgetWithHandlers<Self>
fn access_described_by(self, target: WidgetId) -> WidgetWithHandlers<Self>
fn access_labelled_by(self, target: WidgetId) -> WidgetWithHandlers<Self>
fn access_live(self, mode: Live) -> WidgetWithHandlers<Self>
fn access_current(self, current: AriaCurrent) -> WidgetWithHandlers<Self>
fn access_shortcut_literal( self, shortcut: impl Into<String>, ) -> WidgetWithHandlers<Self>
fn access_shortcut_id(self, id: impl Into<String>) -> WidgetWithHandlers<Self>
fn access_has_popup(self, kind: HasPopup) -> WidgetWithHandlers<Self>
fn access_orientation( self, orientation: Orientation, ) -> WidgetWithHandlers<Self>
fn access_exclude_subtree(self) -> WidgetWithHandlers<Self>
fn access_merge_subtree(self) -> WidgetWithHandlers<Self>
fn access_subtree(self, mode: AccessSubtreeMode) -> WidgetWithHandlers<Self>
fn access_numeric_value(self, value: f64) -> WidgetWithHandlers<Self>
fn access_numeric_range(self, min: f64, max: f64) -> WidgetWithHandlers<Self>
fn access_numeric_step(self, step: f64) -> WidgetWithHandlers<Self>
fn access_action<F>(
self,
action: Action,
handler: F,
) -> WidgetWithHandlers<Self>where
F: FnMut(&mut EventContext<'_>) + 'static,
fn access_remove_action(self, action: Action) -> WidgetWithHandlers<Self>
fn access_custom_action<F>(
self,
label: impl Into<Prop<String>>,
handler: F,
) -> WidgetWithHandlers<Self>where
F: FnMut(&mut EventContext<'_>) + 'static,
fn access_customize<F>(self, f: F) -> WidgetWithHandlers<Self>where
F: Fn(&mut AccessNodeBuilder) + 'static,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".