139#ifndef APPCORE_CAPI_LAYOUT_H
140#define APPCORE_CAPI_LAYOUT_H
195static inline ULLayoutSize ulLayoutSizePx(
double value) {
208static inline ULLayoutSize ulLayoutSizePct(
double value) {
218static inline ULLayoutSize ulLayoutSizeFr(
double value) {
Common declarations for the AppCore C API.
struct C_Window * ULWindow
Opaque handle to a Window object.
Definition CAPI_Defines.h:43
#define ACExport
Definition CAPI_Defines.h:28
Text-editing interface for a View.
ULPanel ulWindowGetFocusedPanel(ULWindow window)
Get the panel holding keyboard focus.
ULContainer ulWindowGetLayout(ULWindow window)
Get a window's layout, the root container of the tiled panel tree (a column).
void(*) ULEditableStateCallback(void *user_data, ULWindow window, ULPanel panel, ULEditableState state)
The callback invoked when the focused panel's editable state changes.
Definition CAPI_Layout.h:534
ULLayoutNode ulContainerAsLayoutNode(ULContainer container)
Get a container's base layout-node handle.
ULContainer ulLayoutNodeGetParent(ULLayoutNode node)
Get the node's parent container.
ULPanel ulCreatePanelRef(ULPanel panel)
Duplicate a panel handle.
ULForeground ulCreateForegroundRef(ULForeground foreground)
Duplicate a foreground handle.
void(*) ULLayoutNodeCallback(void *user_data, ULLayoutNode node)
The callback invoked for a layout node event.
Definition CAPI_Layout.h:493
void ulPanelBringToFront(ULPanel panel)
Bring a floating panel to the top of the foreground layer.
void ulLayoutNodeSetLayoutChangeCallback(ULLayoutNode node, ULLayoutNodeCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data)
Set callback for when layout changes the node's bounds.
void ulContainerSetDividerStyle(ULContainer container, const ULDividerStyleDesc *style)
Set this container's divider style, overriding the window style field by field for the dividers betwe...
bool ulLayoutNodeIsHidden(ULLayoutNode node)
Whether or not the node is hidden.
void ulLayoutNodeSetSize(ULLayoutNode node, ULLayoutSize size)
Set the node's declared size along its container's axis.
void ulPanelFocus(ULPanel panel)
Grant the panel exclusive keyboard focus.
bool ulContainerHasLayoutOverride(ULContainer container)
Whether or not a container has a layout delegate installed.
ULAnchorCorner
A window corner (kULAnchorKind_WindowCorner).
Definition CAPI_Layout.h:391
@ kULAnchorCorner_BottomRight
Definition CAPI_Layout.h:395
@ kULAnchorCorner_BottomLeft
Definition CAPI_Layout.h:394
@ kULAnchorCorner_TopLeft
Definition CAPI_Layout.h:392
@ kULAnchorCorner_TopRight
Definition CAPI_Layout.h:393
bool ulWindowIsSame(ULWindow a, ULWindow b)
Whether or not two handles refer to the same window.
ULPanel ulLayoutNodeAsPanel(ULLayoutNode node)
Get a node as a panel.
int ulForegroundGetPanelCount(ULForeground foreground)
Get the number of floating panels (hidden panels included).
void ulContainerSetLayoutOverride(ULContainer container, ULLayoutOverrideCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data)
Override a container's layout with a layout delegate.
bool ulContainerIsAlive(ULContainer container)
Whether or not the container is still part of a live window's tree.
ULLayoutFlags
Flags for the desc structs' flags field.
Definition CAPI_Layout.h:249
@ kULLayoutFlags_Fixed
The user cannot resize this node with a divider drag (panels and containers).
Definition CAPI_Layout.h:250
@ kULLayoutFlags_Hidden
Created hidden, shows later without a layout flash (all descs).
Definition CAPI_Layout.h:252
@ kULLayoutFlags_Resizable
The user can resize this container's children by dragging the dividers between them (containers only)...
Definition CAPI_Layout.h:254
ULPanel ulContainerAdoptPanel(ULContainer container, const ULPanelDesc *desc, ULView view, ULLayoutNode insert_before)
Create a panel that adopts an existing View (including a View created through a Session).
bool ulContainerRemove(ULContainer container, ULLayoutNode node)
Remove a direct child (and, for a container child, its whole subtree) from the tree.
void ulLayoutNodeSetMaxSize(ULLayoutNode node, ULLayoutSize max_size)
Set the node's maximum size constraint (px or percent, an fr unit is ignored with a warning).
ULPanel ulContainerFindPanel(ULContainer container, const char *key)
Find a descendant panel by key.
ULLayoutNode ulContainerGetChildAt(ULContainer container, int index)
Get the child at an index.
ULView ulPanelGetView(ULPanel panel)
Get the panel's hosted View.
ULLayoutRect ulLayoutNodeGetBounds(ULLayoutNode node)
Get the node's rect from the most recent layout, in container-local logical pixels.
void(*) ULLayoutOverrideCallback(void *user_data, ULContainer container, ULLayoutRect content_box)
The callback invoked to lay out a container's children manually.
Definition CAPI_Layout.h:547
ULPanel ulWindowAddPanel(ULWindow window, const ULPanelDesc *desc, ULViewConfig view_config)
Add a panel to the window's root container.
bool ulForegroundIsAlive(ULForeground foreground)
Whether or not the foreground still belongs to a live window.
ULLayoutNode ulPanelAsLayoutNode(ULPanel panel)
Get a panel's base layout-node handle.
void(*) ULFocusChangeCallback(void *user_data, ULWindow window, ULPanel focused)
The callback invoked when a window's focused panel changes.
Definition CAPI_Layout.h:518
bool ulLayoutNodeIsAlive(ULLayoutNode node)
Whether or not the node is still part of a live window's tree.
void ulLayoutNodeSetBounds(ULLayoutNode node, ULLayoutRect bounds)
Place the node manually, in container-local logical pixels.
void ulWindowConfigureLayout(ULWindow window, const ULContainerDesc *desc)
Configure the window's root container.
ULContainer ulLayoutNodeAsContainer(ULLayoutNode node)
Get a node as a container.
void ulDestroyContainer(ULContainer container)
Destroy a container handle.
struct C_Foreground * ULForeground
Opaque handle to a window's foreground layer (floating panels composited above the tiled layout).
Definition CAPI_Layout.h:164
ULPanel ulForegroundGetPanelAt(ULForeground foreground, int index)
Get the floating panel at an index in current z-order, bottom-most first.
void ulLayoutNodeHide(ULLayoutNode node)
Hide the node, redistributing its space to its siblings.
void ulPanelSetDismissCallback(ULPanel panel, ULPanelCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data)
Set callback for when the library dismisses a floating panel (an auto-dismiss trigger,...
struct C_LayoutNode * ULLayoutNode
Opaque handle to a layout node, the shared base of panels and containers.
Definition CAPI_Layout.h:152
ULLayoutNodeKind ulLayoutNodeGetKind(ULLayoutNode node)
Get the kind of a layout node.
ULPanel ulContainerAddPanel(ULContainer container, const ULPanelDesc *desc, ULViewConfig view_config, ULLayoutNode insert_before)
Create a panel in a container.
ULLayoutNodeKind
The kind of a layout node.
Definition CAPI_Layout.h:240
@ kULLayoutNodeKind_Container
Definition CAPI_Layout.h:243
@ kULLayoutNodeKind_None
NULL or invalid handle.
Definition CAPI_Layout.h:241
@ kULLayoutNodeKind_Panel
Definition CAPI_Layout.h:242
ULLayoutSizeUnit
The unit of a ULLayoutSize.
Definition CAPI_Layout.h:169
@ kULLayoutSizeUnit_Pct
For a size, percent of the container's free space.
Definition CAPI_Layout.h:172
@ kULLayoutSizeUnit_Default
Unset: the receiving field's default applies.
Definition CAPI_Layout.h:170
@ kULLayoutSizeUnit_Fr
A flex factor (sizes only).
Definition CAPI_Layout.h:174
@ kULLayoutSizeUnit_Px
Logical pixels.
Definition CAPI_Layout.h:171
void ulLayoutNodeSetMinSize(ULLayoutNode node, ULLayoutSize min_size)
Set the node's minimum size constraint (px or percent, an fr unit is ignored with a warning).
ULAnchorKind
The placement form of a ULAnchorDesc.
Definition CAPI_Layout.h:379
@ kULAnchorKind_WindowCorner
A window corner, following the window.
Definition CAPI_Layout.h:383
@ kULAnchorKind_Below
Under an anchor rect in a target panel.
Definition CAPI_Layout.h:385
@ kULAnchorKind_WindowCenter
Centered in the window, following the window.
Definition CAPI_Layout.h:384
@ kULAnchorKind_At
Absolute window-space logical px.
Definition CAPI_Layout.h:382
@ kULAnchorKind_Default
The window origin (with the default 100% sizes, a full-window panel).
Definition CAPI_Layout.h:380
ULContainer ulContainerAddRow(ULContainer container, const ULContainerDesc *desc, ULLayoutNode insert_before)
Create a child row container (children arranged horizontally).
ULLayoutNode ulCreateLayoutNodeRef(ULLayoutNode node)
Duplicate a layout-node handle.
ULFocusPolicy
Keyboard-focus policy for a foreground (floating) panel.
Definition CAPI_Layout.h:366
@ kULFocusPolicy_Auto
Takes focus when clicked, like any panel.
Definition CAPI_Layout.h:367
@ kULFocusPolicy_None
Never takes keyboard focus.
Definition CAPI_Layout.h:372
@ kULFocusPolicy_Grab
Takes keyboard focus when created (unless hidden) and each time it is shown, even from inside a click...
Definition CAPI_Layout.h:369
void ulDestroyPanel(ULPanel panel)
Destroy a panel handle.
ULContainer ulContainerFindContainer(ULContainer container, const char *key)
Find a descendant container by key.
ULPanel ulForegroundAdoptPanel(ULForeground foreground, const ULForegroundPanelDesc *desc, ULView view)
Create a floating panel that adopts an existing View (including one created through a Session,...
void ulLayoutNodeSetUserResizeCallback(ULLayoutNode node, ULLayoutNodeCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data)
Set callback for when the user resizes the node with a divider.
ULLayoutDeviceRect ulLayoutNodeGetDeviceBounds(ULLayoutNode node)
Get the node's rect from the most recent layout, in window back-buffer device pixels.
int ulContainerGetChildCount(ULContainer container)
Get the number of children.
ULForeground ulWindowGetForeground(ULWindow window)
Get a window's foreground layer, which holds floating panels displayed above the window's layout (eg,...
void ulLayoutNodeShow(ULLayoutNode node)
Show the node again, restoring its remembered size exactly.
ULLayoutNode ulContainerFind(ULContainer container, const char *key)
Find a descendant by key.
ULPanel ulForegroundAddPanel(ULForeground foreground, const ULForegroundPanelDesc *desc, ULViewConfig view_config)
Create a floating panel, composited above every tiled panel.
ULPanel ulWindowFindPanel(ULWindow window, const char *key)
Find a panel by key anywhere in the window: the tiled layout first, then the foreground layer.
void ulDestroyForeground(ULForeground foreground)
Destroy a foreground handle.
void ulWindowSetDividerStyle(ULWindow window, const ULDividerStyleDesc *style)
Set the window-level divider style, the field-by-field fallback for every resizable container that do...
void ulContainerRemoveAll(ULContainer container)
Remove every child.
void ulWindowClearFocus(ULWindow window)
Take keyboard focus away from every panel.
ULContainer ulCreateContainerRef(ULContainer container)
Duplicate a container handle.
ULString ulLayoutNodeGetKey(ULLayoutNode node)
Get the node's key (empty if unkeyed).
void ulWindowSetFocusChangeCallback(ULWindow window, ULFocusChangeCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data)
Set callback for when the window's focused panel changes (the new panel may be NULL).
bool ulPanelIsAlive(ULPanel panel)
Whether or not the panel is still part of a live window's tree.
bool ulContainerMove(ULContainer container, ULLayoutNode node, ULLayoutNode move_before)
Reorder a direct child within its container.
void ulDestroyLayoutNode(ULLayoutNode node)
Destroy a layout-node handle.
void(*) ULPanelCallback(void *user_data, ULPanel panel)
The callback invoked for a panel event.
Definition CAPI_Layout.h:503
bool ulForegroundRemove(ULForeground foreground, ULPanel panel)
Remove a floating panel from the foreground layer.
ULAnchorAlign
Cross-axis alignment of the floating panel against its anchor rect (kULAnchorKind_Below).
Definition CAPI_Layout.h:401
@ kULAnchorAlign_End
Right edges align.
Definition CAPI_Layout.h:404
@ kULAnchorAlign_Center
Definition CAPI_Layout.h:403
@ kULAnchorAlign_Start
Left edges align.
Definition CAPI_Layout.h:402
void ulWindowSetEditableStateCallback(ULWindow window, ULEditableStateCallback callback, void *user_data, ULUserDataDestroyCallback destroy_user_data)
Set callback for when the focused panel's editable state changes.
int ulLayoutNodeGetIndex(ULLayoutNode node)
Get the node's index within its parent.
ULAnchorFit
Fit behavior when an anchored floating panel does not fit on its preferred side (kULAnchorKind_Below)...
Definition CAPI_Layout.h:411
@ kULAnchorFit_None
Definition CAPI_Layout.h:412
@ kULAnchorFit_Flip
Place above the rect when it does not fit beneath.
Definition CAPI_Layout.h:413
ULContainer ulContainerAddColumn(ULContainer container, const ULContainerDesc *desc, ULLayoutNode insert_before)
Create a child column container (children arranged vertically).
struct C_Container * ULContainer
Opaque handle to a container (a row or column of child nodes).
Definition CAPI_Layout.h:160
struct C_Panel * ULPanel
Opaque handle to a panel (a layout node hosting a View).
Definition CAPI_Layout.h:156
ULPanel ulForegroundFindPanel(ULForeground foreground, const char *key)
Find a floating panel by key.
bool ulLayoutNodeIsSame(ULLayoutNode a, ULLayoutNode b)
Whether or not two handles refer to the same node.
struct C_View * ULView
Opaque handle to a View object.
Definition CAPI_Defines.h:87
struct C_String * ULString
Opaque handle to a String object.
Definition CAPI_Defines.h:96
struct C_ViewConfig * ULViewConfig
Opaque handle to a ViewConfig object.
Definition CAPI_Defines.h:84
void(*) ULUserDataDestroyCallback(void *user_data)
Callback invoked exactly once when the library finally drops a piece of user data.
Definition CAPI_Defines.h:139
Placement for a foreground (floating) panel, the flattened form of the C++ Anchor.
Definition CAPI_Layout.h:422
ULLayoutRect rect
Below: the anchor rect in the target panel's local logical px, which equals the hosted page's CSS px ...
Definition CAPI_Layout.h:442
double offset_y
Definition CAPI_Layout.h:430
double offset_x
A logical-px nudge applied after any placement form resolves.
Definition CAPI_Layout.h:429
ULPanel target
Below: the panel the anchor rect is local to (borrowed at the call, the floating panel keeps its own ...
Definition CAPI_Layout.h:436
double y
Definition CAPI_Layout.h:428
unsigned char align
A ULAnchorAlign value (Below).
Definition CAPI_Layout.h:425
unsigned char fit
A ULAnchorFit value (Below).
Definition CAPI_Layout.h:426
unsigned char kind
A ULAnchorKind value.
Definition CAPI_Layout.h:423
unsigned char corner
A ULAnchorCorner value (WindowCorner).
Definition CAPI_Layout.h:424
double x
At: absolute window-space logical px.
Definition CAPI_Layout.h:427
A color value.
Definition CAPI_ColorTypes.h:45
Options for creating a container (a row or column of child nodes).
Definition CAPI_Layout.h:300
ULLayoutSize padding
Padding between the container's edges and its children, applied on all four sides (logical px only).
Definition CAPI_Layout.h:327
uint32_t flags
A ULLayoutFlags combination: Fixed, Resizable, Hidden.
Definition CAPI_Layout.h:315
uint32_t struct_size
Must be sizeof(ULContainerDesc).
Definition CAPI_Layout.h:301
ULLayoutSize min_size
Minimum size constraint (see ULPanelDesc.min_size).
Definition CAPI_Layout.h:310
ULLayoutSize gap
The gap between adjacent children (logical px only, other units are ignored with a warning).
Definition CAPI_Layout.h:321
ULLayoutSize size
The container's size along its parent's axis. Unset means one flex share (1fr).
Definition CAPI_Layout.h:307
ULLayoutSize max_size
Maximum size constraint (see ULPanelDesc.max_size).
Definition CAPI_Layout.h:313
const char * key
Optional identity for lookup and diagnostics (see ULPanelDesc.key).
Definition CAPI_Layout.h:304
Styling for the dividers between a resizable container's children.
Definition CAPI_Layout.h:337
double hit_width
The width of the divider's pointer target, in logical px.
Definition CAPI_Layout.h:343
ULColor color
The color of the divider line.
Definition CAPI_Layout.h:354
uint32_t struct_size
Must be sizeof(ULDividerStyleDesc).
Definition CAPI_Layout.h:338
ULColor hover_color
The hover highlight color, shown over the divider while the pointer rests on it or drags it.
Definition CAPI_Layout.h:360
double visual_thickness
The thickness of the painted divider line, in logical px.
Definition CAPI_Layout.h:348
The conditions that decide whether an input method should be active.
Definition CAPI_Editor.h:519
Options for creating a foreground (floating) panel.
Definition CAPI_Layout.h:452
unsigned char focus
The keyboard-focus policy, as a ULFocusPolicy value. (Default = kULFocusPolicy_Auto).
Definition CAPI_Layout.h:480
ULLayoutSize height
The panel's height (see width, percent of the window's height).
Definition CAPI_Layout.h:465
uint32_t flags
A ULLayoutFlags combination: Hidden.
Definition CAPI_Layout.h:482
ULAnchorDesc placement
Where the panel sits in the window. Zero-initialized means the window origin.
Definition CAPI_Layout.h:468
uint32_t struct_size
Must be sizeof(ULForegroundPanelDesc).
Definition CAPI_Layout.h:453
const char * key
Optional identity for lookup and diagnostics (see ULPanelDesc.key).
Definition CAPI_Layout.h:456
unsigned char dismiss
The auto-dismiss policy, as a ULDismiss value (see <AppCore/CAPI.h>).
Definition CAPI_Layout.h:477
ULLayoutSize width
The panel's width.
Definition CAPI_Layout.h:462
A rectangle in device pixels (window-backbuffer space).
Definition CAPI_Layout.h:228
int y
Definition CAPI_Layout.h:230
int width
Definition CAPI_Layout.h:231
int x
Definition CAPI_Layout.h:229
int height
Definition CAPI_Layout.h:232
A rectangle in logical (DPI-independent) pixels.
Definition CAPI_Defines.h:56
A size or constraint length, as a value plus a unit.
Definition CAPI_Layout.h:187
unsigned char unit
A ULLayoutSizeUnit value.
Definition CAPI_Layout.h:189
double value
The numeric value (px, percent points, or flex factor).
Definition CAPI_Layout.h:188
Options for creating a panel.
Definition CAPI_Layout.h:264
uint32_t flags
A ULLayoutFlags combination: Fixed, Hidden.
Definition CAPI_Layout.h:292
uint32_t struct_size
Must be sizeof(ULPanelDesc).
Definition CAPI_Layout.h:265
ULLayoutSize min_size
Minimum size constraint.
Definition CAPI_Layout.h:284
ULLayoutSize size
The panel's size along its container's axis.
Definition CAPI_Layout.h:278
ULLayoutSize max_size
Maximum size constraint.
Definition CAPI_Layout.h:290
const char * key
Optional identity for lookup (ulContainerFind()) and diagnostics, as null-terminated UTF-8 (copied).
Definition CAPI_Layout.h:272