pub struct AppShell<R>where
R: Renderer,{ /* private fields */ }Implementations§
Source§impl<R> AppShell<R>
impl<R> AppShell<R>
pub fn new(renderer: R, root_key: Key, content: impl FnMut() + 'static) -> Self
Sourcepub fn set_dev_options(&mut self, options: DevOptions)
pub fn set_dev_options(&mut self, options: DevOptions)
Set development options for debugging and performance monitoring.
The FPS counter and other overlays are rendered directly by the renderer (not via composition) to avoid affecting performance measurements.
Sourcepub fn dev_options(&self) -> &DevOptions
pub fn dev_options(&self) -> &DevOptions
Get a reference to the current dev options.
pub fn set_viewport(&mut self, width: f32, height: f32)
pub fn set_buffer_size(&mut self, width: u32, height: u32)
pub fn buffer_size(&self) -> (u32, u32)
pub fn scene(&self) -> &R::Scene
pub fn renderer(&mut self) -> &mut R
pub fn set_frame_waker(&mut self, waker: impl Fn() + Send + Sync + 'static)
pub fn clear_frame_waker(&mut self)
pub fn should_render(&self) -> bool
Sourcepub fn needs_redraw(&self) -> bool
pub fn needs_redraw(&self) -> bool
Returns true if the shell needs to redraw (dirty flag, layout dirty, active animations). Note: Cursor blink is now timer-based and uses WaitUntil scheduling, not continuous redraw.
Sourcepub fn mark_dirty(&mut self)
pub fn mark_dirty(&mut self)
Marks the shell as dirty, indicating a redraw is needed.
Sourcepub fn has_active_animations(&self) -> bool
pub fn has_active_animations(&self) -> bool
Returns true if there are active animations or pending recompositions.
Sourcepub fn next_event_time(&self) -> Option<Instant>
pub fn next_event_time(&self) -> Option<Instant>
Returns the next scheduled event time for cursor blink.
Use this for ControlFlow::WaitUntil scheduling.
pub fn update(&mut self)
pub fn set_cursor(&mut self, x: f32, y: f32) -> bool
pub fn pointer_pressed(&mut self) -> bool
pub fn pointer_released(&mut self) -> bool
Sourcepub fn cancel_gesture(&mut self)
pub fn cancel_gesture(&mut self)
Cancels any active gesture, dispatching Cancel events to cached targets. Call this when:
- Window loses focus
- Mouse leaves window while button pressed
- Any other gesture abort scenario
Sourcepub fn on_key_event(&mut self, event: &KeyEvent) -> bool
pub fn on_key_event(&mut self, event: &KeyEvent) -> bool
Routes a keyboard event to the focused text field, if any.
Returns true if the event was consumed by a text field.
On desktop, Ctrl+C/X/V are handled here with system clipboard (arboard). On web, these keys are NOT handled here - they bubble to browser for native copy/paste events.
Sourcepub fn on_paste(&mut self, text: &str) -> bool
pub fn on_paste(&mut self, text: &str) -> bool
Handles paste event from platform clipboard.
Returns true if the paste was consumed by a focused text field.
O(1) operation using stored handler.
Sourcepub fn on_copy(&mut self) -> Option<String>
pub fn on_copy(&mut self) -> Option<String>
Handles copy request from platform. Returns the selected text from focused text field, or None. O(1) operation using stored handler.
Sourcepub fn on_cut(&mut self) -> Option<String>
pub fn on_cut(&mut self) -> Option<String>
Handles cut request from platform. Returns the cut text from focused text field, or None. O(1) operation using stored handler.
Sourcepub fn set_primary_selection(&mut self, text: &str)
pub fn set_primary_selection(&mut self, text: &str)
Sets the Linux primary selection (for middle-click paste). This is called when text is selected in a text field. On non-Linux platforms, this is a no-op.
Sourcepub fn get_primary_selection(&mut self) -> Option<String>
pub fn get_primary_selection(&mut self) -> Option<String>
Gets text from the Linux primary selection (for middle-click paste). On non-Linux platforms, returns None.
Sourcepub fn sync_selection_to_primary(&mut self)
pub fn sync_selection_to_primary(&mut self)
Syncs the current text field selection to PRIMARY (Linux X11). Call this when selection changes in a text field.
Sourcepub fn on_ime_preedit(
&mut self,
text: &str,
cursor: Option<(usize, usize)>,
) -> bool
pub fn on_ime_preedit( &mut self, text: &str, cursor: Option<(usize, usize)>, ) -> bool
Handles IME preedit (composition) events. Called when the input method is composing text (e.g., typing CJK characters).
text: The current preedit text (empty to clear composition state)cursor: Optional cursor position within the preedit text (start, end)
Returns true if a text field consumed the event.
Sourcepub fn on_ime_delete_surrounding(
&mut self,
before_bytes: usize,
after_bytes: usize,
) -> bool
pub fn on_ime_delete_surrounding( &mut self, before_bytes: usize, after_bytes: usize, ) -> bool
Handles IME delete-surrounding events.
Returns true if a text field consumed the event.
pub fn log_debug_info(&mut self)
Sourcepub fn layout_tree(&self) -> Option<&LayoutTree>
pub fn layout_tree(&self) -> Option<&LayoutTree>
Get the current layout tree (for robot/testing)
Sourcepub fn semantics_tree(&self) -> Option<&SemanticsTree>
pub fn semantics_tree(&self) -> Option<&SemanticsTree>
Get the current semantics tree (for robot/testing)