natiny_view_create
C
NatinyView natiny_view_create(uint32_t layout);
Creates a view: a rectangle that is sized and placed by the rules set on it
and on its parent, and that lays out its own children by layout.
Parameters
| Name |
Type |
Description |
layout |
uint32_t |
How this view places its children; one of the constants below |
Layouts
| Constant |
Children are placed |
NATINY_LAYOUT_FREE |
Each at the size it needs in the top-left corner of the content box, moved by its offset; one that expands covers the whole box |
NATINY_LAYOUT_VERTICAL |
Top to bottom from the top, gap apart, each stretched to the full width |
NATINY_LAYOUT_HORIZONTAL |
Left to right from the left, gap apart, each stretched to the full height |
NATINY_LAYOUT_CENTER |
Each in the middle of the content box, at the size it needs |
NATINY_LAYOUT_GRID |
In cells, left to right and top to bottom from the top-left corner, each filling its cell; see natiny_view_set_columns and natiny_view_set_rows |
Returns
| Type |
Description |
NatinyView |
View handle, or 0 when memory ran out |
Example
C
NatinyView root = natiny_view_create(NATINY_LAYOUT_VERTICAL);
NatinyView header = natiny_view_create(NATINY_LAYOUT_HORIZONTAL);
natiny_view_set_parent(header, root);
Notes
- A new view asks for no size, does not expand, is visible and pickable,
and has no hooks.