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:
CoreCallbackTypeandCoreRenderImageCallbackTypestore function pointers asusizeto avoid circular dependencies betweenazul-coreandazul-layout. The actual function pointer types are defined inazul-layoutand transmuted at invocation time. -
FFI callable pattern: Callback structs carry an optional
ctx: OptionRefAnyfield that holds a foreign callable (e.g. a Python function object). Theextern "C"trampoline stored incbextracts both the user data and the foreign callable fromRefAnyand dispatches the call. Native Rust code setsctxtoNone. -
Info structs:
LayoutCallbackInfo,VirtualViewCallbackInfo, and the layout-sideCallbackInfoprovide read-only access to framework resources (fonts, images, GL context, window size) during callback invocation.
Structs§
- Core
Callback - Stores a callback as usize (actually a function pointer cast to usize)
- Core
Callback Data - Data associated with a callback (event filter, callback, and user data)
- Core
Callback Data Vec - Core
Callback Data VecSlice - C-compatible slice type for
$struct_name. This is a non-owning view into a Vec’s data. - Core
Image Callback - Image callback with associated data
- Core
Render Image Callback - Callback that returns a rendered OpenGL texture (usize placeholder)
- Focus
Target Path - Hidpi
Adjusted Bounds - Information about the bounds of a laid-out div rectangle.
- Layout
Callback - Wrapper around the layout callback
- Layout
Callback Info - Layout
Callback Info RefData - Gives the
layout()function access to theRendererResourcesand theWindow(for querying images and fonts, as well as width / height) - Timer
Callback Return - Virtual
View Callback - Callback that, given a rectangle area on the screen, returns the DOM appropriate for that bounds (useful for infinite lists)
- Virtual
View Callback Info - Virtual
View Return - Return value for a
VirtualViewrendering callback.
Enums§
- Core
Callback Data VecDestructor - Edge
Type - Which edge triggered a scroll-based re-invocation
- Focus
Target - Defines the
focus_targetednode ID for the next frame - Option
Core Callback - Option
Core Callback Data - Option
Core Image Callback - Relayout
Reason - What triggered the current
layout()invocation. - Update
- Specifies if the screen should be updated after the callback function has returned
- Virtual
View Callback Reason - Reason why a
VirtualViewcallback 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_
setLayout Callback Invoker - Register the host-side invoker for this callback kind.
- AzApp_
setVirtual View Callback Invoker - Register the host-side invoker for this callback kind.
- AzLayout
Callback_ create From Host Handle - C-ABI export wrapping
<Wrapper>::create_from_host_handle. - AzVirtual
View Callback_ create From Host Handle - C-ABI export wrapping
<Wrapper>::create_from_host_handle.
Type Aliases§
- AzLayout
Callback Invoker - Pointer-arg variant of this callback kind’s typedef.
- AzVirtual
View Callback Invoker - Pointer-arg variant of this callback kind’s typedef.
- Core
Callback Data VecDestructor Type - Core
Callback Type - Core callback type - uses usize instead of function pointer to avoid circular dependencies.
- Core
Render Image Callback Type - Image rendering callback type - uses usize instead of function pointer
- Layout
Callback Type - Callback function pointer (has to be a function pointer in order to be compatible with C APIs later on).
- Measure
DomFn - Trampoline signature for
VirtualViewCallbackInfo::measure_dom:(layout_window_ctx, dom, available) -> content extent. TheDomis passed by pointer and CONSUMED (moved out) by the trampoline. - Virtual
View Callback Type