|
Ultralight C++ API 2.0.0
|
Panels and containers for arranging web views across a window.
#include <AppCore/Layout.h>
The layout API arranges web content across an AppCore window using panels and containers. You declare sizes once, and the window recalculates the layout whenever it resizes or its display scale changes.
This example splits a window into a sidebar and a content pane:
A window's tiled layout forms a tree rooted at Window::layout(). The root container is a column that spans the window's content area, holding child Panels and nested row or column Containers. Each Panel hosts one View, while containers manage the placement and sizing of their children.
Floating panels sit outside this tree in the window's Foreground layer, reached through Window::foreground(). They float above tiled panels without shifting the layout underneath, which suits overlays such as toasts, menus, and heads-up displays.
This diagram shows the relationship between a window, its tiled layout tree, and its floating layer:
Choose the type that fits your layout task:
| Task | Type |
|---|---|
| Arrange views in rows or columns | Container |
| Host an individual web view | Panel |
| Float overlays above the layout | Foreground |
| Track bounds or listen for resizes | LayoutNode |
| Declare a whole layout in one expression | Window::BuildLayout() |
Every container and panel handle follows these conventions: