Skip to main content

CallbackInfo

Struct CallbackInfo 

Source
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

Source

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

Source

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.

Source

pub fn get_gl_context(&self) -> OptionGlContextPtr

Returns the OpenGL context if available

Source

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

Source

pub fn get_changes_ptr(&self) -> *const ()

Debug helper to get the changes pointer for debugging

Source

pub fn take_changes(&self) -> Vec<CallbackChange>

Get the collected changes (consumes them from the Arc)

Source

pub fn has_pending_relayout_change(&self) -> bool

Check if pending changes require relayout before the next step.

Returns true for ModifyWindowState (resize) and ScrollTo (scroll), which both need the event loop to re-run layout so that subsequent operations (like take_screenshot) see updated content.

Used by the E2E test runner to detect when it needs to yield.

Source

pub fn add_timer(&mut self, timer_id: TimerId, timer: Timer)

Add a timer to this window (applied after callback returns)

Source

pub fn remove_timer(&mut self, timer_id: TimerId)

Remove a timer from this window (applied after callback returns)

Source

pub fn add_thread(&mut self, thread_id: ThreadId, thread: Thread)

Add a thread to this window (applied after callback returns)

Source

pub fn remove_thread(&mut self, thread_id: ThreadId)

Remove a thread from this window (applied after callback returns)

Source

pub fn stop_propagation(&mut self)

Stop event propagation (applied after callback returns)

W3C stopPropagation(): remaining handlers on the current node still fire, but no handlers on ancestor/descendant nodes are called.

Source

pub fn stop_immediate_propagation(&mut self)

Stop event propagation immediately (applied after callback returns)

W3C stopImmediatePropagation(): no further handlers fire, not even remaining handlers registered on the same node.

Source

pub fn set_focus(&mut self, target: FocusTarget)

Set keyboard focus target (applied after callback returns)

Source

pub fn create_window(&mut self, options: WindowCreateOptions)

Create a new window (applied after callback returns)

Source

pub fn close_window(&mut self)

Close the current window (applied after callback returns)

Source

pub fn switch_route(&mut self, pattern: AzString, params: StringPairVec)

Switch to a different route (applied after callback returns).

On desktop: swaps the layout callback and triggers RefreshDom. On web: also calls history.pushState().

§C API
AzCallbackInfo_switchRoute(&info, AzString_fromConstStr("/user/:id"),
    AzStringPairVec_fromConstSlice(&[AzStringPair { key: "id", value: "42" }]));
Source

pub fn get_route_pattern(&self) -> AzString

Get the current active route pattern (e.g. "/user/:id").

Returns empty string if no route is active.

§C API
AzString pattern = AzCallbackInfo_getRoutePattern(&info);
Source

pub fn get_route_param(&self, key: AzString) -> AzString

Get a route parameter by key (e.g. "id" from /user/:id).

Returns empty string if the parameter doesn’t exist or no route is active.

§C API
AzString id = AzCallbackInfo_getRouteParam(&info, AzString_fromConstStr("id"));
Source

pub fn set_route_param(&mut self, key: AzString, value: AzString)

Set a route parameter value and trigger re-render.

This modifies the active route’s params in-place and triggers a DOM refresh. On web, this also updates the URL via history.replaceState().

§C API
AzCallbackInfo_setRouteParam(&info, AzString_fromConstStr("id"), AzString_fromConstStr("99"));
Source

pub fn modify_window_state(&mut self, state: FullWindowState)

Modify the window state (applied after callback returns)

Source

pub fn begin_interactive_move(&mut self)

Request the compositor to begin an interactive window move.

On Wayland: calls xdg_toplevel_move(toplevel, seat, serial) which lets the compositor handle the move. This is the only way to move windows on Wayland. On other platforms: this is a no-op; use modify_window_state() to set position.

Source

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.

Source

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
Source

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)

Source

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)
Source

pub fn update_all_image_callbacks(&mut self)

Re-render ALL image callbacks across all DOMs (applied after callback returns)

This is the most efficient way to update animated GL textures. Unlike returning Update::RefreshDom, this triggers only:

  • Re-invocation of all RenderImageCallback functions
  • GL texture swap in WebRender

It does NOT trigger:

  • DOM rebuild (no layout() callback)
  • Display list resubmission (WebRender reuses existing scene)
  • Relayout

Ideal for timer callbacks that animate OpenGL content at 60fps.

Source

pub fn trigger_virtual_view_rerender(&mut self, dom_id: DomId, node_id: NodeId)

Trigger re-rendering of a VirtualView (applied after callback returns)

This forces the VirtualView to call its layout callback with reason DomRecreated and submit a new display list to WebRender. The VirtualView’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)
Source

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.

Source

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)

Source

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

Source

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

Source

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

Source

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

Source

pub fn get_all_children_nodes( &self, dom_id: DomId, node_id: NodeId, ) -> NodeHierarchyItemIdVec

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.

Source

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.

Source

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)

Source

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)

Source

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
Source

pub fn override_node_css_properties( &mut self, dom_id: DomId, node_id: NodeId, properties: CssPropertyVec, )

Quickly override CSS properties on a node for animation or other transient visual changes. Writes go through CssPropertyCache::user_overridden_properties, which is consulted at higher priority than the static cascade, so this does not invalidate the styled DOM’s CSS rules. Pass CssProperty::Initial for a given property type to remove any prior override for that type.

Source

pub fn override_css_property( &mut self, node_id: DomNodeId, property: CssProperty, )

Convenience wrapper for override_node_css_properties that targets a single property on the hit node’s DOM (typical for animation callbacks).

Source

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)

Source

pub fn scroll_to_unclamped( &mut self, dom_id: DomId, node_id: NodeHierarchyItemId, position: LogicalPosition, )

Scroll a node to a specific position without clamping. Used by the scroll physics timer for rubber-banding/overscroll.

Source

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 view
  • options - 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.

Source

pub fn add_image_to_cache(&mut self, id: AzString, image: ImageRef)

Add an image to the image cache (applied after callback returns)

Source

pub fn remove_image_from_cache(&mut self, id: AzString)

Remove an image from the image cache (applied after callback returns)

Source

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

Source

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.

Source

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
Source

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:

  1. Record the text in TextInputManager (creating a PendingTextEdit)
  2. Generate synthetic TextInput events
  3. Invoke user callbacks (which can intercept/reject via preventDefault)
  4. Apply the changeset if not rejected
  5. Mark dirty nodes for re-render
§Arguments
  • text - The text to insert at the current cursor position
Source

pub fn insert_child_node( &mut self, dom_id: DomId, parent_node_id: NodeId, node_type_str: AzString, position: Option<usize>, classes: Vec<AzString>, id: Option<AzString>, )

Insert a new child node into the DOM tree (applied after callback returns)

Creates a new node with the given type string and appends it as a child of the specified parent node. The node_type_str can be:

  • A tag name: “div”, “p”, “span”, “button”, etc.
  • Text content: “text:Hello World”
§Arguments
  • dom_id - The DOM to modify
  • parent_node_id - The parent node to insert under
  • node_type_str - The node type (tag name or “text:content”)
  • position - Optional child index (None = append at end)
  • classes - CSS classes for the new node
  • id - Optional ID for the new node
Source

pub fn delete_node(&mut self, dom_id: DomId, node_id: NodeId)

Delete a node from the DOM tree (applied after callback returns)

Tombstones the node by setting it to an empty anonymous Div and unlinking it from the hierarchy. This preserves node ID stability (other node IDs don’t shift).

§Arguments
  • dom_id - The DOM containing the node
  • node_id - The node to delete
Source

pub fn set_node_ids_and_classes( &mut self, dom_id: DomId, node_id: NodeId, ids_and_classes: IdOrClassVec, )

Set the IDs and classes on an existing node (applied after callback returns)

Replaces the current IDs and classes of a node with the given set.

§Arguments
  • dom_id - The DOM containing the node
  • node_id - The node to modify
  • ids_and_classes - The new set of IDs and classes
Source

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.

Source

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.

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.

Start the cursor blink timer

Called automatically when focus lands on a contenteditable element. The timer will toggle cursor visibility at ~530ms intervals.

Stop the cursor blink timer

Called automatically when focus leaves a contenteditable element.

Source

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.

Source

pub fn open_menu(&mut self, menu: Menu)

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
Source

pub fn open_menu_at(&mut self, menu: Menu, position: LogicalPosition)

Open a menu at a specific position

§Arguments
  • menu - The menu to display
  • position - The position where the menu should appear (overrides menu’s position)
Source

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_CLASS Win32 control
  • macOS: Uses NSPopover or custom NSWindow with tooltip styling
  • X11: Creates transient window with _NET_WM_WINDOW_TYPE_TOOLTIP
  • Wayland: Uses zwlr_layer_shell_v1 with overlay layer
§Arguments
  • text - The tooltip text to display
Source

pub fn show_tooltip_at(&mut self, text: AzString, position: LogicalPosition)

Show a tooltip at a specific position

§Arguments
  • text - The tooltip text to display
  • position - The position where the tooltip should appear (in window coordinates)
Source

pub fn hide_tooltip(&mut self)

Hide the currently displayed tooltip

Source

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 node
  • node_id - The node to insert text into
  • text - The text to insert
Source

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 node
  • node_id - The node containing the cursor
  • cursor - The new cursor position
Source

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 node
  • node_id - The node containing the selection
  • selection - The new selection (can be a cursor or range)
Source

pub fn add_cursor( &mut self, dom_id: DomId, node_id: NodeId, cursor: TextCursor, ) -> SelectionId

Add an additional cursor at the specified position (for multi-cursor editing).

If a MultiCursorState already exists, the cursor is added and overlapping selections are merged. If not, a new MultiCursorState is created.

Returns the SelectionId of the new cursor.

Source

pub fn add_selection_range( &mut self, dom_id: DomId, node_id: NodeId, range: SelectionRange, ) -> SelectionId

Add an additional selection range (for multi-cursor editing).

Returns the SelectionId of the new selection.

Source

pub fn remove_selection_by_id(&mut self, selection_id: SelectionId) -> bool

Remove a specific selection/cursor by its stable ID.

Returns true if a selection with that ID existed and was removed.

Source

pub fn get_multi_cursor_selections( &self, dom_id: &DomId, ) -> Vec<IdentifiedSelection>

Get all selections for the given DOM (read-only).

Returns a Vec of IdentifiedSelection from the MultiCursorState, or empty if no multi-cursor state exists.

Source

pub fn get_primary_selection( &self, dom_id: &DomId, ) -> Option<IdentifiedSelection>

Get the primary (last-added) selection from the MultiCursorState.

Source

pub fn get_selection_count(&self, dom_id: &DomId) -> usize

Get the number of active cursors/selections.

Source

pub fn open_menu_for_node(&mut self, menu: Menu, node_id: DomNodeId) -> bool

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 display
  • node_id - The DOM node to position the menu relative to
§Returns
  • true if the menu was queued for opening
  • false if the node doesn’t exist or has no layout information
Source

pub fn open_menu_for_hit_node(&mut self, menu: Menu) -> bool

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
  • true if the menu was queued for opening
  • false if no node is currently hit or it has no layout information
Source

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().

Source

pub fn get_node_size(&self, node_id: DomNodeId) -> Option<LogicalSize>

Get the logical size of a node, or None if the node doesn’t exist

Source

pub fn get_node_position(&self, node_id: DomNodeId) -> Option<LogicalPosition>

Get the logical position of a node, or None if the node doesn’t exist

Source

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.

Source

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.

Source

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.

Source

pub fn get_timer(&self, timer_id: &TimerId) -> Option<&Timer>

Get a reference to a timer

Source

pub fn get_timer_ids(&self) -> TimerIdVec

Get all timer IDs

Source

pub fn get_thread(&self, thread_id: &ThreadId) -> Option<&Thread>

Get a reference to a thread

Source

pub fn get_thread_ids(&self) -> ThreadIdVec

Get all thread IDs

Source

pub fn get_gpu_cache(&self, dom_id: &DomId) -> Option<&GpuValueCache>

Get the GPU value cache for a specific DOM

Source

pub fn get_layout_result(&self, dom_id: &DomId) -> Option<&DomLayoutResult>

Get a layout result for a specific DOM

Source

pub fn get_dom_ids(&self) -> DomIdVec

Get all DOM IDs that have layout results

Source

pub fn get_hit_node(&self) -> DomNodeId

Get the DOM node that was hit by the event that triggered this callback

Source

pub fn get_parent(&self, node_id: DomNodeId) -> Option<DomNodeId>

Get the parent of a node, skipping anonymous (table-generated) nodes

Source

pub fn get_previous_sibling(&self, node_id: DomNodeId) -> Option<DomNodeId>

Get the previous sibling of a node, skipping anonymous nodes

Source

pub fn get_next_sibling(&self, node_id: DomNodeId) -> Option<DomNodeId>

Get the next sibling of a node, skipping anonymous nodes

Source

pub fn get_first_child(&self, node_id: DomNodeId) -> Option<DomNodeId>

Get the first child of a node, skipping anonymous nodes

Source

pub fn get_last_child(&self, node_id: DomNodeId) -> Option<DomNodeId>

Get the last child of a node, skipping anonymous nodes

Source

pub fn get_dataset(&mut self, node_id: DomNodeId) -> Option<RefAny>

Get the dataset (user-attached RefAny) of a node, or None if unset

Source

pub fn get_node_id_of_root_dataset( &mut self, search_key: RefAny, ) -> Option<DomNodeId>

Find the root-level node whose dataset matches the type of search_key

Source

pub fn get_string_contents(&self, node_id: DomNodeId) -> Option<AzString>

Get the text content of a text node, or None if the node is not a text node

Source

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”.

Source

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 query
  • attr_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.

Source

pub fn get_node_classes(&self, node_id: DomNodeId) -> StringVec

Get all classes of a node as a vector of strings

Source

pub fn get_node_id(&self, node_id: DomNodeId) -> Option<AzString>

Get the ID attribute of a node (if it has one)

Source

pub fn get_selection(&self, _dom_id: &DomId) -> Option<&SelectionState>

Get the current selection state for a DOM (via multi_cursor)

Source

pub fn has_selection(&self, _dom_id: &DomId) -> bool

Check if a DOM has any selection (via multi_cursor)

Source

pub fn get_primary_cursor(&self, _dom_id: &DomId) -> Option<TextCursor>

Get the primary cursor for a DOM (via multi_cursor)

Source

pub fn get_selection_ranges(&self, _dom_id: &DomId) -> SelectionRangeVec

Get all selection ranges (excludes plain cursors, via multi_cursor)

Source

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 content
  • set_selection() for setting selections
  • get_selection(), get_primary_cursor() for reading selections

Future: Add NodeId -> CacheId mapping to enable node-specific layout access

Source

pub fn get_current_window_state(&self) -> &FullWindowState

Get full current window state (immutable reference)

Source

pub fn get_current_window_flags(&self) -> WindowFlags

Get current window flags

Source

pub fn get_current_keyboard_state(&self) -> KeyboardState

Get current keyboard state

Source

pub fn get_current_mouse_state(&self) -> MouseState

Get current mouse state

Source

pub fn get_previous_window_state(&self) -> &Option<FullWindowState>

Get full previous window state (immutable reference)

Source

pub fn get_previous_window_flags(&self) -> Option<WindowFlags>

Get previous window flags

Source

pub fn get_previous_keyboard_state(&self) -> Option<KeyboardState>

Get previous keyboard state

Source

pub fn get_previous_mouse_state(&self) -> Option<MouseState>

Get previous mouse state

Source

pub fn get_cursor_relative_to_node(&self) -> OptionCursorNodePosition

Source

pub fn get_cursor_relative_to_viewport(&self) -> OptionLogicalPosition

Source

pub fn get_cursor_position_screen(&self) -> OptionScreenPosition

Get cursor position in virtual screen coordinates (all monitors combined).

Computed as: window_position + cursor_position_in_window. All coordinates are in logical pixels (HiDPI-independent on macOS; on Win32 this depends on DPI-awareness mode).

The origin (0, 0) is at the top-left of the primary monitor. Y increases downward. On multi-monitor setups, coordinates may be negative for monitors to the left of or above the primary monitor.

Returns None if the cursor is outside the window or the window position is unknown.

§Platform notes
PlatformAccuracy
macOSExact (points = logical pixels)
Win32Exact when DPI-aware; approximate otherwise
X11Exact (pixels)
WaylandFalls back to window-local (compositor hides global position)
Source

pub fn get_drag_delta(&self) -> OptionDragDelta

Get the drag delta in window-local coordinates.

Returns the offset from drag start to current cursor position in window-local logical pixels. Returns None if no drag is active.

Warning: This is NOT stable during window moves (titlebar drag). Use get_drag_delta_screen() for titlebar dragging.

Source

pub fn get_drag_delta_screen(&self) -> OptionDragDelta

Get the drag delta in screen coordinates.

Unlike get_drag_delta(), this is stable even when the window moves (e.g., during titlebar drag). Returns None if no drag is active. On Wayland: falls back to window-local delta.

Source

pub fn get_drag_delta_screen_incremental(&self) -> OptionDragDelta

Get the incremental (frame-to-frame) drag delta in screen coordinates.

Returns the screen-space delta between the current and previous sample (not the total delta since drag start). Use this with the current window position for robust titlebar drag:

new_pos = current_window_pos + incremental_delta

This handles external position changes (DPI change, OS clamping, compositor resize) that would make the initial position stale. Returns None if no drag is active or fewer than 2 samples exist.

Source

pub fn get_current_window_handle(&self) -> RawWindowHandle

Source

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.

Source

pub fn get_monitors(&self) -> MonitorVec

Get a snapshot of all monitors available on the system.

The returned MonitorVec is cloned from the shared monitor cache. The cache is initialized once at app start and updated by the platform layer on monitor topology changes. No OS calls are made here.

Source

pub fn get_current_monitor(&self) -> OptionMonitor

Get the monitor that the current window is on, if known.

Uses FullWindowState::monitor_id (set by the platform layer) to find the matching monitor in the cached monitor list. Returns None if the monitor ID is not set or no matching monitor is found.

Source

pub fn get_cursor_position(&self) -> Option<LogicalPosition>

Get the current cursor position in logical coordinates relative to the window

Source

pub fn get_hit_node_layout_rect(&self) -> Option<LogicalRect>

Get the layout rectangle of the currently hit node (in logical coordinates)

Source

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 query
  • property_type - The CSS property type to retrieve
§Returns
  • Some(CssProperty) if the property is set on this node
  • None if the property is not set (will use default value)
Source

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.

Source

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.

Source

pub fn get_system_time_fn(&self) -> GetSystemTimeCallback

Source

pub fn get_current_time(&self) -> Instant

Source

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.

Source

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 data
  • Err(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
}
Source

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 screenshot
  • path - The file path to save the PNG to
§Returns
  • Ok(()) - Screenshot saved successfully
  • Err(String) - Error message if rendering or saving failed
Source

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
Source

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 data
  • Err(String) - Error message if screenshot failed
Source

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 string
  • Err(String) - Error message if screenshot failed
Source

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 string
  • Err(String) - Error message if rendering failed
Source

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.

Source

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.

Source

pub fn inject_native_gesture(&mut self, gesture: NativeGestureEvent)

Queue a platform-native gesture-recognizer result. Applied by the event-loop after the callback returns, via CallbackChange::InjectNativeGesture -> GestureAndDragManager:: inject_native_gesture. Used by the iOS / Android / macOS platform backends from their gesture-recognizer callbacks and by the e2e debug-server harness so JSON tests can drive every event filter end-to-end.

Source

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.

Source

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().

Source

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).

Source

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.

Source

pub fn has_any_selection(&self) -> bool

Check if multi_cursor has any selection ranges.

Replaces the removed get_selection_manager().

Source

pub fn is_node_focused(&self, node_id: DomNodeId) -> bool

Check if a specific node is currently focused

Source

pub fn is_dom_focused(&self, dom_id: DomId) -> bool

Check if any node in a specific DOM is focused

Source

pub fn get_pen_state(&self) -> Option<&PenState>

Get current pen/stylus state if a pen is active

Source

pub fn get_wacom_pad(&self) -> Option<WacomPadState>

Get the current Wacom tablet-pad state (ExpressKeys + touch-ring), or None if no pad backend has delivered one. (The pen’s own wacom features - eraser / barrel button / barrel roll / tilt / pressure - are in CallbackInfo::get_pen_state.) Kept live by the platform pad backend (Wintab / libwacom+libinput / macOS tablet NSEvents).

Source

pub fn get_location_fix(&self) -> Option<LocationFix>

Get the most recent geolocation fix, or None if no GeolocationProbe is mounted or no platform backend has delivered a fix yet. The fix is kept live by the platform backends (Android FusedLocationProvider, iOS/macOS CLLocationManager) via the async fix channel that the layout pass folds into the manager - so a callback can read the user’s position to, e.g., place a “you are here” marker on a map.

Source

pub fn get_sensor_reading(&self, kind: SensorKind) -> Option<SensorReading>

Get the latest motion-sensor reading for kind (Accelerometer / Gyroscope / Magnetometer), or None if no platform backend has delivered one. Kept live by the sensor backends (iOS CoreMotion, Android SensorManager) via the async channel the layout pass folds into the manager - so a callback can drive tilt / shake / compass UI.

Source

pub fn get_safe_area_insets(&self) -> SafeAreaInsets

The safe-area insets (notch / system-UI margins) for this window, in logical px - lay out interactive content within them so it isn’t hidden by a notch / rounded corners / status bar. Zero where the platform or window has no inset. Set by the platform shell (macOS NSScreen notch, iOS UIView.safeAreaInsets, Android WindowInsets).

Source

pub fn get_gamepad_state(&self, id: GamepadId) -> Option<GamepadState>

Get the latest state of the gamepad id (button bitset + analog axes), or None if no pad with that id has connected. Kept live by the controller backend (gilrs / iOS GCController / Android InputDevice) via the async channel the layout pass folds into the manager - so a callback can drive movement / menu UI. For the common single-controller case, CallbackInfo::get_primary_gamepad skips the id bookkeeping.

Source

pub fn get_primary_gamepad(&self) -> Option<GamepadState>

Get the first currently-connected gamepad, or None if none is connected - the convenient single-controller accessor.

Source

pub fn get_biometric_result(&self) -> Option<BiometricResult>

Get the most recent biometric-auth result, or None if no request_biometric_auth has completed yet. Kept live by the platform backends (iOS/macOS LAContext, Android BiometricPrompt, Windows UserConsentVerifier) via the async result channel the layout pass folds into the manager - so a callback can unlock a vault / settings panel once the user authenticates.

Source

pub fn get_biometric_kind(&self) -> BiometricKind

Get the device’s biometric capability (sync probe): Face, Fingerprint, Iris, or NotAvailable. Lets a callback decide whether to even offer a biometric unlock before requesting one (no OS prompt is shown - this just reads the cached probe).

Source

pub fn request_biometric_auth(&mut self, prompt: BiometricPrompt)

Request a biometric-auth prompt (Face ID / Touch ID / Android BiometricPrompt / Windows Hello). Returns immediately - the OS draws its own modal asynchronously; the outcome arrives on a later frame and is read via CallbackInfo::get_biometric_result. Call this from, e.g., an unlock button’s on_click. The prompt configures the reason text, cancel label, and whether the OS passcode fallback is allowed. (No platform backend reports a real outcome yet - the request currently resolves to BiometricResult::Unavailable; the iOS/macOS/Android backends land in a later tick.)

Source

pub fn keyring_store( &mut self, key: AzString, secret: AzString, require_biometry: bool, )

Store secret under key in the OS keyring (Keychain / KeyStore / libsecret / CredentialLocker). When require_biometry is set, a later keyring_get of this key triggers the OS biometric prompt. Returns immediately; the outcome arrives via get_keyring_result() on a later frame.

Source

pub fn keyring_get(&mut self, key: AzString)

Read the secret stored under key. A biometry-bound item shows the OS prompt first; the secret (or a denial) arrives via get_keyring_result() on a later frame.

Source

pub fn keyring_delete(&mut self, key: AzString)

Remove the item stored under key from the OS keyring (no-op if absent). The outcome arrives via get_keyring_result().

Source

pub fn get_keyring_result(&self) -> Option<KeyringResult>

Get the most recent keyring outcome, or None until the first op completes. Read after a keyring_store/get/delete to observe the result - e.g. the revealed secret from a keyring_get (KeyringResult::Retrieved).

Source

pub fn get_permission_status(&self, capability: Capability) -> PermissionState

Read the most recently observed permission state for capability (Camera / Microphone / Geolocation / Sensors / Notifications / …) — e.g. so a callback can check a capability is Granted before using it (show a camera preview only once granted). Kept live by the platform permission backend; a capability is subscribed by mounting its probe node (CameraProbe / GeolocationProbe / …) into the DOM.

Source

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

Source

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

Source

pub fn is_pen_in_contact(&self) -> bool

Check if pen is currently in contact with surface

Source

pub fn is_pen_eraser(&self) -> bool

Check if pen is in eraser mode

Source

pub fn is_pen_barrel_button_pressed(&self) -> bool

Check if pen barrel button is pressed

Source

pub fn get_last_input_sample(&self) -> Option<&InputSample>

Get the last recorded input sample (for event_id and detailed input data)

Source

pub fn get_current_event_id(&self) -> Option<u64>

Get the event ID of the current event

Source

pub fn get_swipe_direction(&self) -> OptionGestureDirection

Returns the dominant direction of the current swipe gesture, if any. Detection uses the touch / pointer trajectory and a velocity threshold; on iOS / Android the platform backend may override the in-process detector with a native gesture-recognizer result.

Source

pub fn get_pinch(&self) -> OptionDetectedPinch

Returns the active pinch gesture (scale + center + distances), if any.

Source

pub fn get_rotation(&self) -> OptionDetectedRotation

Returns the active rotation gesture (radians + center), if any.

Source

pub fn get_long_press(&self) -> OptionDetectedLongPress

Returns the active long-press, if the user is currently holding a pointer in place beyond the configured threshold.

Source

pub fn was_double_clicked(&self) -> bool

True iff the gesture manager classified the current event sequence as a double-click / double-tap.

Source

pub fn set_focus_to_node(&mut self, dom_id: DomId, node_id: NodeId)

Set focus to a specific DOM node by ID

Source

pub fn set_focus_to_path(&mut self, dom_id: DomId, css_path: CssPath)

Set focus to a node matching a CSS path

Source

pub fn focus_next(&mut self)

Move focus to next focusable element in tab order

Source

pub fn focus_previous(&mut self)

Move focus to previous focusable element in tab order

Source

pub fn focus_first(&mut self)

Move focus to first focusable element

Source

pub fn focus_last(&mut self)

Move focus to last focusable element

Source

pub fn clear_focus(&mut self)

Remove focus from all elements

Source

pub fn is_dragging(&self) -> bool

Check if a drag gesture is currently active

Convenience method that queries the gesture manager.

Source

pub fn get_focused_node(&self) -> Option<DomNodeId>

Get the currently focused node (if any)

Returns None if no node has focus.

Source

pub fn has_focus(&self, node_id: DomNodeId) -> bool

Check if a specific node has focus

Source

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.

Source

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.

Source

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. Uses gesture_drag_manager as the primary source of truth, with drag_drop_manager as fallback.

Source

pub fn is_node_drag_active(&self) -> bool

Check if a node drag is specifically active

Source

pub fn is_file_drag_active(&self) -> bool

Check if a file drag is specifically active

Source

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. Checks gesture_drag_manager first, then falls back to drag_drop_manager.

Source

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.

Source

pub fn get_current_hit_test(&self) -> Option<&FullHitTest>

Get the current mouse cursor hit test result (most recent frame)

Source

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.)

Source

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

Source

pub fn has_sufficient_history_for_gestures(&self) -> bool

Check if there’s sufficient mouse history for gesture detection (at least 2 frames)

Source

pub fn get_file_drop_manager(&self) -> &FileDropManager

Get immutable reference to the file drop manager

Source

pub fn get_drag_drop_manager(&self) -> &DragDropManager

Get immutable reference to the drag-drop manager

Source

pub fn get_dragged_node(&self) -> Option<DomNodeId>

Get the node being dragged (if any)

Source

pub fn get_dragged_file(&self) -> Option<&AzString>

Get the file path being dragged (if any)

Source

pub fn get_drag_types(&self) -> Vec<AzString>

Get the MIME types available in the current drag data.

W3C equivalent: dataTransfer.types Returns an empty vec if no drag is active or no data is set.

Source

pub fn get_drag_data(&self, mime_type: &str) -> Option<Vec<u8>>

Get drag data for a specific MIME type.

W3C equivalent: dataTransfer.getData(type) Returns None if no drag is active or the MIME type is not set.

Source

pub fn set_drag_data(&mut self, mime_type: AzString, data: Vec<u8>)

Set drag data for a MIME type on the active drag operation.

W3C equivalent: dataTransfer.setData(type, data) Should be called from a DragStart callback to populate the drag data.

Source

pub fn accept_drop(&mut self)

Accept the current drop operation on this node.

W3C equivalent: calling event.preventDefault() in a DragOver handler. This signals that the current drop target can accept the dragged data. Must be called from a DragOver or DragEnter callback for the Drop event to fire on this node.

Source

pub fn set_drop_effect(&mut self, effect: DropEffect)

Set the drop effect for the current drag operation.

W3C equivalent: dataTransfer.dropEffect = "move"|"copy"|"link" Should be called from a DragOver or DragEnter callback.

Source

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.

Source

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)

Source

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

Source

pub fn get_scroll_node_info( &self, dom_id: DomId, node_id: NodeId, ) -> Option<ScrollNodeInfo>

Get a read-only snapshot of a scroll node’s bounds and position.

This is the recommended API for timer callbacks that need to compute scroll physics. Returns container/content rects and max scroll bounds.

Source

pub fn get_scroll_delta( &self, _dom_id: DomId, _node_id: NodeId, ) -> Option<LogicalPosition>

Deprecated: Returns None. Scroll deltas are no longer tracked per-frame. Kept for FFI backward compatibility.

Source

pub fn had_scroll_activity(&self, _dom_id: DomId, _node_id: NodeId) -> bool

Deprecated: Returns false. Scroll activity flags were removed. Kept for FFI backward compatibility.

Source

pub fn find_scroll_parent( &self, dom_id: DomId, node_id: NodeId, ) -> Option<NodeId>

Find the closest scrollable ancestor of a node.

Walks up the node hierarchy to find a node registered in the ScrollManager. Used by auto-scroll timer to find which container to scroll.

Source

pub fn get_scroll_input_queue(&self) -> ScrollInputQueue

Get a clone of the scroll input queue for consuming pending inputs.

Timer callbacks use this to drain pending scroll inputs recorded by platform event handlers. The queue is thread-safe (Arc), so the timer can call take_all() with only &self.

Source

pub fn get_gpu_state_manager(&self) -> &GpuStateManager

Get immutable reference to the GPU state manager

Source

pub fn get_virtual_view_manager(&self) -> &VirtualViewManager

Get immutable reference to the VirtualView manager

Source

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.

Source

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.

Source

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).

Source

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.

Source

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)
Source

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.

Source

pub fn inspect_redo_operation( &self, node_id: NodeId, ) -> Option<&UndoableOperation>

Inspect a pending redo operation

Returns the operation that would be reapplied.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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 content
  • None - If no paste operation is active or clipboard is empty
Source

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
Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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
Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Source

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).

Source

pub fn move_cursor_left(&mut self, target: DomNodeId, extend_selection: bool)

Move cursor left (arrow left key)

§Arguments
  • target - The node containing the cursor
  • extend_selection - If true, extends selection (Shift+Left); if false, moves cursor
Source

pub fn move_cursor_right(&mut self, target: DomNodeId, extend_selection: bool)

Move cursor right (arrow right key)

Source

pub fn move_cursor_up(&mut self, target: DomNodeId, extend_selection: bool)

Move cursor up (arrow up key)

Source

pub fn move_cursor_down(&mut self, target: DomNodeId, extend_selection: bool)

Move cursor down (arrow down key)

Source

pub fn move_cursor_to_line_start( &mut self, target: DomNodeId, extend_selection: bool, )

Move cursor to line start (Home key)

Source

pub fn move_cursor_to_line_end( &mut self, target: DomNodeId, extend_selection: bool, )

Move cursor to line end (End key)

Source

pub fn move_cursor_to_document_start( &mut self, target: DomNodeId, extend_selection: bool, )

Move cursor to document start (Ctrl+Home)

Source

pub fn move_cursor_to_document_end( &mut self, target: DomNodeId, extend_selection: bool, )

Move cursor to document end (Ctrl+End)

Source

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.

Source

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

Source§

fn clone(&self) -> CallbackInfo

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CallbackInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for CallbackInfo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.