Skip to main content

Decorator

Trait Decorator 

pub trait Decorator: Sized + 'static {
    type Inner: Widget + ?Sized;

Show 112 methods // Required methods fn inner(&self) -> &Self::Inner; fn inner_mut(&mut self) -> &mut Self::Inner; // Provided methods 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 as_any_mut(&mut self) -> Option<&mut (dyn Any + 'static)> { ... } fn take_structure_change(&mut self) -> StructureChange { ... } fn view_only_scroll(&self, _event: &WindowEvent) -> bool { ... } 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 local_resource_operation_handlers(&self) -> &'static [&'static str] { ... } fn resource_operation_handlers(&self) -> HashSet<String> { ... } fn name(&self) -> &str { ... } fn test_id(&self) -> Option<&str> { ... } 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 keeps_undo_step_open(&self) -> bool { ... } fn cursor_shape(&self, point: Point) -> Option<CursorIcon> { ... } fn claims_raw_touch(&self, point: Point) -> bool { ... } 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 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 is_enabled(&self) -> bool { ... } fn ime_requires_deferred_ack(&self) -> bool { ... } fn ime_edit_fingerprint(&self, key: &[u8; 32]) -> Option<[u8; 32]> { ... } fn ime_purpose(&self) -> Option<ImePurpose> { ... } fn ime_multiline(&self) -> bool { ... } fn presented(&self) -> bool { ... } fn opening(&self) -> bool { ... } 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 needs_idle_sync(&self) -> bool { ... } fn wants_pointer_capture(&self) -> bool { ... } fn needs_animation_frame(&self) -> bool { ... } fn next_wake_deadline(&self) -> Option<Instant> { ... } fn modal_capture(&self) -> Option<Rect> { ... } 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 semantic_readers(&self) -> &'static [RegisteredSemanticReader] { ... } fn set_platform_conventions(&mut self, conventions: PlatformConventions) { ... } fn set_interaction_environment( &mut self, environment: InteractionEnvironment, ) { ... } 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 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 take_committed_action(&mut self) -> Option<Vec<ChangeHash>> { ... } fn set_undo_status(&mut self, status: &mut dyn FnMut() -> UndoStatus) { ... } fn take_undo_request(&mut self) -> Option<UndoRequest> { ... } fn handle_local_undo_request(&mut self, request: UndoRequest) -> 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 restore_dev_route(&mut self, route: &RouteSnapshot) -> bool { ... } fn set_motion_reduced(&mut self, reduced: bool) { ... } fn apply_room_action( &mut self, doc: &mut Edits<'_>, type_id: &str, payload: &[u8], ) -> bool { ... } fn start_operation( &mut self, op: &ResourceOperation<'_>, doc: &mut Edits<'_>, path: &ExId, ) -> Result<Option<ResourceOperationStart>, String> { ... } fn poll_resource_operation( &mut self, invocation: InvocationId, cancellation_requested: bool, doc: &AutoCommit, path: &ExId, ) -> Option<InvocationUpdate> { ... } fn take_structure_dirty(&mut self) -> 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 + ?Sized

The widget this one extends.

Required Methods§

fn inner(&self) -> &Self::Inner

The extended widget.

fn inner_mut(&mut self) -> &mut Self::Inner

The extended widget, mutably.

Provided Methods§

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 as_any_mut(&mut self) -> Option<&mut (dyn Any + 'static)>

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 super::StructureChange::Rebuild; one that adds no flags forwards its inner widget’s change by overriding this.

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.

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 local_resource_operation_handlers(&self) -> &'static [&'static str]

fn resource_operation_handlers(&self) -> HashSet<String>

fn name(&self) -> &str

fn test_id(&self) -> Option<&str>

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 keeps_undo_step_open(&self) -> bool

fn cursor_shape(&self, point: Point) -> Option<CursorIcon>

fn claims_raw_touch(&self, point: Point) -> bool

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 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 is_enabled(&self) -> bool

fn ime_requires_deferred_ack(&self) -> bool

fn ime_edit_fingerprint(&self, key: &[u8; 32]) -> Option<[u8; 32]>

fn ime_purpose(&self) -> Option<ImePurpose>

fn ime_multiline(&self) -> bool

fn presented(&self) -> bool

fn opening(&self) -> bool

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 needs_idle_sync(&self) -> bool

fn wants_pointer_capture(&self) -> bool

fn needs_animation_frame(&self) -> bool

fn next_wake_deadline(&self) -> Option<Instant>

fn modal_capture(&self) -> Option<Rect>

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 semantic_readers(&self) -> &'static [RegisteredSemanticReader]

fn set_platform_conventions(&mut self, conventions: PlatformConventions)

fn set_interaction_environment(&mut self, environment: InteractionEnvironment)

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 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 take_committed_action(&mut self) -> Option<Vec<ChangeHash>>

fn set_undo_status(&mut self, status: &mut dyn FnMut() -> UndoStatus)

fn take_undo_request(&mut self) -> Option<UndoRequest>

fn handle_local_undo_request(&mut self, request: UndoRequest) -> 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 restore_dev_route(&mut self, route: &RouteSnapshot) -> bool

fn set_motion_reduced(&mut self, reduced: bool)

fn apply_room_action( &mut self, doc: &mut Edits<'_>, type_id: &str, payload: &[u8], ) -> bool

fn start_operation( &mut self, op: &ResourceOperation<'_>, doc: &mut Edits<'_>, path: &ExId, ) -> Result<Option<ResourceOperationStart>, String>

fn poll_resource_operation( &mut self, invocation: InvocationId, cancellation_requested: bool, doc: &AutoCommit, path: &ExId, ) -> Option<InvocationUpdate>

fn take_structure_dirty(&mut self) -> 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 NavList

§

type Inner = TreeView<(), NavModel>

§

impl Decorator for ContextMenuArea

§

type Inner = dyn Widget

§

impl Decorator for ControlRow

§

type Inner = Row

§

impl Decorator for MenuButton

§

impl Decorator for Slot

§

type Inner = dyn Widget

§

impl Decorator for When

§

type Inner = dyn Widget

§

impl<K> Decorator for Switch<K>
where K: PartialEq + 'static,

§

type Inner = dyn Widget

Source§

impl<W: EditsText + 'static, R: Resource> Decorator for TextControl<W, R>

Source§

type Inner = W