Skip to main content

Module callbacks

Module callbacks 

Source
Expand description

Callback types: layout, event, timer, thread, and focus handling. Callback types for the Azul UI framework.

This module defines the callback infrastructure used by the event system, layout engine, and virtual view rendering. Key design patterns:

  • Core vs Layout callback split: CoreCallbackType and CoreRenderImageCallbackType store function pointers as usize to avoid circular dependencies between azul-core and azul-layout. The actual function pointer types are defined in azul-layout and transmuted at invocation time.

  • FFI callable pattern: Callback structs carry an optional ctx: OptionRefAny field that holds a foreign callable (e.g. a Python function object). The extern "C" trampoline stored in cb extracts both the user data and the foreign callable from RefAny and dispatches the call. Native Rust code sets ctx to None.

  • Info structs: LayoutCallbackInfo, VirtualViewCallbackInfo, and the layout-side CallbackInfo provide read-only access to framework resources (fonts, images, GL context, window size) during callback invocation.

Structs§

CoreCallback
Stores a callback as usize (actually a function pointer cast to usize)
CoreCallbackData
Data associated with a callback (event filter, callback, and user data)
CoreCallbackDataVec
CoreCallbackDataVecSlice
C-compatible slice type for $struct_name. This is a non-owning view into a Vec’s data.
CoreImageCallback
Image callback with associated data
CoreRenderImageCallback
Callback that returns a rendered OpenGL texture (usize placeholder)
FocusTargetPath
HidpiAdjustedBounds
Information about the bounds of a laid-out div rectangle.
LayoutCallback
Wrapper around the layout callback
LayoutCallbackInfo
LayoutCallbackInfoRefData
Gives the layout() function access to the RendererResources and the Window (for querying images and fonts, as well as width / height)
TimerCallbackReturn
VirtualViewCallback
Callback that, given a rectangle area on the screen, returns the DOM appropriate for that bounds (useful for infinite lists)
VirtualViewCallbackInfo
VirtualViewReturn
Return value for a VirtualView rendering callback.

Enums§

CoreCallbackDataVecDestructor
EdgeType
Which edge triggered a scroll-based re-invocation
FocusTarget
Defines the focus_targeted node ID for the next frame
OptionCoreCallback
OptionCoreCallbackData
OptionCoreImageCallback
RelayoutReason
What triggered the current layout() invocation.
Update
Specifies if the screen should be updated after the callback function has returned
VirtualViewCallbackReason
Reason why a VirtualView callback is being invoked.

Statics§

LAYOUT_CALLBACK_INVOKER
Process-global slot for this callback kind’s host-side invoker.
VIRTUAL_VIEW_CALLBACK_INVOKER
Process-global slot for this callback kind’s host-side invoker.

Functions§

AzApp_setLayoutCallbackInvoker
Register the host-side invoker for this callback kind.
AzApp_setVirtualViewCallbackInvoker
Register the host-side invoker for this callback kind.
AzLayoutCallback_createFromHostHandle
C-ABI export wrapping <Wrapper>::create_from_host_handle.
AzVirtualViewCallback_createFromHostHandle
C-ABI export wrapping <Wrapper>::create_from_host_handle.

Type Aliases§

AzLayoutCallbackInvoker
Pointer-arg variant of this callback kind’s typedef.
AzVirtualViewCallbackInvoker
Pointer-arg variant of this callback kind’s typedef.
CoreCallbackDataVecDestructorType
CoreCallbackType
Core callback type - uses usize instead of function pointer to avoid circular dependencies.
CoreRenderImageCallbackType
Image rendering callback type - uses usize instead of function pointer
LayoutCallbackType
Callback function pointer (has to be a function pointer in order to be compatible with C APIs later on).
MeasureDomFn
Trampoline signature for VirtualViewCallbackInfo::measure_dom: (layout_window_ctx, dom, available) -> content extent. The Dom is passed by pointer and CONSUMED (moved out) by the trampoline.
VirtualViewCallbackType