#[repr(C)]pub struct LayoutCallbackInfoRefData<'a> {
pub image_cache: &'a ImageCache,
pub gl_context: &'a OptionGlContextPtr,
pub system_fonts: &'a FcFontCache,
pub system_style: Arc<SystemStyle>,
pub active_route: Option<&'a RouteMatch>,
pub monitors: MonitorVec,
pub safe_area: SafeAreaInsets,
}Expand description
Gives the layout() function access to the RendererResources and the Window
(for querying images and fonts, as well as width / height)
Reference data container for LayoutCallbackInfo (all read-only fields)
This struct consolidates all readonly references that layout callbacks need to query state.
By grouping these into a single struct, we reduce the number of parameters to
LayoutCallbackInfo::new() from 6 to 2, making the API more maintainable and easier to extend.
This is pure syntax sugar - the struct lives on the stack in the caller and is passed by reference.
Fields§
§image_cache: &'a ImageCacheAllows the layout() function to reference image IDs
gl_context: &'a OptionGlContextPtrOpenGL context so that the layout() function can render textures
system_fonts: &'a FcFontCacheReference to the system font cache
system_style: Arc<SystemStyle>Platform-specific system style (colors, spacing, etc.) Used for CSD rendering and menu windows.
active_route: Option<&'a RouteMatch>Active route match (if routing is configured). Contains the matched pattern and extracted parameters.
monitors: MonitorVec#28 (d): SNAPSHOT of the system’s monitors, taken (locked + cloned)
by the caller right before invoking the layout callback. A snapshot —
not the live Arc<Mutex<…>> handle — because azul-core is no_std
(no Mutex) and the list is read-only during a layout pass anyway.
Lets layout() bound how much content it builds on first layout
(e.g. at most monitor-height lines / monitor-area characters), so
opening a huge file can never build an unbounded DOM.
safe_area: SafeAreaInsetsSafe-area insets: system bars, notch/cutout, and the on-screen keyboard’s height. Live values, not the platform defaults.
layout() needs these and could not reach them: they live on
LayoutWindow and were exposed only through CallbackInfo, which is
the EVENT callback. So an app could read the notch from a click handler
and not from the function that decides where to draw — which is the one
place it matters. A mobile app that must not draw under the status bar
had no way to ask how tall it is.