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

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 modify_window_state(&mut self, state: FullWindowState)

Modify the window state (applied after callback returns)

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

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 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_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 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 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>

Source

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

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

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

Source

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

Check if a DOM has any selection

Source

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

Get the primary cursor for a DOM (first in selection list)

Source

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

Get all selection ranges (excludes plain cursors)

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

Source

pub fn get_cursor_relative_to_viewport(&self) -> OptionLogicalPosition

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_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 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 get_selection_manager(&self) -> &SelectionManager

Get immutable reference to the selection manager

Use this to query text selections across multiple nodes.

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

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. Uses legacy DragState type for backwards compatibility.

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_all_selections(&self) -> &BTreeMap<DomId, SelectionState>

Get all selections across all DOMs

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

Source

pub fn had_scroll_activity(&self, dom_id: DomId, node_id: NodeId) -> bool

Check if a node had scroll activity this frame

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_gpu_state_manager(&self) -> &GpuStateManager

Get immutable reference to the GPU state manager

Source

pub fn get_iframe_manager(&self) -> &IFrameManager

Get immutable reference to the IFrame 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 · 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.
Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool