Trait Decorator
pub trait Decorator: Sized + 'static {
type Inner: Widget + AsDynWidget + ?Sized;
Show 137 methods
// Required methods
fn inner(&self) -> &Self::Inner;
fn inner_mut(&mut self) -> &mut Self::Inner;
// Provided methods
fn for_each_layout_child(
&self,
visitor: &mut dyn FnMut(&dyn Widget),
) -> bool { ... }
fn provide<'a>(&'a self, request: &mut Request<'a, '_>) { ... }
fn provide_mut<'a>(&'a mut self, request: &mut RequestMut<'a, '_>) { ... }
fn build_layout(
&mut self,
taffy: &mut TaffyTree,
theme: &Theme,
node_map: &mut HashMap<NodeId, *mut dyn Widget>,
) -> NodeId { ... }
fn as_any(&self) -> Option<&(dyn Any + 'static)> { ... }
fn stands_for(&self, address: *const ()) -> bool { ... }
fn as_any_mut(&mut self) -> Option<&mut (dyn Any + 'static)> { ... }
fn take_structure_change(&mut self) -> StructureChange { ... }
fn composition_follows_allocation(&self) -> bool { ... }
fn view_only_scroll(&self, _event: &WindowEvent) -> bool { ... }
fn accessibility_hidden(&self) -> bool { ... }
fn accessibility_shared(&self) -> Option<SharedAccessNode> { ... }
fn accessibility_root(&self) -> Option<AccessNode> { ... }
fn mark_children_drawn(&mut self) { ... }
fn focus_reveal_context(&self) -> Option<Rect> { ... }
fn native_input_snapshot(
&self,
state: &(dyn Any + 'static),
path: &(dyn Any + 'static),
) -> Option<Value> { ... }
fn callback_binding(&self) -> Option<CallbackBinding> { ... }
fn has_separate_document_owner(&self) -> bool { ... }
fn history_owner(&self) -> Option<HistoryOwner> { ... }
fn record_owners(&self) -> Vec<HistoryOwner> { ... }
fn layout_info(&self) -> Option<LayoutInfo> { ... }
fn children(&self) -> Vec<&dyn Widget> { ... }
fn for_each_child(&self, visitor: &mut dyn FnMut(&dyn Widget)) { ... }
fn for_each_child_in_clip(&self, visitor: &mut dyn FnMut(&dyn Widget)) { ... }
fn for_each_hosted_child(&self, visitor: &mut dyn FnMut(&dyn Widget)) { ... }
fn name(&self) -> &str { ... }
fn test_id(&self) -> Option<&str> { ... }
fn window_slot(&self, id: String) -> Option<ToolbarAction> { ... }
fn test_rects(&self) -> Vec<(String, Rect)> { ... }
fn get_rect(&self) -> Rect { ... }
fn paint_bounds(&self) -> Rect { ... }
fn child_clip_rect(&self) -> Option<Rect> { ... }
fn snap_points(&self, axis: ScrollAxis, out: &mut Vec<f32>) { ... }
fn cursor_shape(&self, point: Point) -> Option<CursorIcon> { ... }
fn claims_raw_touch(&self, point: Point) -> bool { ... }
fn touch_claim(&self, point: Point) -> TouchClaim { ... }
fn tooltip(&self) -> Option<&str> { ... }
fn tooltip_side(&self) -> TooltipSide { ... }
fn tooltip_target_at(&self, point: Point) -> Option<(Rect, String)> { ... }
fn is_focusable(&self) -> bool { ... }
fn is_focused(&self) -> bool { ... }
fn context_menu_anchor(&self) -> Option<Rect> { ... }
fn wants_tab_input(&self) -> bool { ... }
fn ime_cursor_rect(&self) -> Option<Rect> { ... }
fn traps_focus(&self) -> bool { ... }
fn scopes_keyboard_focus(&self) -> bool { ... }
fn accessibility(&self) -> Option<AccessNode> { ... }
fn synthetic_accessibility_rect(&self, path: &[usize]) -> Option<Rect> { ... }
fn accessibility_child_parent(&self, child_index: usize) -> Option<usize> { ... }
fn accessibility_child_path(&self, child_index: usize) -> Option<Vec<usize>> { ... }
fn accessibility_represents_child(&self, child_index: usize) -> bool { ... }
fn lays_out_child(&self, child_index: usize) -> bool { ... }
fn accessibility_child_description(
&self,
child_index: usize,
) -> Option<String> { ... }
fn is_enabled(&self) -> bool { ... }
fn ime_requires_deferred_ack(&self) -> bool { ... }
fn ime_refuses_ordinary_commits(&self) -> bool { ... }
fn ime_edit_fingerprint(&self, key: &[u8; 32]) -> Option<[u8; 32]> { ... }
fn ime_content(&self) -> Option<InputContent> { ... }
fn ime_multiline(&self) -> bool { ... }
fn presented(&self) -> bool { ... }
fn arrives_from(&self) -> Source { ... }
fn arrival_progress(&self) -> Option<Progress> { ... }
fn arrival_shape(&self) -> SkeletonShape { ... }
fn text_review(&self) -> Option<(usize, String)> { ... }
fn nav_availability(&self) -> NavAvailability { ... }
fn dev_route(&self) -> Option<RouteSnapshot> { ... }
fn appearance_intent(&self) -> Option<AppearanceIntent> { ... }
fn minimum_window_width(&self) -> Option<f64> { ... }
fn preferred_window_size(&self) -> Option<(f64, f64)> { ... }
fn needs_idle_sync(&self) -> bool { ... }
fn wants_pointer_capture(&self) -> bool { ... }
fn disclosing(&self) -> Option<Disclosing> { ... }
fn is_band(&self) -> bool { ... }
fn animation_detail(&self) -> Option<String> { ... }
fn needs_animation_frame(&self) -> bool { ... }
fn next_wake_deadline(&self) -> Option<Instant> { ... }
fn holds_frame_until(&self, now: Instant) -> Option<Instant> { ... }
fn modal_capture(&self) -> Option<Rect> { ... }
fn presents_modal(&self) -> bool { ... }
fn has_pending_visual_work(&self) -> bool { ... }
fn has_transient_feedback(&self) -> bool { ... }
fn needs_redraw(&self) -> bool { ... }
fn collect_damage(&self, regions: &mut Vec<Rect>) { ... }
fn damage_covers_own_box(&self) -> bool { ... }
fn is_layout_dirty(&self) -> bool { ... }
fn layout_needs_measure(&self) -> bool { ... }
fn is_default_keyboard_focus(&self) -> bool { ... }
fn keyboard_input_scope(&self) -> Option<u64> { ... }
fn primary_vertical_scroll(&self) -> Option<PrimaryScrollRegion> { ... }
fn set_full_bleed(&mut self, full_bleed: bool) { ... }
fn place_disclosing(&mut self, slot: Rect) { ... }
fn note_placement(&mut self, placement: Placement) { ... }
fn set_platform_conventions(&mut self, conventions: PlatformConventions) { ... }
fn set_interaction_environment(
&mut self,
environment: InteractionEnvironment,
) { ... }
fn set_window_bar_control(&mut self, in_bar: bool) { ... }
fn sync(&mut self, state: &(dyn Any + 'static), path: &(dyn Any + 'static)) { ... }
fn update(
&mut self,
state: &(dyn Any + 'static),
path: &(dyn Any + 'static),
) -> bool { ... }
fn serve_deadline(&mut self, now: Instant) -> bool { ... }
fn settle(&mut self, edits: &mut Edits<'_>, path: &ExId) { ... }
fn measure(
&mut self,
known: Size<Option<f32>>,
available: Size<AvailableSpace>,
text_renderer: &mut TextRenderer,
) -> Size<f32> { ... }
fn adjust_layout_style(
&mut self,
taffy: &mut TaffyTree,
node: NodeId,
text: &mut TextRenderer,
) -> bool { ... }
fn apply_layout(&mut self, taffy: &TaffyTree, node: NodeId, origin: Point) { ... }
fn draw(
&mut self,
scene: &mut Scene,
transform: Affine,
text_renderer: &mut TextRenderer,
theme: &Theme,
presence: &PresenceCtx,
) { ... }
fn observe_physical_input(&mut self, input: PhysicalInput) { ... }
fn handle_event(&mut self, event: &WindowEvent, ctx: &mut EventCtx<'_>) { ... }
fn children_mut(&mut self) -> Vec<&mut dyn Widget> { ... }
fn reveal_descendant(&mut self, target: *const dyn Widget) -> bool { ... }
fn take_action_palette_request(&mut self) -> Option<ActionAddress> { ... }
fn take_search_request(&mut self) -> bool { ... }
fn set_focus(&mut self, focused: bool) { ... }
fn set_invalid(&mut self, invalid: bool) { ... }
fn focus_synthetic_accessibility(&mut self, path: &[usize]) -> bool { ... }
fn perform_action(
&mut self,
action: &Action,
key_path: &[u64],
state: &mut Edits<'_>,
path: &(dyn Any + 'static),
) -> bool { ... }
fn perform_semantic_action(
&mut self,
target: &str,
action: &Action,
state: &mut Edits<'_>,
path: &(dyn Any + 'static),
) -> bool { ... }
fn start_deferred_text(&mut self) -> Option<Receipt> { ... }
fn commit_deferred_text(&mut self, text: &str) -> Option<Receipt> { ... }
fn on_external_event(
&mut self,
payload: &str,
state: &mut Edits<'_>,
root: &(dyn Any + 'static),
) { ... }
fn on_nav_gesture(
&mut self,
dir: NavDirection,
state: &(dyn Any + 'static),
path: &(dyn Any + 'static),
) -> bool { ... }
fn take_focus_reset(&mut self) -> bool { ... }
fn take_accessibility_request(&mut self) -> Option<AccessibilityRequest> { ... }
fn take_app_activation(&mut self) -> Option<u64> { ... }
fn take_focus_request(&mut self) -> Option<String> { ... }
fn restore_dev_route(&mut self, route: &RouteSnapshot) -> bool { ... }
fn set_motion_reduced(&mut self, reduced: bool) { ... }
fn take_structure_dirty(&mut self) -> bool { ... }
fn dismiss_presented_modal(&mut self) -> bool { ... }
fn remount_children(&mut self, remount: &mut Remount<'_>) -> bool { ... }
fn mark_drawn(&mut self) { ... }
fn release_scene_cache(&mut self) { ... }
fn draw_overlay(
&mut self,
scene: &mut Scene,
transform: Affine,
text_renderer: &mut TextRenderer,
theme: &Theme,
presence: &PresenceCtx,
) { ... }
fn apply_primary_vertical_scroll(
&mut self,
action: PrimaryScrollAction,
) -> PrimaryScrollResult { ... }
fn focus_requested(&mut self, target: Option<NodeId>, tree: &TaffyTree) { ... }
fn mount_native_views(&mut self, host: &NativeViewHost<'_>) { ... }
fn native_view_frame_start(&mut self) { ... }
fn unmount_native_views(&mut self) { ... }
}Expand description
A widget that extends another by overriding a few Widget methods and
forwarding the rest. See the module docs.
Required Associated Types§
type Inner: Widget + AsDynWidget + ?Sized
type Inner: Widget + AsDynWidget + ?Sized
The widget this one extends.
Required Methods§
Provided Methods§
fn for_each_layout_child(&self, visitor: &mut dyn FnMut(&dyn Widget)) -> bool
fn for_each_layout_child(&self, visitor: &mut dyn FnMut(&dyn Widget)) -> bool
The inner widget itself: the decorator’s layout node stands for it, so a retained layout is checked through the inner widget and what it lays out. A decorator that lays out more than its inner widget (an overlay it mounts) lists that too.
fn provide<'a>(&'a self, request: &mut Request<'a, '_>)
fn provide_mut<'a>(&'a mut self, request: &mut RequestMut<'a, '_>)
fn build_layout( &mut self, taffy: &mut TaffyTree, theme: &Theme, node_map: &mut HashMap<NodeId, *mut dyn Widget>, ) -> NodeId
fn as_any(&self) -> Option<&(dyn Any + 'static)>
fn stands_for(&self, address: *const ()) -> bool
fn as_any_mut(&mut self) -> Option<&mut (dyn Any + 'static)>
fn take_structure_change(&mut self) -> StructureChange
fn take_structure_change(&mut self) -> StructureChange
A decorator’s structure flag is its own Decorator::take_structure_dirty
(which may add flags of its own), so by default it says
crate::widget::StructureChange::Rebuild; one that adds no flags forwards
its inner widget’s change by overriding this.
fn composition_follows_allocation(&self) -> bool
fn composition_follows_allocation(&self) -> bool
A decorator composes from its allocation when anything it wraps does.
fn view_only_scroll(&self, _event: &WindowEvent) -> bool
fn view_only_scroll(&self, _event: &WindowEvent) -> bool
Decorators must opt in themselves: an outer handler can change what its inner widget declares even when the inner scroll is view-only.
Read from this decorator’s own node: one that overrides
accessibility may hide (or reveal) what its inner widget reports.
Not forwarded: a decorator may change what its inner widget
reports through accessibility, so by default the tree reads
that. One that shares its children overrides both.
fn accessibility_root(&self) -> Option<AccessNode>
fn accessibility_root(&self) -> Option<AccessNode>
The decorator’s own node without its children. Not forwarded: a
decorator that rewrites accessibility would otherwise answer
with its inner widget’s root. One that only adds children may
forward to its inner widget’s root itself.
fn mark_children_drawn(&mut self)
fn mark_children_drawn(&mut self)
Rest what this decorator’s frame drew, in the children it lays out; a decorator that adds mounted children overrides this.
fn focus_reveal_context(&self) -> Option<Rect>
fn native_input_snapshot( &self, state: &(dyn Any + 'static), path: &(dyn Any + 'static), ) -> Option<Value>
fn callback_binding(&self) -> Option<CallbackBinding>
fn has_separate_document_owner(&self) -> bool
fn history_owner(&self) -> Option<HistoryOwner>
fn record_owners(&self) -> Vec<HistoryOwner>
fn layout_info(&self) -> Option<LayoutInfo>
fn children(&self) -> Vec<&dyn Widget>
fn for_each_child(&self, visitor: &mut dyn FnMut(&dyn Widget))
fn for_each_child_in_clip(&self, visitor: &mut dyn FnMut(&dyn Widget))
fn for_each_hosted_child(&self, visitor: &mut dyn FnMut(&dyn Widget))
fn name(&self) -> &str
fn test_id(&self) -> Option<&str>
fn window_slot(&self, id: String) -> Option<ToolbarAction>
fn test_rects(&self) -> Vec<(String, Rect)>
fn get_rect(&self) -> Rect
fn paint_bounds(&self) -> Rect
fn child_clip_rect(&self) -> Option<Rect>
fn snap_points(&self, axis: ScrollAxis, out: &mut Vec<f32>)
fn cursor_shape(&self, point: Point) -> Option<CursorIcon>
fn claims_raw_touch(&self, point: Point) -> bool
fn touch_claim(&self, point: Point) -> TouchClaim
fn tooltip(&self) -> Option<&str>
fn tooltip_side(&self) -> TooltipSide
fn tooltip_target_at(&self, point: Point) -> Option<(Rect, String)>
fn is_focusable(&self) -> bool
fn is_focused(&self) -> bool
fn wants_tab_input(&self) -> bool
fn ime_cursor_rect(&self) -> Option<Rect>
fn traps_focus(&self) -> bool
fn scopes_keyboard_focus(&self) -> bool
fn accessibility(&self) -> Option<AccessNode>
fn synthetic_accessibility_rect(&self, path: &[usize]) -> Option<Rect>
fn accessibility_child_parent(&self, child_index: usize) -> Option<usize>
fn accessibility_child_path(&self, child_index: usize) -> Option<Vec<usize>>
fn accessibility_represents_child(&self, child_index: usize) -> bool
fn lays_out_child(&self, child_index: usize) -> bool
fn accessibility_child_description(&self, child_index: usize) -> Option<String>
fn is_enabled(&self) -> bool
fn ime_requires_deferred_ack(&self) -> bool
fn ime_refuses_ordinary_commits(&self) -> bool
fn ime_edit_fingerprint(&self, key: &[u8; 32]) -> Option<[u8; 32]>
fn ime_content(&self) -> Option<InputContent>
fn ime_multiline(&self) -> bool
fn presented(&self) -> bool
fn arrives_from(&self) -> Source
fn arrival_progress(&self) -> Option<Progress>
fn arrival_shape(&self) -> SkeletonShape
fn text_review(&self) -> Option<(usize, String)>
fn dev_route(&self) -> Option<RouteSnapshot>
fn appearance_intent(&self) -> Option<AppearanceIntent>
fn minimum_window_width(&self) -> Option<f64>
fn preferred_window_size(&self) -> Option<(f64, f64)>
fn needs_idle_sync(&self) -> bool
fn wants_pointer_capture(&self) -> bool
fn disclosing(&self) -> Option<Disclosing>
fn is_band(&self) -> bool
fn animation_detail(&self) -> Option<String>
fn needs_animation_frame(&self) -> bool
fn next_wake_deadline(&self) -> Option<Instant>
fn holds_frame_until(&self, now: Instant) -> Option<Instant>
fn modal_capture(&self) -> Option<Rect>
fn presents_modal(&self) -> bool
fn has_pending_visual_work(&self) -> bool
fn has_transient_feedback(&self) -> bool
fn needs_redraw(&self) -> bool
fn collect_damage(&self, regions: &mut Vec<Rect>)
fn damage_covers_own_box(&self) -> bool
fn is_layout_dirty(&self) -> bool
fn layout_needs_measure(&self) -> bool
fn is_default_keyboard_focus(&self) -> bool
fn keyboard_input_scope(&self) -> Option<u64>
fn primary_vertical_scroll(&self) -> Option<PrimaryScrollRegion>
fn set_full_bleed(&mut self, full_bleed: bool)
fn place_disclosing(&mut self, slot: Rect)
fn note_placement(&mut self, placement: Placement)
fn set_platform_conventions(&mut self, conventions: PlatformConventions)
fn set_interaction_environment(&mut self, environment: InteractionEnvironment)
fn set_window_bar_control(&mut self, in_bar: bool)
fn sync(&mut self, state: &(dyn Any + 'static), path: &(dyn Any + 'static))
fn update( &mut self, state: &(dyn Any + 'static), path: &(dyn Any + 'static), ) -> bool
fn serve_deadline(&mut self, now: Instant) -> bool
fn settle(&mut self, edits: &mut Edits<'_>, path: &ExId)
fn measure( &mut self, known: Size<Option<f32>>, available: Size<AvailableSpace>, text_renderer: &mut TextRenderer, ) -> Size<f32>
fn adjust_layout_style( &mut self, taffy: &mut TaffyTree, node: NodeId, text: &mut TextRenderer, ) -> bool
fn apply_layout(&mut self, taffy: &TaffyTree, node: NodeId, origin: Point)
fn draw( &mut self, scene: &mut Scene, transform: Affine, text_renderer: &mut TextRenderer, theme: &Theme, presence: &PresenceCtx, )
fn observe_physical_input(&mut self, input: PhysicalInput)
fn handle_event(&mut self, event: &WindowEvent, ctx: &mut EventCtx<'_>)
fn children_mut(&mut self) -> Vec<&mut dyn Widget>
fn reveal_descendant(&mut self, target: *const dyn Widget) -> bool
fn take_action_palette_request(&mut self) -> Option<ActionAddress>
fn take_search_request(&mut self) -> bool
fn set_focus(&mut self, focused: bool)
fn set_invalid(&mut self, invalid: bool)
fn focus_synthetic_accessibility(&mut self, path: &[usize]) -> bool
fn perform_action( &mut self, action: &Action, key_path: &[u64], state: &mut Edits<'_>, path: &(dyn Any + 'static), ) -> bool
fn perform_semantic_action( &mut self, target: &str, action: &Action, state: &mut Edits<'_>, path: &(dyn Any + 'static), ) -> bool
fn start_deferred_text(&mut self) -> Option<Receipt>
fn commit_deferred_text(&mut self, text: &str) -> Option<Receipt>
fn on_external_event( &mut self, payload: &str, state: &mut Edits<'_>, root: &(dyn Any + 'static), )
fn take_focus_reset(&mut self) -> bool
fn take_accessibility_request(&mut self) -> Option<AccessibilityRequest>
fn take_app_activation(&mut self) -> Option<u64>
fn take_focus_request(&mut self) -> Option<String>
fn restore_dev_route(&mut self, route: &RouteSnapshot) -> bool
fn set_motion_reduced(&mut self, reduced: bool)
fn take_structure_dirty(&mut self) -> bool
fn dismiss_presented_modal(&mut self) -> bool
fn remount_children(&mut self, remount: &mut Remount<'_>) -> bool
fn mark_drawn(&mut self)
fn release_scene_cache(&mut self)
fn draw_overlay( &mut self, scene: &mut Scene, transform: Affine, text_renderer: &mut TextRenderer, theme: &Theme, presence: &PresenceCtx, )
fn apply_primary_vertical_scroll( &mut self, action: PrimaryScrollAction, ) -> PrimaryScrollResult
fn focus_requested(&mut self, target: Option<NodeId>, tree: &TaffyTree)
fn mount_native_views(&mut self, host: &NativeViewHost<'_>)
fn native_view_frame_start(&mut self)
fn unmount_native_views(&mut self)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
§impl Decorator for KeyboardMapSelection
impl Decorator for KeyboardMapSelection
type Inner = KeyboardMap
§impl Decorator for DateField
impl Decorator for DateField
type Inner = PopoverButton<Arranged<FlexLayout>>
§impl Decorator for DescribedActivityTimeline
A timeline is its timeline.
impl Decorator for DescribedActivityTimeline
A timeline is its timeline.
type Inner = ActivityTimeline
§impl Decorator for DescribedConversationList
A conversation is its list.
impl Decorator for DescribedConversationList
A conversation is its list.