pub struct CallbackInfo { /* private fields */ }Expand description
CallbackInfo is a lightweight wrapper around pointers to stack-local data. It can be safely copied because it only contains pointers - the underlying data lives on the stack and outlives the callback invocation. This allows callbacks to “consume” CallbackInfo by value while the caller retains access to the same underlying data.
The changes field uses a pointer to Arc<Mutex<…>> so that cloned CallbackInfo instances
(e.g., passed to timer callbacks) still push changes to the original collection,
while keeping CallbackInfo as Copy.
Implementations§
Source§impl CallbackInfo
impl CallbackInfo
pub fn new<'a>( ref_data: &'a CallbackInfoRefData<'a>, changes: &'a Arc<Mutex<Vec<CallbackChange>>>, hit_dom_node: DomNodeId, cursor_relative_to_item: OptionLogicalPosition, cursor_in_viewport: OptionLogicalPosition, ) -> Self
Sourcepub fn get_ctx(&self) -> OptionRefAny
pub fn get_ctx(&self) -> OptionRefAny
Get the callable for FFI language bindings (Python, etc.)
Returns the cloned OptionRefAny if a callable was set, or None if this is a native Rust callback.
Sourcepub fn get_gl_context(&self) -> OptionGlContextPtr
pub fn get_gl_context(&self) -> OptionGlContextPtr
Returns the OpenGL context if available
Sourcepub fn push_change(&mut self, change: CallbackChange)
pub fn push_change(&mut self, change: CallbackChange)
Push a change to be applied after the callback returns This is the primary method for modifying window state from callbacks
Sourcepub fn get_changes_ptr(&self) -> *const ()
pub fn get_changes_ptr(&self) -> *const ()
Debug helper to get the changes pointer for debugging
Sourcepub fn take_changes(&self) -> Vec<CallbackChange>
pub fn take_changes(&self) -> Vec<CallbackChange>
Get the collected changes (consumes them from the Arc
Sourcepub fn add_timer(&mut self, timer_id: TimerId, timer: Timer)
pub fn add_timer(&mut self, timer_id: TimerId, timer: Timer)
Add a timer to this window (applied after callback returns)
Sourcepub fn remove_timer(&mut self, timer_id: TimerId)
pub fn remove_timer(&mut self, timer_id: TimerId)
Remove a timer from this window (applied after callback returns)
Sourcepub fn add_thread(&mut self, thread_id: ThreadId, thread: Thread)
pub fn add_thread(&mut self, thread_id: ThreadId, thread: Thread)
Add a thread to this window (applied after callback returns)
Sourcepub fn remove_thread(&mut self, thread_id: ThreadId)
pub fn remove_thread(&mut self, thread_id: ThreadId)
Remove a thread from this window (applied after callback returns)
Sourcepub fn stop_propagation(&mut self)
pub fn stop_propagation(&mut self)
Stop event propagation (applied after callback returns)
Sourcepub fn set_focus(&mut self, target: FocusTarget)
pub fn set_focus(&mut self, target: FocusTarget)
Set keyboard focus target (applied after callback returns)
Sourcepub fn create_window(&mut self, options: WindowCreateOptions)
pub fn create_window(&mut self, options: WindowCreateOptions)
Create a new window (applied after callback returns)
Sourcepub fn close_window(&mut self)
pub fn close_window(&mut self)
Close the current window (applied after callback returns)
Sourcepub fn modify_window_state(&mut self, state: FullWindowState)
pub fn modify_window_state(&mut self, state: FullWindowState)
Modify the window state (applied after callback returns)
Sourcepub fn queue_window_state_sequence(&mut self, states: Vec<FullWindowState>)
pub fn queue_window_state_sequence(&mut self, states: Vec<FullWindowState>)
Queue multiple window state changes to be applied in sequence. Each state triggers a separate event processing cycle, which is needed for simulating clicks where mouse down and mouse up must be separate events.
Sourcepub fn change_node_text(&mut self, node_id: DomNodeId, text: AzString)
pub fn change_node_text(&mut self, node_id: DomNodeId, text: AzString)
Change the text content of a node (applied after callback returns)
This method was previously called set_string_contents in older API versions.
§Arguments
node_id- The text node to modify (DomNodeId containing both DOM and node IDs)text- The new text content
Sourcepub fn change_node_image(
&mut self,
dom_id: DomId,
node_id: NodeId,
image: ImageRef,
update_type: UpdateImageType,
)
pub fn change_node_image( &mut self, dom_id: DomId, node_id: NodeId, image: ImageRef, update_type: UpdateImageType, )
Change the image of a node (applied after callback returns)
Sourcepub fn update_image_callback(&mut self, dom_id: DomId, node_id: NodeId)
pub fn update_image_callback(&mut self, dom_id: DomId, node_id: NodeId)
Re-render an image callback (for resize/animation updates)
This triggers re-invocation of the RenderImageCallback associated with the node. Useful for:
- Responding to window resize (image needs to match new size)
- Animation frames (update OpenGL texture each frame)
- Interactive content (user input changes rendering)
Sourcepub fn trigger_iframe_rerender(&mut self, dom_id: DomId, node_id: NodeId)
pub fn trigger_iframe_rerender(&mut self, dom_id: DomId, node_id: NodeId)
Trigger re-rendering of an IFrame (applied after callback returns)
This forces the IFrame to call its layout callback with reason DomRecreated
and submit a new display list to WebRender. The IFrame’s pipeline will be updated
without affecting other parts of the window.
Useful for:
- Live preview panes (update when source code changes)
- Dynamic content that needs manual refresh
- Editor previews (re-parse and display new DOM)
Sourcepub fn get_node_id_by_id_attribute(
&self,
dom_id: DomId,
id: &str,
) -> Option<NodeId>
pub fn get_node_id_by_id_attribute( &self, dom_id: DomId, id: &str, ) -> Option<NodeId>
Find a node by ID attribute in the layout tree
Returns the NodeId of the first node with the given ID attribute, or None if not found.
Sourcepub fn get_parent_node(&self, dom_id: DomId, node_id: NodeId) -> Option<NodeId>
pub fn get_parent_node(&self, dom_id: DomId, node_id: NodeId) -> Option<NodeId>
Get the parent node of the given node
Returns None if the node has no parent (i.e., it’s the root node)
Sourcepub fn get_next_sibling_node(
&self,
dom_id: DomId,
node_id: NodeId,
) -> Option<NodeId>
pub fn get_next_sibling_node( &self, dom_id: DomId, node_id: NodeId, ) -> Option<NodeId>
Get the next sibling of the given node
Returns None if the node has no next sibling
Sourcepub fn get_previous_sibling_node(
&self,
dom_id: DomId,
node_id: NodeId,
) -> Option<NodeId>
pub fn get_previous_sibling_node( &self, dom_id: DomId, node_id: NodeId, ) -> Option<NodeId>
Get the previous sibling of the given node
Returns None if the node has no previous sibling
Sourcepub fn get_first_child_node(
&self,
dom_id: DomId,
node_id: NodeId,
) -> Option<NodeId>
pub fn get_first_child_node( &self, dom_id: DomId, node_id: NodeId, ) -> Option<NodeId>
Get the first child of the given node
Returns None if the node has no children
Sourcepub fn get_last_child_node(
&self,
dom_id: DomId,
node_id: NodeId,
) -> Option<NodeId>
pub fn get_last_child_node( &self, dom_id: DomId, node_id: NodeId, ) -> Option<NodeId>
Get the last child of the given node
Returns None if the node has no children
Sourcepub fn get_all_children_nodes(
&self,
dom_id: DomId,
node_id: NodeId,
) -> NodeIdVec
pub fn get_all_children_nodes( &self, dom_id: DomId, node_id: NodeId, ) -> NodeIdVec
Get all direct children of the given node
Returns an empty vector if the node has no children. Uses the contiguous node layout for efficient iteration.
Sourcepub fn get_children_count(&self, dom_id: DomId, node_id: NodeId) -> usize
pub fn get_children_count(&self, dom_id: DomId, node_id: NodeId) -> usize
Get the number of direct children of the given node
Uses the contiguous node layout for efficient counting.
Sourcepub fn change_node_image_mask(
&mut self,
dom_id: DomId,
node_id: NodeId,
mask: ImageMask,
)
pub fn change_node_image_mask( &mut self, dom_id: DomId, node_id: NodeId, mask: ImageMask, )
Change the image mask of a node (applied after callback returns)
Sourcepub fn change_node_css_properties(
&mut self,
dom_id: DomId,
node_id: NodeId,
properties: CssPropertyVec,
)
pub fn change_node_css_properties( &mut self, dom_id: DomId, node_id: NodeId, properties: CssPropertyVec, )
Change CSS properties of a node (applied after callback returns)
Sourcepub fn set_css_property(&mut self, node_id: DomNodeId, property: CssProperty)
pub fn set_css_property(&mut self, node_id: DomNodeId, property: CssProperty)
Set a single CSS property on a node (convenience method for widgets)
This is a helper method that wraps change_node_css_properties for the common case
of setting a single property. It uses the hit node’s DOM ID automatically.
§Arguments
node_id- The node to set the property on (uses hit node’s DOM ID)property- The CSS property to set
Sourcepub fn scroll_to(
&mut self,
dom_id: DomId,
node_id: NodeHierarchyItemId,
position: LogicalPosition,
)
pub fn scroll_to( &mut self, dom_id: DomId, node_id: NodeHierarchyItemId, position: LogicalPosition, )
Scroll a node to a specific position (applied after callback returns)
Sourcepub fn scroll_node_into_view(
&mut self,
node_id: DomNodeId,
options: ScrollIntoViewOptions,
)
pub fn scroll_node_into_view( &mut self, node_id: DomNodeId, options: ScrollIntoViewOptions, )
Scroll a node into view (W3C scrollIntoView API)
Scrolls the element into the visible area of its scroll container. This is the recommended way to programmatically scroll elements into view.
§Arguments
node_id- The node to scroll into viewoptions- Scroll alignment and animation options
§Note
This uses the transactional change system - the scroll is queued and applied after the callback returns. The actual scroll adjustments are calculated during change processing.
Sourcepub fn add_image_to_cache(&mut self, id: AzString, image: ImageRef)
pub fn add_image_to_cache(&mut self, id: AzString, image: ImageRef)
Add an image to the image cache (applied after callback returns)
Sourcepub fn remove_image_from_cache(&mut self, id: AzString)
pub fn remove_image_from_cache(&mut self, id: AzString)
Remove an image from the image cache (applied after callback returns)
Sourcepub fn reload_system_fonts(&mut self)
pub fn reload_system_fonts(&mut self)
Reload system fonts (applied after callback returns)
Note: This is an expensive operation that rebuilds the entire font cache
Sourcepub fn get_text_changeset(&self) -> Option<&PendingTextEdit>
pub fn get_text_changeset(&self) -> Option<&PendingTextEdit>
Get the current text changeset being processed (if any)
This allows callbacks to inspect what text input is about to be applied. Returns None if no text input is currently being processed.
Use set_text_changeset() to modify the text that will be inserted,
and prevent_default() to block the text input entirely.
Sourcepub fn set_text_changeset(&mut self, changeset: PendingTextEdit)
pub fn set_text_changeset(&mut self, changeset: PendingTextEdit)
Set/override the text changeset for the current text input operation
This allows you to modify what text will be inserted during text input events.
Typically used in combination with prevent_default() to transform user input.
§Arguments
changeset- The modified text changeset to apply
Sourcepub fn create_text_input(&mut self, text: AzString)
pub fn create_text_input(&mut self, text: AzString)
Create a synthetic text input event
This simulates receiving text input from the OS. Use this to programmatically insert text into contenteditable elements, for example from the debug server or from accessibility APIs.
The text input flow will:
- Record the text in TextInputManager (creating a PendingTextEdit)
- Generate synthetic TextInput events
- Invoke user callbacks (which can intercept/reject via preventDefault)
- Apply the changeset if not rejected
- Mark dirty nodes for re-render
§Arguments
text- The text to insert at the current cursor position
Sourcepub fn prevent_default(&mut self)
pub fn prevent_default(&mut self)
Prevent the default text input from being applied
When called in a TextInput callback, prevents the typed text from being inserted. Useful for custom validation, filtering, or text transformation.
Sourcepub fn set_cursor_visibility(&mut self, visible: bool)
pub fn set_cursor_visibility(&mut self, visible: bool)
Set cursor visibility state
This is primarily used internally by the cursor blink timer callback. User code typically doesn’t need to call this directly.
Sourcepub fn reset_cursor_blink(&mut self)
pub fn reset_cursor_blink(&mut self)
Reset cursor blink state on user input
This makes the cursor visible and records the current time, so the blink timer knows to keep the cursor solid for a while before blinking. Called automatically on keyboard input, but can be called manually.
Sourcepub fn start_cursor_blink_timer(&mut self)
pub fn start_cursor_blink_timer(&mut self)
Start the cursor blink timer
Called automatically when focus lands on a contenteditable element. The timer will toggle cursor visibility at ~530ms intervals.
Sourcepub fn stop_cursor_blink_timer(&mut self)
pub fn stop_cursor_blink_timer(&mut self)
Stop the cursor blink timer
Called automatically when focus leaves a contenteditable element.
Sourcepub fn scroll_active_cursor_into_view(&mut self)
pub fn scroll_active_cursor_into_view(&mut self)
Scroll the active cursor into view
This scrolls the focused text element’s cursor into the visible area of any scrollable ancestor. Called automatically after text input.
Open a menu (context menu or dropdown)
The menu will be displayed either as a native menu or a fallback DOM-based menu
depending on the window’s use_native_context_menus flag.
Uses the position specified in the menu itself.
§Arguments
menu- The menu to display
Open a menu at a specific position
§Arguments
menu- The menu to displayposition- The position where the menu should appear (overrides menu’s position)
Sourcepub fn show_tooltip(&mut self, text: AzString)
pub fn show_tooltip(&mut self, text: AzString)
Show a tooltip at the current cursor position
Displays a simple text tooltip near the mouse cursor. The tooltip will be shown using platform-specific native APIs where available.
Platform implementations:
- Windows: Uses
TOOLTIPS_CLASSWin32 control - macOS: Uses
NSPopoveror customNSWindowwith tooltip styling - X11: Creates transient window with
_NET_WM_WINDOW_TYPE_TOOLTIP - Wayland: Uses
zwlr_layer_shell_v1with overlay layer
§Arguments
text- The tooltip text to display
Sourcepub fn show_tooltip_at(&mut self, text: AzString, position: LogicalPosition)
pub fn show_tooltip_at(&mut self, text: AzString, position: LogicalPosition)
Show a tooltip at a specific position
§Arguments
text- The tooltip text to displayposition- The position where the tooltip should appear (in window coordinates)
Sourcepub fn hide_tooltip(&mut self)
pub fn hide_tooltip(&mut self)
Hide the currently displayed tooltip
Sourcepub fn insert_text(&mut self, dom_id: DomId, node_id: NodeId, text: AzString)
pub fn insert_text(&mut self, dom_id: DomId, node_id: NodeId, text: AzString)
Insert text at the current cursor position in a text node
This operation is transactional - the text will be inserted after the callback returns. If there’s a selection, it will be replaced with the inserted text.
§Arguments
dom_id- The DOM containing the text nodenode_id- The node to insert text intotext- The text to insert
Sourcepub fn move_cursor(
&mut self,
dom_id: DomId,
node_id: NodeId,
cursor: TextCursor,
)
pub fn move_cursor( &mut self, dom_id: DomId, node_id: NodeId, cursor: TextCursor, )
Move the text cursor to a specific position
§Arguments
dom_id- The DOM containing the text nodenode_id- The node containing the cursorcursor- The new cursor position
Sourcepub fn set_selection(
&mut self,
dom_id: DomId,
node_id: NodeId,
selection: Selection,
)
pub fn set_selection( &mut self, dom_id: DomId, node_id: NodeId, selection: Selection, )
Set the text selection range
§Arguments
dom_id- The DOM containing the text nodenode_id- The node containing the selectionselection- The new selection (can be a cursor or range)
Open a menu positioned relative to a specific DOM node
This is useful for dropdowns, combo boxes, and context menus that should appear near a specific UI element. The menu will be positioned below the node by default.
§Arguments
menu- The menu to displaynode_id- The DOM node to position the menu relative to
§Returns
trueif the menu was queued for openingfalseif the node doesn’t exist or has no layout information
Open a menu positioned relative to the currently hit node
Convenience method for opening a menu at the element that triggered the callback.
Equivalent to open_menu_for_node(menu, info.get_hit_node()).
§Arguments
menu- The menu to display
§Returns
trueif the menu was queued for openingfalseif no node is currently hit or it has no layout information
Sourcepub fn get_layout_window(&self) -> &LayoutWindow
pub fn get_layout_window(&self) -> &LayoutWindow
Get reference to the underlying LayoutWindow for queries
This provides read-only access to layout data, node hierarchies, managers, etc. All modifications should go through CallbackChange transactions via push_change().
pub fn get_node_size(&self, node_id: DomNodeId) -> Option<LogicalSize>
pub fn get_node_position(&self, node_id: DomNodeId) -> Option<LogicalPosition>
Sourcepub fn get_node_hit_test_bounds(
&self,
node_id: DomNodeId,
) -> Option<LogicalRect>
pub fn get_node_hit_test_bounds( &self, node_id: DomNodeId, ) -> Option<LogicalRect>
Get the hit test bounds of a node from the display list
This is more reliable than get_node_rect because the display list always contains the correct final rendered positions.
Sourcepub fn get_node_rect(&self, node_id: DomNodeId) -> Option<LogicalRect>
pub fn get_node_rect(&self, node_id: DomNodeId) -> Option<LogicalRect>
Get the bounding rectangle of a node (position + size)
This is particularly useful for menu positioning, where you need to know where a UI element is to popup a menu relative to it.
Sourcepub fn get_hit_node_rect(&self) -> Option<LogicalRect>
pub fn get_hit_node_rect(&self) -> Option<LogicalRect>
Get the bounding rectangle of the hit node
Convenience method that combines get_hit_node() and get_node_rect(). Useful for menu positioning based on the clicked element.
Sourcepub fn get_timer_ids(&self) -> TimerIdVec
pub fn get_timer_ids(&self) -> TimerIdVec
Get all timer IDs
Sourcepub fn get_thread(&self, thread_id: &ThreadId) -> Option<&Thread>
pub fn get_thread(&self, thread_id: &ThreadId) -> Option<&Thread>
Get a reference to a thread
Sourcepub fn get_thread_ids(&self) -> ThreadIdVec
pub fn get_thread_ids(&self) -> ThreadIdVec
Get all thread IDs
Sourcepub fn get_gpu_cache(&self, dom_id: &DomId) -> Option<&GpuValueCache>
pub fn get_gpu_cache(&self, dom_id: &DomId) -> Option<&GpuValueCache>
Get the GPU value cache for a specific DOM
Sourcepub fn get_layout_result(&self, dom_id: &DomId) -> Option<&DomLayoutResult>
pub fn get_layout_result(&self, dom_id: &DomId) -> Option<&DomLayoutResult>
Get a layout result for a specific DOM
Sourcepub fn get_dom_ids(&self) -> DomIdVec
pub fn get_dom_ids(&self) -> DomIdVec
Get all DOM IDs that have layout results
pub fn get_hit_node(&self) -> DomNodeId
pub fn get_parent(&self, node_id: DomNodeId) -> Option<DomNodeId>
pub fn get_previous_sibling(&self, node_id: DomNodeId) -> Option<DomNodeId>
pub fn get_next_sibling(&self, node_id: DomNodeId) -> Option<DomNodeId>
pub fn get_first_child(&self, node_id: DomNodeId) -> Option<DomNodeId>
pub fn get_last_child(&self, node_id: DomNodeId) -> Option<DomNodeId>
pub fn get_dataset(&mut self, node_id: DomNodeId) -> Option<RefAny>
pub fn get_node_id_of_root_dataset( &mut self, search_key: RefAny, ) -> Option<DomNodeId>
pub fn get_string_contents(&self, node_id: DomNodeId) -> Option<AzString>
Sourcepub fn get_node_tag_name(&self, node_id: DomNodeId) -> Option<AzString>
pub fn get_node_tag_name(&self, node_id: DomNodeId) -> Option<AzString>
Get the tag name of a node (e.g., “div”, “p”, “span”)
Returns the HTML tag name as a string for the given node. For text nodes, returns “text”. For image nodes, returns “img”.
Sourcepub fn get_node_attribute(
&self,
node_id: DomNodeId,
attr_name: &str,
) -> Option<AzString>
pub fn get_node_attribute( &self, node_id: DomNodeId, attr_name: &str, ) -> Option<AzString>
Get an attribute value from a node by attribute name
§Arguments
node_id- The node to queryattr_name- The attribute name (e.g., “id”, “class”, “href”, “data-custom”, “aria-label”)
Returns the attribute value if found, None otherwise. This searches the strongly-typed AttributeVec on the node.
Sourcepub fn get_node_classes(&self, node_id: DomNodeId) -> StringVec
pub fn get_node_classes(&self, node_id: DomNodeId) -> StringVec
Get all classes of a node as a vector of strings
Sourcepub fn get_node_id(&self, node_id: DomNodeId) -> Option<AzString>
pub fn get_node_id(&self, node_id: DomNodeId) -> Option<AzString>
Get the ID attribute of a node (if it has one)
Sourcepub fn get_selection(&self, dom_id: &DomId) -> Option<&SelectionState>
pub fn get_selection(&self, dom_id: &DomId) -> Option<&SelectionState>
Get the current selection state for a DOM
Sourcepub fn has_selection(&self, dom_id: &DomId) -> bool
pub fn has_selection(&self, dom_id: &DomId) -> bool
Check if a DOM has any selection
Sourcepub fn get_primary_cursor(&self, dom_id: &DomId) -> Option<TextCursor>
pub fn get_primary_cursor(&self, dom_id: &DomId) -> Option<TextCursor>
Get the primary cursor for a DOM (first in selection list)
Sourcepub fn get_selection_ranges(&self, dom_id: &DomId) -> SelectionRangeVec
pub fn get_selection_ranges(&self, dom_id: &DomId) -> SelectionRangeVec
Get all selection ranges (excludes plain cursors)
Sourcepub fn get_text_cache(&self) -> &TextLayoutCache
pub fn get_text_cache(&self) -> &TextLayoutCache
Get direct access to the text layout cache
Note: This provides direct read-only access to the text layout cache, but you need to know the CacheId for the specific text node you want. Currently there’s no direct mapping from NodeId to CacheId exposed in the public API.
For text modifications, use CallbackChange transactions:
change_node_text()for changing text contentset_selection()for setting selectionsget_selection(),get_primary_cursor()for reading selections
Future: Add NodeId -> CacheId mapping to enable node-specific layout access
Sourcepub fn get_current_window_state(&self) -> &FullWindowState
pub fn get_current_window_state(&self) -> &FullWindowState
Get full current window state (immutable reference)
Sourcepub fn get_current_window_flags(&self) -> WindowFlags
pub fn get_current_window_flags(&self) -> WindowFlags
Get current window flags
Sourcepub fn get_current_keyboard_state(&self) -> KeyboardState
pub fn get_current_keyboard_state(&self) -> KeyboardState
Get current keyboard state
Sourcepub fn get_current_mouse_state(&self) -> MouseState
pub fn get_current_mouse_state(&self) -> MouseState
Get current mouse state
Sourcepub fn get_previous_window_state(&self) -> &Option<FullWindowState>
pub fn get_previous_window_state(&self) -> &Option<FullWindowState>
Get full previous window state (immutable reference)
Sourcepub fn get_previous_window_flags(&self) -> Option<WindowFlags>
pub fn get_previous_window_flags(&self) -> Option<WindowFlags>
Get previous window flags
Sourcepub fn get_previous_keyboard_state(&self) -> Option<KeyboardState>
pub fn get_previous_keyboard_state(&self) -> Option<KeyboardState>
Get previous keyboard state
Sourcepub fn get_previous_mouse_state(&self) -> Option<MouseState>
pub fn get_previous_mouse_state(&self) -> Option<MouseState>
Get previous mouse state
pub fn get_cursor_relative_to_node(&self) -> OptionLogicalPosition
pub fn get_cursor_relative_to_viewport(&self) -> OptionLogicalPosition
pub fn get_current_window_handle(&self) -> RawWindowHandle
Sourcepub fn get_system_style(&self) -> Arc<SystemStyle>
pub fn get_system_style(&self) -> Arc<SystemStyle>
Get the system style (for menu rendering, CSD, etc.) This is useful for creating custom menus or other system-styled UI.
Sourcepub fn get_cursor_position(&self) -> Option<LogicalPosition>
pub fn get_cursor_position(&self) -> Option<LogicalPosition>
Get the current cursor position in logical coordinates relative to the window
Sourcepub fn get_hit_node_layout_rect(&self) -> Option<LogicalRect>
pub fn get_hit_node_layout_rect(&self) -> Option<LogicalRect>
Get the layout rectangle of the currently hit node (in logical coordinates)
Sourcepub fn get_computed_css_property(
&self,
node_id: DomNodeId,
property_type: CssPropertyType,
) -> Option<CssProperty>
pub fn get_computed_css_property( &self, node_id: DomNodeId, property_type: CssPropertyType, ) -> Option<CssProperty>
Get the computed CSS property for a specific DOM node
This queries the CSS property cache and returns the resolved property value for the given node, taking into account:
- User overrides (from callbacks)
- Node state (:hover, :active, :focus)
- CSS rules from stylesheets
- Cascaded properties from parents
- Inline styles
§Arguments
node_id- The DOM node to queryproperty_type- The CSS property type to retrieve
§Returns
Some(CssProperty)if the property is set on this nodeNoneif the property is not set (will use default value)
Sourcepub fn get_computed_width(&self, node_id: DomNodeId) -> Option<CssProperty>
pub fn get_computed_width(&self, node_id: DomNodeId) -> Option<CssProperty>
Get the computed width of a node from CSS
Convenience method for getting the CSS width property.
Sourcepub fn get_computed_height(&self, node_id: DomNodeId) -> Option<CssProperty>
pub fn get_computed_height(&self, node_id: DomNodeId) -> Option<CssProperty>
Get the computed height of a node from CSS
Convenience method for getting the CSS height property.
pub fn get_system_time_fn(&self) -> GetSystemTimeCallback
pub fn get_current_time(&self) -> Instant
Sourcepub fn get_renderer_resources(&self) -> &RendererResources
pub fn get_renderer_resources(&self) -> &RendererResources
Get immutable reference to the renderer resources
This provides access to fonts, images, and other rendering resources. Useful for custom rendering or screenshot functionality.
Sourcepub fn take_screenshot(&self, dom_id: DomId) -> Result<Vec<u8>, AzString>
pub fn take_screenshot(&self, dom_id: DomId) -> Result<Vec<u8>, AzString>
Take a CPU-rendered screenshot of the current window content
This renders the current display list to a PNG image using CPU rendering. The screenshot captures the window content as it would appear on screen, without window decorations.
§Arguments
dom_id- The DOM to screenshot (use the main DOM ID for the full window)
§Returns
Ok(Vec<u8>)- PNG-encoded image dataErr(String)- Error message if rendering failed
§Example
fn on_click(info: &mut CallbackInfo) -> Update {
let dom_id = info.get_hit_node().dom;
match info.take_screenshot(dom_id) {
Ok(png_data) => {
std::fs::write("screenshot.png", png_data).unwrap();
}
Err(e) => eprintln!("Screenshot failed: {}", e),
}
Update::DoNothing
}Sourcepub fn take_screenshot_to_file(
&self,
dom_id: DomId,
path: &str,
) -> Result<(), AzString>
pub fn take_screenshot_to_file( &self, dom_id: DomId, path: &str, ) -> Result<(), AzString>
Take a screenshot and save it directly to a file
Convenience method that combines take_screenshot with file writing.
§Arguments
dom_id- The DOM to screenshotpath- The file path to save the PNG to
§Returns
Ok(())- Screenshot saved successfullyErr(String)- Error message if rendering or saving failed
Sourcepub fn take_native_screenshot(&self, _path: &str) -> Result<(), AzString>
pub fn take_native_screenshot(&self, _path: &str) -> Result<(), AzString>
Take a native OS-level screenshot of the window including window decorations
NOTE: This is a stub implementation. For full native screenshot support,
use the NativeScreenshotExt trait from the azul-dll crate, which uses
runtime dynamic loading (dlopen) to avoid static linking dependencies.
§Returns
Err(String)- Always returns an error directing to use the extension trait
Sourcepub fn take_native_screenshot_bytes(&self) -> Result<Vec<u8>, AzString>
pub fn take_native_screenshot_bytes(&self) -> Result<Vec<u8>, AzString>
Take a native OS-level screenshot and return the PNG data as bytes
NOTE: This is a stub implementation. For full native screenshot support,
use the NativeScreenshotExt trait from the azul-dll crate.
§Returns
Ok(Vec<u8>)- PNG-encoded image dataErr(String)- Error message if screenshot failed
Sourcepub fn take_native_screenshot_base64(&self) -> Result<AzString, AzString>
pub fn take_native_screenshot_base64(&self) -> Result<AzString, AzString>
Take a native OS-level screenshot and return as a Base64 data URI
Returns the screenshot as a “data:image/png;base64,…” string that can be directly used in HTML img tags or JSON responses.
§Returns
Ok(String)- Base64 data URI stringErr(String)- Error message if screenshot failed
Sourcepub fn take_screenshot_base64(
&self,
dom_id: DomId,
) -> Result<AzString, AzString>
pub fn take_screenshot_base64( &self, dom_id: DomId, ) -> Result<AzString, AzString>
Take a CPU-rendered screenshot and return as a Base64 data URI
Returns the screenshot as a “data:image/png;base64,…” string. This is the software-rendered version without window decorations.
§Returns
Ok(String)- Base64 data URI stringErr(String)- Error message if rendering failed
Sourcepub fn get_scroll_manager(&self) -> &ScrollManager
pub fn get_scroll_manager(&self) -> &ScrollManager
Get immutable reference to the scroll manager
Use this to query scroll state for nodes without modifying it.
To request programmatic scrolling, use nodes_scrolled_in_callback.
Sourcepub fn get_gesture_drag_manager(&self) -> &GestureAndDragManager
pub fn get_gesture_drag_manager(&self) -> &GestureAndDragManager
Get immutable reference to the gesture and drag manager
Use this to query current gesture/drag state (e.g., “is this node being dragged?”, “what files are being dropped?”, “is a long-press active?”).
The manager is updated by the event loop and provides read-only query access to callbacks for gesture-aware UI behavior.
Sourcepub fn get_focus_manager(&self) -> &FocusManager
pub fn get_focus_manager(&self) -> &FocusManager
Get immutable reference to the focus manager
Use this to query which node currently has focus and whether focus is being moved to another node.
Sourcepub fn get_undo_redo_manager(&self) -> &UndoRedoManager
pub fn get_undo_redo_manager(&self) -> &UndoRedoManager
Get a reference to the undo/redo manager
This allows user callbacks to query the undo/redo state and intercept undo/redo operations via preventDefault().
Sourcepub fn get_hover_manager(&self) -> &HoverManager
pub fn get_hover_manager(&self) -> &HoverManager
Get immutable reference to the hover manager
Use this to query which nodes are currently hovered at various input points (mouse, touch points, pen).
Sourcepub fn get_text_input_manager(&self) -> &TextInputManager
pub fn get_text_input_manager(&self) -> &TextInputManager
Get immutable reference to the text input manager
Use this to query text selection state, cursor positions, and IME composition.
Sourcepub fn get_selection_manager(&self) -> &SelectionManager
pub fn get_selection_manager(&self) -> &SelectionManager
Get immutable reference to the selection manager
Use this to query text selections across multiple nodes.
Sourcepub fn is_node_focused(&self, node_id: DomNodeId) -> bool
pub fn is_node_focused(&self, node_id: DomNodeId) -> bool
Check if a specific node is currently focused
Sourcepub fn is_dom_focused(&self, dom_id: DomId) -> bool
pub fn is_dom_focused(&self, dom_id: DomId) -> bool
Check if any node in a specific DOM is focused
Sourcepub fn get_pen_state(&self) -> Option<&PenState>
pub fn get_pen_state(&self) -> Option<&PenState>
Get current pen/stylus state if a pen is active
Sourcepub fn get_pen_pressure(&self) -> Option<f32>
pub fn get_pen_pressure(&self) -> Option<f32>
Get current pen pressure (0.0 to 1.0) Returns None if no pen is active, Some(0.5) for mouse
Sourcepub fn get_pen_tilt(&self) -> Option<PenTilt>
pub fn get_pen_tilt(&self) -> Option<PenTilt>
Get current pen tilt angles (x_tilt, y_tilt) in degrees Returns None if no pen is active
Sourcepub fn is_pen_in_contact(&self) -> bool
pub fn is_pen_in_contact(&self) -> bool
Check if pen is currently in contact with surface
Sourcepub fn is_pen_eraser(&self) -> bool
pub fn is_pen_eraser(&self) -> bool
Check if pen is in eraser mode
Check if pen barrel button is pressed
Sourcepub fn get_last_input_sample(&self) -> Option<&InputSample>
pub fn get_last_input_sample(&self) -> Option<&InputSample>
Get the last recorded input sample (for event_id and detailed input data)
Sourcepub fn get_current_event_id(&self) -> Option<u64>
pub fn get_current_event_id(&self) -> Option<u64>
Get the event ID of the current event
Sourcepub fn set_focus_to_node(&mut self, dom_id: DomId, node_id: NodeId)
pub fn set_focus_to_node(&mut self, dom_id: DomId, node_id: NodeId)
Set focus to a specific DOM node by ID
Sourcepub fn set_focus_to_path(&mut self, dom_id: DomId, css_path: CssPath)
pub fn set_focus_to_path(&mut self, dom_id: DomId, css_path: CssPath)
Set focus to a node matching a CSS path
Sourcepub fn focus_next(&mut self)
pub fn focus_next(&mut self)
Move focus to next focusable element in tab order
Sourcepub fn focus_previous(&mut self)
pub fn focus_previous(&mut self)
Move focus to previous focusable element in tab order
Sourcepub fn focus_first(&mut self)
pub fn focus_first(&mut self)
Move focus to first focusable element
Sourcepub fn focus_last(&mut self)
pub fn focus_last(&mut self)
Move focus to last focusable element
Sourcepub fn clear_focus(&mut self)
pub fn clear_focus(&mut self)
Remove focus from all elements
Sourcepub fn is_dragging(&self) -> bool
pub fn is_dragging(&self) -> bool
Check if a drag gesture is currently active
Convenience method that queries the gesture manager.
Sourcepub fn get_focused_node(&self) -> Option<DomNodeId>
pub fn get_focused_node(&self) -> Option<DomNodeId>
Get the currently focused node (if any)
Returns None if no node has focus.
Sourcepub fn get_hovered_file(&self) -> Option<&AzString>
pub fn get_hovered_file(&self) -> Option<&AzString>
Get the currently hovered file (if drag-drop is in progress)
Returns None if no file is being hovered over the window.
Sourcepub fn get_dropped_file(&self) -> Option<&AzString>
pub fn get_dropped_file(&self) -> Option<&AzString>
Get the currently dropped file (if a file was just dropped)
This is a one-shot value that is cleared after event processing. Returns None if no file was dropped this frame.
Sourcepub fn is_drag_active(&self) -> bool
pub fn is_drag_active(&self) -> bool
Check if a node or file drag is currently active
Returns true if either a node drag or file drag is in progress.
Sourcepub fn is_node_drag_active(&self) -> bool
pub fn is_node_drag_active(&self) -> bool
Check if a node drag is specifically active
Sourcepub fn is_file_drag_active(&self) -> bool
pub fn is_file_drag_active(&self) -> bool
Check if a file drag is specifically active
Sourcepub fn get_drag_state(&self) -> Option<DragState>
pub fn get_drag_state(&self) -> Option<DragState>
Get the current drag/drop state (if any)
Returns None if no drag is active, or Some with drag state. Uses legacy DragState type for backwards compatibility.
Sourcepub fn get_drag_context(&self) -> Option<&DragContext>
pub fn get_drag_context(&self) -> Option<&DragContext>
Get the current drag context (if any)
Returns None if no drag is active, or Some with drag context. Prefer this over get_drag_state for new code.
Sourcepub fn get_current_hit_test(&self) -> Option<&FullHitTest>
pub fn get_current_hit_test(&self) -> Option<&FullHitTest>
Get the current mouse cursor hit test result (most recent frame)
Sourcepub fn get_hit_test_frame(&self, frames_ago: usize) -> Option<&FullHitTest>
pub fn get_hit_test_frame(&self, frames_ago: usize) -> Option<&FullHitTest>
Get mouse cursor hit test from N frames ago (0 = current, 1 = previous, etc.)
Sourcepub fn get_hit_test_history(&self) -> Option<&VecDeque<FullHitTest>>
pub fn get_hit_test_history(&self) -> Option<&VecDeque<FullHitTest>>
Get the full mouse cursor hit test history (up to 5 frames)
Returns None if no mouse history exists yet
Sourcepub fn has_sufficient_history_for_gestures(&self) -> bool
pub fn has_sufficient_history_for_gestures(&self) -> bool
Check if there’s sufficient mouse history for gesture detection (at least 2 frames)
Sourcepub fn get_file_drop_manager(&self) -> &FileDropManager
pub fn get_file_drop_manager(&self) -> &FileDropManager
Get immutable reference to the file drop manager
Sourcepub fn get_all_selections(&self) -> &BTreeMap<DomId, SelectionState>
pub fn get_all_selections(&self) -> &BTreeMap<DomId, SelectionState>
Get all selections across all DOMs
Sourcepub fn get_drag_drop_manager(&self) -> &DragDropManager
pub fn get_drag_drop_manager(&self) -> &DragDropManager
Get immutable reference to the drag-drop manager
Sourcepub fn get_dragged_node(&self) -> Option<DomNodeId>
pub fn get_dragged_node(&self) -> Option<DomNodeId>
Get the node being dragged (if any)
Sourcepub fn get_dragged_file(&self) -> Option<&AzString>
pub fn get_dragged_file(&self) -> Option<&AzString>
Get the file path being dragged (if any)
Sourcepub fn get_scroll_offset(&self) -> Option<LogicalPosition>
pub fn get_scroll_offset(&self) -> Option<LogicalPosition>
Get the current scroll offset for the hit node (if it’s scrollable)
Convenience method that uses the hit_dom_node from this callback.
Use get_scroll_offset_for_node if you need to query a specific node.
Sourcepub fn get_scroll_offset_for_node(
&self,
dom_id: DomId,
node_id: NodeId,
) -> Option<LogicalPosition>
pub fn get_scroll_offset_for_node( &self, dom_id: DomId, node_id: NodeId, ) -> Option<LogicalPosition>
Get the current scroll offset for a specific node (if it’s scrollable)
Sourcepub fn get_scroll_delta(
&self,
dom_id: DomId,
node_id: NodeId,
) -> Option<LogicalPosition>
pub fn get_scroll_delta( &self, dom_id: DomId, node_id: NodeId, ) -> Option<LogicalPosition>
Get the scroll delta for a node in the current frame (for scroll event detection)
Sourcepub fn had_scroll_activity(&self, dom_id: DomId, node_id: NodeId) -> bool
pub fn had_scroll_activity(&self, dom_id: DomId, node_id: NodeId) -> bool
Check if a node had scroll activity this frame
Sourcepub fn get_scroll_state(
&self,
dom_id: DomId,
node_id: NodeId,
) -> Option<&AnimatedScrollState>
pub fn get_scroll_state( &self, dom_id: DomId, node_id: NodeId, ) -> Option<&AnimatedScrollState>
Get the scroll state (container rect, content rect, current offset) for a node
Sourcepub fn get_gpu_state_manager(&self) -> &GpuStateManager
pub fn get_gpu_state_manager(&self) -> &GpuStateManager
Get immutable reference to the GPU state manager
Sourcepub fn get_iframe_manager(&self) -> &IFrameManager
pub fn get_iframe_manager(&self) -> &IFrameManager
Get immutable reference to the IFrame manager
Sourcepub fn inspect_copy_changeset(
&self,
target: DomNodeId,
) -> Option<ClipboardContent>
pub fn inspect_copy_changeset( &self, target: DomNodeId, ) -> Option<ClipboardContent>
Inspect a pending copy operation
Returns the clipboard content that would be copied if the operation proceeds. Use this to validate or transform clipboard content before copying.
Sourcepub fn inspect_cut_changeset(
&self,
target: DomNodeId,
) -> Option<ClipboardContent>
pub fn inspect_cut_changeset( &self, target: DomNodeId, ) -> Option<ClipboardContent>
Inspect a pending cut operation
Returns the clipboard content that would be cut (copied + deleted). Use this to validate or transform content before cutting.
Sourcepub fn inspect_paste_target_range(
&self,
target: DomNodeId,
) -> Option<SelectionRange>
pub fn inspect_paste_target_range( &self, target: DomNodeId, ) -> Option<SelectionRange>
Inspect the current selection range that would be affected by paste
Returns the selection range that will be replaced when pasting. Returns None if no selection exists (paste will insert at cursor).
Sourcepub fn inspect_select_all_changeset(
&self,
target: DomNodeId,
) -> Option<SelectAllResult>
pub fn inspect_select_all_changeset( &self, target: DomNodeId, ) -> Option<SelectAllResult>
Inspect what text would be selected by Select All operation
Returns the full text content and the range that would be selected.
Sourcepub fn inspect_delete_changeset(
&self,
target: DomNodeId,
forward: bool,
) -> Option<DeleteResult>
pub fn inspect_delete_changeset( &self, target: DomNodeId, forward: bool, ) -> Option<DeleteResult>
Inspect what would be deleted by a backspace/delete operation
Uses the pure functions from text3::edit::inspect_delete() to determine
what would be deleted without actually performing the deletion.
Returns (range_to_delete, deleted_text).
- forward=true: Delete key (delete character after cursor)
- forward=false: Backspace key (delete character before cursor)
Sourcepub fn inspect_undo_operation(
&self,
node_id: NodeId,
) -> Option<&UndoableOperation>
pub fn inspect_undo_operation( &self, node_id: NodeId, ) -> Option<&UndoableOperation>
Inspect a pending undo operation
Returns the operation that would be undone, allowing inspection of what state will be restored.
Sourcepub fn inspect_redo_operation(
&self,
node_id: NodeId,
) -> Option<&UndoableOperation>
pub fn inspect_redo_operation( &self, node_id: NodeId, ) -> Option<&UndoableOperation>
Inspect a pending redo operation
Returns the operation that would be reapplied.
Sourcepub fn can_undo(&self, node_id: NodeId) -> bool
pub fn can_undo(&self, node_id: NodeId) -> bool
Check if undo is available for a specific node
Returns true if there is at least one undoable operation in the stack.
Sourcepub fn can_redo(&self, node_id: NodeId) -> bool
pub fn can_redo(&self, node_id: NodeId) -> bool
Check if redo is available for a specific node
Returns true if there is at least one redoable operation in the stack.
Sourcepub fn get_undo_text(&self, node_id: NodeId) -> Option<AzString>
pub fn get_undo_text(&self, node_id: NodeId) -> Option<AzString>
Get the text that would be restored by undo for a specific node
Returns the pre-state text content that would be restored if undo is performed. Returns None if no undo operation is available.
Sourcepub fn get_redo_text(&self, node_id: NodeId) -> Option<AzString>
pub fn get_redo_text(&self, node_id: NodeId) -> Option<AzString>
Get the text that would be restored by redo for a specific node
Returns the pre-state text content that would be restored if redo is performed. Returns None if no redo operation is available.
Sourcepub fn get_clipboard_content(&self) -> Option<&ClipboardContent>
pub fn get_clipboard_content(&self) -> Option<&ClipboardContent>
Get clipboard content from system clipboard (available during paste operations)
This returns content that was read from the system clipboard when Ctrl+V was pressed. It’s only available in On::Paste callbacks or similar clipboard-related callbacks.
Use this to inspect what will be pasted before allowing or modifying the paste operation.
§Returns
Some(&ClipboardContent)- If paste is in progress and clipboard has contentNone- If no paste operation is active or clipboard is empty
Sourcepub fn set_clipboard_content(&mut self, content: ClipboardContent)
pub fn set_clipboard_content(&mut self, content: ClipboardContent)
Override clipboard content for copy/cut operations
This sets custom content that will be written to the system clipboard. Use this in On::Copy or On::Cut callbacks to modify what gets copied.
§Arguments
content- The clipboard content to write to system clipboard
Sourcepub fn set_copy_content(&mut self, target: DomNodeId, content: ClipboardContent)
pub fn set_copy_content(&mut self, target: DomNodeId, content: ClipboardContent)
Set/modify the clipboard content before a copy operation
Use this to transform clipboard content before copying. The change is queued and will be applied after the callback returns, if preventDefault() was not called.
Sourcepub fn set_cut_content(&mut self, target: DomNodeId, content: ClipboardContent)
pub fn set_cut_content(&mut self, target: DomNodeId, content: ClipboardContent)
Set/modify the clipboard content before a cut operation
Similar to set_copy_content but for cut operations. The change is queued and will be applied after the callback returns.
Sourcepub fn set_select_all_range(&mut self, target: DomNodeId, range: SelectionRange)
pub fn set_select_all_range(&mut self, target: DomNodeId, range: SelectionRange)
Override the selection range for select-all operation
Use this to limit what gets selected (e.g., only select visible text). The change is queued and will be applied after the callback returns.
Sourcepub fn request_hit_test_update(&mut self, position: LogicalPosition)
pub fn request_hit_test_update(&mut self, position: LogicalPosition)
Request a hit test update at a specific position
This is used by the Debug API to update the hover manager’s hit test data after modifying the mouse position. This ensures that mouse event callbacks can find the correct nodes under the cursor.
The hit test is performed during the next frame update.
Sourcepub fn process_text_selection_click(
&mut self,
position: LogicalPosition,
time_ms: u64,
)
pub fn process_text_selection_click( &mut self, position: LogicalPosition, time_ms: u64, )
Process a text selection click at a specific position
This is used by the Debug API to trigger text selection directly, bypassing the normal event pipeline which generates PreCallbackSystemEvent::TextClick.
The selection processing is deferred until the CallbackChange is processed, at which point the LayoutWindow can be mutably accessed.
Sourcepub fn get_node_text_content(&self, target: DomNodeId) -> Option<String>
pub fn get_node_text_content(&self, target: DomNodeId) -> Option<String>
Get the current text content of a node
Helper for inspecting text before operations.
Sourcepub fn get_node_cursor_position(&self, target: DomNodeId) -> Option<TextCursor>
pub fn get_node_cursor_position(&self, target: DomNodeId) -> Option<TextCursor>
Get the current cursor position in a node
Returns the text cursor position if the node is focused.
Sourcepub fn get_node_selection_ranges(&self, target: DomNodeId) -> SelectionRangeVec
pub fn get_node_selection_ranges(&self, target: DomNodeId) -> SelectionRangeVec
Get the current selection ranges in a node
Returns all active selection ranges for the specified DOM.
Sourcepub fn node_has_selection(&self, target: DomNodeId) -> bool
pub fn node_has_selection(&self, target: DomNodeId) -> bool
Check if a specific node has an active selection
This checks if the specific node (identified by DomNodeId) has a selection, as opposed to has_selection(DomId) which checks the entire DOM.
Sourcepub fn get_node_text_length(&self, target: DomNodeId) -> Option<usize>
pub fn get_node_text_length(&self, target: DomNodeId) -> Option<usize>
Get the length of text in a node
Useful for bounds checking in custom operations.
Sourcepub fn inspect_move_cursor_left(&self, target: DomNodeId) -> Option<TextCursor>
pub fn inspect_move_cursor_left(&self, target: DomNodeId) -> Option<TextCursor>
Inspect where the cursor would move when pressing left arrow
Returns the new cursor position that would result from moving left. Returns None if the cursor is already at the start of the document.
§Arguments
target- The node containing the cursor
Sourcepub fn inspect_move_cursor_right(&self, target: DomNodeId) -> Option<TextCursor>
pub fn inspect_move_cursor_right(&self, target: DomNodeId) -> Option<TextCursor>
Inspect where the cursor would move when pressing right arrow
Returns the new cursor position that would result from moving right. Returns None if the cursor is already at the end of the document.
Sourcepub fn inspect_move_cursor_up(&self, target: DomNodeId) -> Option<TextCursor>
pub fn inspect_move_cursor_up(&self, target: DomNodeId) -> Option<TextCursor>
Inspect where the cursor would move when pressing up arrow
Returns the new cursor position that would result from moving up one line. Returns None if the cursor is already on the first line.
Sourcepub fn inspect_move_cursor_down(&self, target: DomNodeId) -> Option<TextCursor>
pub fn inspect_move_cursor_down(&self, target: DomNodeId) -> Option<TextCursor>
Inspect where the cursor would move when pressing down arrow
Returns the new cursor position that would result from moving down one line. Returns None if the cursor is already on the last line.
Sourcepub fn inspect_move_cursor_to_line_start(
&self,
target: DomNodeId,
) -> Option<TextCursor>
pub fn inspect_move_cursor_to_line_start( &self, target: DomNodeId, ) -> Option<TextCursor>
Inspect where the cursor would move when pressing Home key
Returns the cursor position at the start of the current line.
Sourcepub fn inspect_move_cursor_to_line_end(
&self,
target: DomNodeId,
) -> Option<TextCursor>
pub fn inspect_move_cursor_to_line_end( &self, target: DomNodeId, ) -> Option<TextCursor>
Inspect where the cursor would move when pressing End key
Returns the cursor position at the end of the current line.
Sourcepub fn inspect_move_cursor_to_document_start(
&self,
target: DomNodeId,
) -> Option<TextCursor>
pub fn inspect_move_cursor_to_document_start( &self, target: DomNodeId, ) -> Option<TextCursor>
Inspect where the cursor would move when pressing Ctrl+Home
Returns the cursor position at the start of the document.
Sourcepub fn inspect_move_cursor_to_document_end(
&self,
target: DomNodeId,
) -> Option<TextCursor>
pub fn inspect_move_cursor_to_document_end( &self, target: DomNodeId, ) -> Option<TextCursor>
Inspect where the cursor would move when pressing Ctrl+End
Returns the cursor position at the end of the document.
Sourcepub fn inspect_backspace(&self, target: DomNodeId) -> Option<DeleteResult>
pub fn inspect_backspace(&self, target: DomNodeId) -> Option<DeleteResult>
Inspect what text would be deleted by backspace (including Shift+Backspace)
Returns (range_to_delete, deleted_text). This is a convenience wrapper around inspect_delete_changeset(target, false).
Sourcepub fn inspect_delete(&self, target: DomNodeId) -> Option<DeleteResult>
pub fn inspect_delete(&self, target: DomNodeId) -> Option<DeleteResult>
Inspect what text would be deleted by delete key
Returns (range_to_delete, deleted_text). This is a convenience wrapper around inspect_delete_changeset(target, true).
Sourcepub fn move_cursor_left(&mut self, target: DomNodeId, extend_selection: bool)
pub fn move_cursor_left(&mut self, target: DomNodeId, extend_selection: bool)
Move cursor left (arrow left key)
§Arguments
target- The node containing the cursorextend_selection- If true, extends selection (Shift+Left); if false, moves cursor
Sourcepub fn move_cursor_right(&mut self, target: DomNodeId, extend_selection: bool)
pub fn move_cursor_right(&mut self, target: DomNodeId, extend_selection: bool)
Move cursor right (arrow right key)
Sourcepub fn move_cursor_up(&mut self, target: DomNodeId, extend_selection: bool)
pub fn move_cursor_up(&mut self, target: DomNodeId, extend_selection: bool)
Move cursor up (arrow up key)
Sourcepub fn move_cursor_down(&mut self, target: DomNodeId, extend_selection: bool)
pub fn move_cursor_down(&mut self, target: DomNodeId, extend_selection: bool)
Move cursor down (arrow down key)
Sourcepub fn move_cursor_to_line_start(
&mut self,
target: DomNodeId,
extend_selection: bool,
)
pub fn move_cursor_to_line_start( &mut self, target: DomNodeId, extend_selection: bool, )
Move cursor to line start (Home key)
Sourcepub fn move_cursor_to_line_end(
&mut self,
target: DomNodeId,
extend_selection: bool,
)
pub fn move_cursor_to_line_end( &mut self, target: DomNodeId, extend_selection: bool, )
Move cursor to line end (End key)
Sourcepub fn move_cursor_to_document_start(
&mut self,
target: DomNodeId,
extend_selection: bool,
)
pub fn move_cursor_to_document_start( &mut self, target: DomNodeId, extend_selection: bool, )
Move cursor to document start (Ctrl+Home)
Sourcepub fn move_cursor_to_document_end(
&mut self,
target: DomNodeId,
extend_selection: bool,
)
pub fn move_cursor_to_document_end( &mut self, target: DomNodeId, extend_selection: bool, )
Move cursor to document end (Ctrl+End)
Sourcepub fn delete_backward(&mut self, target: DomNodeId)
pub fn delete_backward(&mut self, target: DomNodeId)
Delete text backward (backspace or Shift+Backspace)
Queues a backspace operation to be applied after the callback. Use inspect_backspace() to see what would be deleted.
Sourcepub fn delete_forward(&mut self, target: DomNodeId)
pub fn delete_forward(&mut self, target: DomNodeId)
Delete text forward (delete key)
Queues a delete operation to be applied after the callback. Use inspect_delete() to see what would be deleted.
Trait Implementations§
Source§impl Clone for CallbackInfo
impl Clone for CallbackInfo
Source§fn clone(&self) -> CallbackInfo
fn clone(&self) -> CallbackInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CallbackInfo
impl Debug for CallbackInfo
impl Copy for CallbackInfo
Auto Trait Implementations§
impl Freeze for CallbackInfo
impl !RefUnwindSafe for CallbackInfo
impl !Send for CallbackInfo
impl !Sync for CallbackInfo
impl Unpin for CallbackInfo
impl !UnwindSafe for CallbackInfo
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more