From feb1e321afc60da932f59a2933c75819e0185225 Mon Sep 17 00:00:00 2001
From: TomJGooding <101601846+TomJGooding@users.noreply.github.com>
Date: Tue, 10 Mar 2026 19:19:54 +0000
Subject: [PATCH] docs(layouting): fix code blocks
While browsing the documentation I noticed that the code blocks are
currently broken on the Layouting page.
I confess I'm not familiar with Doxygen, but simply removing a space
from the indentation seems to fix the issue!
Fixes https://github.com/Immediate-Mode-UI/Nuklear/issues/915
---
nuklear.h | 395 +++++++++++++++++++++++++-------------------------
src/nuklear.h | 395 +++++++++++++++++++++++++-------------------------
2 files changed, 394 insertions(+), 396 deletions(-)
diff --git a/nuklear.h b/nuklear.h
index 5939be954..5ab5e09d1 100644
--- a/nuklear.h
+++ b/nuklear.h
@@ -2202,8 +2202,7 @@ NK_API void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, nk
* To actually define a layout you just call the appropriate layouting function
* and each subsequent widget call will place the widget as specified. Important
* here is that if you define more widgets then columns defined inside the layout
- * functions it will allocate the next row without you having to make another layouting
- * call.
+ * functions it will allocate the next row without you having to make another layouting call.
*
* Biggest limitation with using all these APIs outside the `nk_layout_space_xxx` API
* is that you have to define the row height for each. However the row height
@@ -2228,202 +2227,202 @@ NK_API void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, nk
* functions should be fine.
*
* # Usage
- * 1. __nk_layout_row_dynamic__
- * The easiest layouting function is `nk_layout_row_dynamic`. It provides each
- * widgets with same horizontal space inside the row and dynamically grows
- * if the owning window grows in width. So the number of columns dictates
- * the size of each widget dynamically by formula:
- *
- * ```c
- * widget_width = (window_width - padding - spacing) * (1/column_count)
- * ```
- *
- * Just like all other layouting APIs if you define more widget than columns this
- * library will allocate a new row and keep all layouting parameters previously
- * defined.
- *
- * ```c
- * if (nk_begin_xxx(...) {
- * // first row with height: 30 composed of two widgets
- * nk_layout_row_dynamic(&ctx, 30, 2);
- * nk_widget(...);
- * nk_widget(...);
- * //
- * // second row with same parameter as defined above
- * nk_widget(...);
- * nk_widget(...);
- * //
- * // third row uses 0 for height which will use auto layouting
- * nk_layout_row_dynamic(&ctx, 0, 2);
- * nk_widget(...);
- * nk_widget(...);
- * }
- * nk_end(...);
- * ```
- *
- * 2. __nk_layout_row_static__
- * Another easy layouting function is `nk_layout_row_static`. It provides each
- * widget with same horizontal pixel width inside the row and does not grow
- * if the owning window scales smaller or bigger.
- *
- * ```c
- * if (nk_begin_xxx(...) {
- * // first row with height: 30 composed of two widgets with width: 80
- * nk_layout_row_static(&ctx, 30, 80, 2);
- * nk_widget(...);
- * nk_widget(...);
- * //
- * // second row with same parameter as defined above
- * nk_widget(...);
- * nk_widget(...);
- * //
- * // third row uses 0 for height which will use auto layouting
- * nk_layout_row_static(&ctx, 0, 80, 2);
- * nk_widget(...);
- * nk_widget(...);
- * }
- * nk_end(...);
- * ```
- *
- * 3. __nk_layout_row_xxx__
- * A little bit more advanced layouting API are functions `nk_layout_row_begin`,
- * `nk_layout_row_push` and `nk_layout_row_end`. They allow to directly
- * specify each column pixel or window ratio in a row. It supports either
- * directly setting per column pixel width or widget window ratio but not
- * both. Furthermore it is a immediate mode API so each value is directly
- * pushed before calling a widget. Therefore the layout is not automatically
- * repeating like the last two layouting functions.
- *
- * ```c
- * if (nk_begin_xxx(...) {
- * // first row with height: 25 composed of two widgets with width 60 and 40
- * nk_layout_row_begin(ctx, NK_STATIC, 25, 2);
- * nk_layout_row_push(ctx, 60);
- * nk_widget(...);
- * nk_layout_row_push(ctx, 40);
- * nk_widget(...);
- * nk_layout_row_end(ctx);
- * //
- * // second row with height: 25 composed of two widgets with window ratio 0.25 and 0.75
- * nk_layout_row_begin(ctx, NK_DYNAMIC, 25, 2);
- * nk_layout_row_push(ctx, 0.25f);
- * nk_widget(...);
- * nk_layout_row_push(ctx, 0.75f);
- * nk_widget(...);
- * nk_layout_row_end(ctx);
- * //
- * // third row with auto generated height: composed of two widgets with window ratio 0.25 and 0.75
- * nk_layout_row_begin(ctx, NK_DYNAMIC, 0, 2);
- * nk_layout_row_push(ctx, 0.25f);
- * nk_widget(...);
- * nk_layout_row_push(ctx, 0.75f);
- * nk_widget(...);
- * nk_layout_row_end(ctx);
- * }
- * nk_end(...);
- * ```
- *
- * 4. __nk_layout_row__
- * The array counterpart to API nk_layout_row_xxx is the single nk_layout_row
- * functions. Instead of pushing either pixel or window ratio for every widget
- * it allows to define it by array. The trade of for less control is that
- * `nk_layout_row` is automatically repeating. Otherwise the behavior is the
- * same.
- *
- * ```c
- * if (nk_begin_xxx(...) {
- * // two rows with height: 30 composed of two widgets with width 60 and 40
- * const float ratio[] = {60,40};
- * nk_layout_row(ctx, NK_STATIC, 30, 2, ratio);
- * nk_widget(...);
- * nk_widget(...);
- * nk_widget(...);
- * nk_widget(...);
- * //
- * // two rows with height: 30 composed of two widgets with window ratio 0.25 and 0.75
- * const float ratio[] = {0.25, 0.75};
- * nk_layout_row(ctx, NK_DYNAMIC, 30, 2, ratio);
- * nk_widget(...);
- * nk_widget(...);
- * nk_widget(...);
- * nk_widget(...);
- * //
- * // two rows with auto generated height composed of two widgets with window ratio 0.25 and 0.75
- * const float ratio[] = {0.25, 0.75};
- * nk_layout_row(ctx, NK_DYNAMIC, 30, 2, ratio);
- * nk_widget(...);
- * nk_widget(...);
- * nk_widget(...);
- * nk_widget(...);
- * }
- * nk_end(...);
- * ```
- *
- * 5. __nk_layout_row_template_xxx__
- * The most complex and second most flexible API is a simplified flexbox version without
- * line wrapping and weights for dynamic widgets. It is an immediate mode API but
- * unlike `nk_layout_row_xxx` it has auto repeat behavior and needs to be called
- * before calling the templated widgets.
- * The row template layout has three different per widget size specifier. The first
- * one is the `nk_layout_row_template_push_static` with fixed widget pixel width.
- * They do not grow if the row grows and will always stay the same.
- * The second size specifier is `nk_layout_row_template_push_variable`
- * which defines a minimum widget size but it also can grow if more space is available
- * not taken by other widgets.
- * Finally there are dynamic widgets with `nk_layout_row_template_push_dynamic`
- * which are completely flexible and unlike variable widgets can even shrink
- * to zero if not enough space is provided.
- *
- * ```c
- * if (nk_begin_xxx(...) {
- * // two rows with height: 30 composed of three widgets
- * nk_layout_row_template_begin(ctx, 30);
- * nk_layout_row_template_push_dynamic(ctx);
- * nk_layout_row_template_push_variable(ctx, 80);
- * nk_layout_row_template_push_static(ctx, 80);
- * nk_layout_row_template_end(ctx);
- * //
- * // first row
- * nk_widget(...); // dynamic widget can go to zero if not enough space
- * nk_widget(...); // variable widget with min 80 pixel but can grow bigger if enough space
- * nk_widget(...); // static widget with fixed 80 pixel width
- * //
- * // second row same layout
- * nk_widget(...);
- * nk_widget(...);
- * nk_widget(...);
- * }
- * nk_end(...);
- * ```
- *
- * 6. __nk_layout_space_xxx__
- * Finally the most flexible API directly allows you to place widgets inside the
- * window. The space layout API is an immediate mode API which does not support
- * row auto repeat and directly sets position and size of a widget. Position
- * and size hereby can be either specified as ratio of allocated space or
- * allocated space local position and pixel size. Since this API is quite
- * powerful there are a number of utility functions to get the available space
- * and convert between local allocated space and screen space.
- *
- * ```c
- * if (nk_begin_xxx(...) {
- * // static row with height: 500 (you can set column count to INT_MAX if you don't want to be bothered)
- * nk_layout_space_begin(ctx, NK_STATIC, 500, INT_MAX);
- * nk_layout_space_push(ctx, nk_rect(0,0,150,200));
- * nk_widget(...);
- * nk_layout_space_push(ctx, nk_rect(200,200,100,200));
- * nk_widget(...);
- * nk_layout_space_end(ctx);
- * //
- * // dynamic row with height: 500 (you can set column count to INT_MAX if you don't want to be bothered)
- * nk_layout_space_begin(ctx, NK_DYNAMIC, 500, INT_MAX);
- * nk_layout_space_push(ctx, nk_rect(0.5,0.5,0.1,0.1));
- * nk_widget(...);
- * nk_layout_space_push(ctx, nk_rect(0.7,0.6,0.1,0.1));
- * nk_widget(...);
- * }
- * nk_end(...);
- * ```
+ * 1. __nk_layout_row_dynamic__
+ * The easiest layouting function is `nk_layout_row_dynamic`. It provides each
+ * widgets with same horizontal space inside the row and dynamically grows
+ * if the owning window grows in width. So the number of columns dictates
+ * the size of each widget dynamically by formula:
+ *
+ * ```c
+ * widget_width = (window_width - padding - spacing) * (1/column_count)
+ * ```
+ *
+ * Just like all other layouting APIs if you define more widget than columns this
+ * library will allocate a new row and keep all layouting parameters previously
+ * defined.
+ *
+ * ```c
+ * if (nk_begin_xxx(...) {
+ * // first row with height: 30 composed of two widgets
+ * nk_layout_row_dynamic(&ctx, 30, 2);
+ * nk_widget(...);
+ * nk_widget(...);
+ * //
+ * // second row with same parameter as defined above
+ * nk_widget(...);
+ * nk_widget(...);
+ * //
+ * // third row uses 0 for height which will use auto layouting
+ * nk_layout_row_dynamic(&ctx, 0, 2);
+ * nk_widget(...);
+ * nk_widget(...);
+ * }
+ * nk_end(...);
+ * ```
+ *
+ * 2. __nk_layout_row_static__
+ * Another easy layouting function is `nk_layout_row_static`. It provides each
+ * widget with same horizontal pixel width inside the row and does not grow
+ * if the owning window scales smaller or bigger.
+ *
+ * ```c
+ * if (nk_begin_xxx(...) {
+ * // first row with height: 30 composed of two widgets with width: 80
+ * nk_layout_row_static(&ctx, 30, 80, 2);
+ * nk_widget(...);
+ * nk_widget(...);
+ * //
+ * // second row with same parameter as defined above
+ * nk_widget(...);
+ * nk_widget(...);
+ * //
+ * // third row uses 0 for height which will use auto layouting
+ * nk_layout_row_static(&ctx, 0, 80, 2);
+ * nk_widget(...);
+ * nk_widget(...);
+ * }
+ * nk_end(...);
+ * ```
+ *
+ * 3. __nk_layout_row_xxx__
+ * A little bit more advanced layouting API are functions `nk_layout_row_begin`,
+ * `nk_layout_row_push` and `nk_layout_row_end`. They allow to directly
+ * specify each column pixel or window ratio in a row. It supports either
+ * directly setting per column pixel width or widget window ratio but not
+ * both. Furthermore it is a immediate mode API so each value is directly
+ * pushed before calling a widget. Therefore the layout is not automatically
+ * repeating like the last two layouting functions.
+ *
+ * ```c
+ * if (nk_begin_xxx(...) {
+ * // first row with height: 25 composed of two widgets with width 60 and 40
+ * nk_layout_row_begin(ctx, NK_STATIC, 25, 2);
+ * nk_layout_row_push(ctx, 60);
+ * nk_widget(...);
+ * nk_layout_row_push(ctx, 40);
+ * nk_widget(...);
+ * nk_layout_row_end(ctx);
+ * //
+ * // second row with height: 25 composed of two widgets with window ratio 0.25 and 0.75
+ * nk_layout_row_begin(ctx, NK_DYNAMIC, 25, 2);
+ * nk_layout_row_push(ctx, 0.25f);
+ * nk_widget(...);
+ * nk_layout_row_push(ctx, 0.75f);
+ * nk_widget(...);
+ * nk_layout_row_end(ctx);
+ * //
+ * // third row with auto generated height: composed of two widgets with window ratio 0.25 and 0.75
+ * nk_layout_row_begin(ctx, NK_DYNAMIC, 0, 2);
+ * nk_layout_row_push(ctx, 0.25f);
+ * nk_widget(...);
+ * nk_layout_row_push(ctx, 0.75f);
+ * nk_widget(...);
+ * nk_layout_row_end(ctx);
+ * }
+ * nk_end(...);
+ * ```
+ *
+ * 4. __nk_layout_row__
+ * The array counterpart to API nk_layout_row_xxx is the single nk_layout_row
+ * functions. Instead of pushing either pixel or window ratio for every widget
+ * it allows to define it by array. The trade of for less control is that
+ * `nk_layout_row` is automatically repeating. Otherwise the behavior is the
+ * same.
+ *
+ * ```c
+ * if (nk_begin_xxx(...) {
+ * // two rows with height: 30 composed of two widgets with width 60 and 40
+ * const float ratio[] = {60,40};
+ * nk_layout_row(ctx, NK_STATIC, 30, 2, ratio);
+ * nk_widget(...);
+ * nk_widget(...);
+ * nk_widget(...);
+ * nk_widget(...);
+ * //
+ * // two rows with height: 30 composed of two widgets with window ratio 0.25 and 0.75
+ * const float ratio[] = {0.25, 0.75};
+ * nk_layout_row(ctx, NK_DYNAMIC, 30, 2, ratio);
+ * nk_widget(...);
+ * nk_widget(...);
+ * nk_widget(...);
+ * nk_widget(...);
+ * //
+ * // two rows with auto generated height composed of two widgets with window ratio 0.25 and 0.75
+ * const float ratio[] = {0.25, 0.75};
+ * nk_layout_row(ctx, NK_DYNAMIC, 30, 2, ratio);
+ * nk_widget(...);
+ * nk_widget(...);
+ * nk_widget(...);
+ * nk_widget(...);
+ * }
+ * nk_end(...);
+ * ```
+ *
+ * 5. __nk_layout_row_template_xxx__
+ * The most complex and second most flexible API is a simplified flexbox version without
+ * line wrapping and weights for dynamic widgets. It is an immediate mode API but
+ * unlike `nk_layout_row_xxx` it has auto repeat behavior and needs to be called
+ * before calling the templated widgets.
+ * The row template layout has three different per widget size specifier. The first
+ * one is the `nk_layout_row_template_push_static` with fixed widget pixel width.
+ * They do not grow if the row grows and will always stay the same.
+ * The second size specifier is `nk_layout_row_template_push_variable`
+ * which defines a minimum widget size but it also can grow if more space is available
+ * not taken by other widgets.
+ * Finally there are dynamic widgets with `nk_layout_row_template_push_dynamic`
+ * which are completely flexible and unlike variable widgets can even shrink
+ * to zero if not enough space is provided.
+ *
+ * ```c
+ * if (nk_begin_xxx(...) {
+ * // two rows with height: 30 composed of three widgets
+ * nk_layout_row_template_begin(ctx, 30);
+ * nk_layout_row_template_push_dynamic(ctx);
+ * nk_layout_row_template_push_variable(ctx, 80);
+ * nk_layout_row_template_push_static(ctx, 80);
+ * nk_layout_row_template_end(ctx);
+ * //
+ * // first row
+ * nk_widget(...); // dynamic widget can go to zero if not enough space
+ * nk_widget(...); // variable widget with min 80 pixel but can grow bigger if enough space
+ * nk_widget(...); // static widget with fixed 80 pixel width
+ * //
+ * // second row same layout
+ * nk_widget(...);
+ * nk_widget(...);
+ * nk_widget(...);
+ * }
+ * nk_end(...);
+ * ```
+ *
+ * 6. __nk_layout_space_xxx__
+ * Finally the most flexible API directly allows you to place widgets inside the
+ * window. The space layout API is an immediate mode API which does not support
+ * row auto repeat and directly sets position and size of a widget. Position
+ * and size hereby can be either specified as ratio of allocated space or
+ * allocated space local position and pixel size. Since this API is quite
+ * powerful there are a number of utility functions to get the available space
+ * and convert between local allocated space and screen space.
+ *
+ * ```c
+ * if (nk_begin_xxx(...) {
+ * // static row with height: 500 (you can set column count to INT_MAX if you don't want to be bothered)
+ * nk_layout_space_begin(ctx, NK_STATIC, 500, INT_MAX);
+ * nk_layout_space_push(ctx, nk_rect(0,0,150,200));
+ * nk_widget(...);
+ * nk_layout_space_push(ctx, nk_rect(200,200,100,200));
+ * nk_widget(...);
+ * nk_layout_space_end(ctx);
+ * //
+ * // dynamic row with height: 500 (you can set column count to INT_MAX if you don't want to be bothered)
+ * nk_layout_space_begin(ctx, NK_DYNAMIC, 500, INT_MAX);
+ * nk_layout_space_push(ctx, nk_rect(0.5,0.5,0.1,0.1));
+ * nk_widget(...);
+ * nk_layout_space_push(ctx, nk_rect(0.7,0.6,0.1,0.1));
+ * nk_widget(...);
+ * }
+ * nk_end(...);
+ * ```
*
* # Reference
* Function | Description
diff --git a/src/nuklear.h b/src/nuklear.h
index 5b4140486..bae1c3f26 100644
--- a/src/nuklear.h
+++ b/src/nuklear.h
@@ -1979,8 +1979,7 @@ NK_API void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, nk
* To actually define a layout you just call the appropriate layouting function
* and each subsequent widget call will place the widget as specified. Important
* here is that if you define more widgets then columns defined inside the layout
- * functions it will allocate the next row without you having to make another layouting
- * call.
+ * functions it will allocate the next row without you having to make another layouting call.
*
* Biggest limitation with using all these APIs outside the `nk_layout_space_xxx` API
* is that you have to define the row height for each. However the row height
@@ -2005,202 +2004,202 @@ NK_API void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, nk
* functions should be fine.
*
* # Usage
- * 1. __nk_layout_row_dynamic__
- * The easiest layouting function is `nk_layout_row_dynamic`. It provides each
- * widgets with same horizontal space inside the row and dynamically grows
- * if the owning window grows in width. So the number of columns dictates
- * the size of each widget dynamically by formula:
- *
- * ```c
- * widget_width = (window_width - padding - spacing) * (1/column_count)
- * ```
- *
- * Just like all other layouting APIs if you define more widget than columns this
- * library will allocate a new row and keep all layouting parameters previously
- * defined.
- *
- * ```c
- * if (nk_begin_xxx(...) {
- * // first row with height: 30 composed of two widgets
- * nk_layout_row_dynamic(&ctx, 30, 2);
- * nk_widget(...);
- * nk_widget(...);
- * //
- * // second row with same parameter as defined above
- * nk_widget(...);
- * nk_widget(...);
- * //
- * // third row uses 0 for height which will use auto layouting
- * nk_layout_row_dynamic(&ctx, 0, 2);
- * nk_widget(...);
- * nk_widget(...);
- * }
- * nk_end(...);
- * ```
- *
- * 2. __nk_layout_row_static__
- * Another easy layouting function is `nk_layout_row_static`. It provides each
- * widget with same horizontal pixel width inside the row and does not grow
- * if the owning window scales smaller or bigger.
- *
- * ```c
- * if (nk_begin_xxx(...) {
- * // first row with height: 30 composed of two widgets with width: 80
- * nk_layout_row_static(&ctx, 30, 80, 2);
- * nk_widget(...);
- * nk_widget(...);
- * //
- * // second row with same parameter as defined above
- * nk_widget(...);
- * nk_widget(...);
- * //
- * // third row uses 0 for height which will use auto layouting
- * nk_layout_row_static(&ctx, 0, 80, 2);
- * nk_widget(...);
- * nk_widget(...);
- * }
- * nk_end(...);
- * ```
- *
- * 3. __nk_layout_row_xxx__
- * A little bit more advanced layouting API are functions `nk_layout_row_begin`,
- * `nk_layout_row_push` and `nk_layout_row_end`. They allow to directly
- * specify each column pixel or window ratio in a row. It supports either
- * directly setting per column pixel width or widget window ratio but not
- * both. Furthermore it is a immediate mode API so each value is directly
- * pushed before calling a widget. Therefore the layout is not automatically
- * repeating like the last two layouting functions.
- *
- * ```c
- * if (nk_begin_xxx(...) {
- * // first row with height: 25 composed of two widgets with width 60 and 40
- * nk_layout_row_begin(ctx, NK_STATIC, 25, 2);
- * nk_layout_row_push(ctx, 60);
- * nk_widget(...);
- * nk_layout_row_push(ctx, 40);
- * nk_widget(...);
- * nk_layout_row_end(ctx);
- * //
- * // second row with height: 25 composed of two widgets with window ratio 0.25 and 0.75
- * nk_layout_row_begin(ctx, NK_DYNAMIC, 25, 2);
- * nk_layout_row_push(ctx, 0.25f);
- * nk_widget(...);
- * nk_layout_row_push(ctx, 0.75f);
- * nk_widget(...);
- * nk_layout_row_end(ctx);
- * //
- * // third row with auto generated height: composed of two widgets with window ratio 0.25 and 0.75
- * nk_layout_row_begin(ctx, NK_DYNAMIC, 0, 2);
- * nk_layout_row_push(ctx, 0.25f);
- * nk_widget(...);
- * nk_layout_row_push(ctx, 0.75f);
- * nk_widget(...);
- * nk_layout_row_end(ctx);
- * }
- * nk_end(...);
- * ```
- *
- * 4. __nk_layout_row__
- * The array counterpart to API nk_layout_row_xxx is the single nk_layout_row
- * functions. Instead of pushing either pixel or window ratio for every widget
- * it allows to define it by array. The trade of for less control is that
- * `nk_layout_row` is automatically repeating. Otherwise the behavior is the
- * same.
- *
- * ```c
- * if (nk_begin_xxx(...) {
- * // two rows with height: 30 composed of two widgets with width 60 and 40
- * const float ratio[] = {60,40};
- * nk_layout_row(ctx, NK_STATIC, 30, 2, ratio);
- * nk_widget(...);
- * nk_widget(...);
- * nk_widget(...);
- * nk_widget(...);
- * //
- * // two rows with height: 30 composed of two widgets with window ratio 0.25 and 0.75
- * const float ratio[] = {0.25, 0.75};
- * nk_layout_row(ctx, NK_DYNAMIC, 30, 2, ratio);
- * nk_widget(...);
- * nk_widget(...);
- * nk_widget(...);
- * nk_widget(...);
- * //
- * // two rows with auto generated height composed of two widgets with window ratio 0.25 and 0.75
- * const float ratio[] = {0.25, 0.75};
- * nk_layout_row(ctx, NK_DYNAMIC, 30, 2, ratio);
- * nk_widget(...);
- * nk_widget(...);
- * nk_widget(...);
- * nk_widget(...);
- * }
- * nk_end(...);
- * ```
- *
- * 5. __nk_layout_row_template_xxx__
- * The most complex and second most flexible API is a simplified flexbox version without
- * line wrapping and weights for dynamic widgets. It is an immediate mode API but
- * unlike `nk_layout_row_xxx` it has auto repeat behavior and needs to be called
- * before calling the templated widgets.
- * The row template layout has three different per widget size specifier. The first
- * one is the `nk_layout_row_template_push_static` with fixed widget pixel width.
- * They do not grow if the row grows and will always stay the same.
- * The second size specifier is `nk_layout_row_template_push_variable`
- * which defines a minimum widget size but it also can grow if more space is available
- * not taken by other widgets.
- * Finally there are dynamic widgets with `nk_layout_row_template_push_dynamic`
- * which are completely flexible and unlike variable widgets can even shrink
- * to zero if not enough space is provided.
- *
- * ```c
- * if (nk_begin_xxx(...) {
- * // two rows with height: 30 composed of three widgets
- * nk_layout_row_template_begin(ctx, 30);
- * nk_layout_row_template_push_dynamic(ctx);
- * nk_layout_row_template_push_variable(ctx, 80);
- * nk_layout_row_template_push_static(ctx, 80);
- * nk_layout_row_template_end(ctx);
- * //
- * // first row
- * nk_widget(...); // dynamic widget can go to zero if not enough space
- * nk_widget(...); // variable widget with min 80 pixel but can grow bigger if enough space
- * nk_widget(...); // static widget with fixed 80 pixel width
- * //
- * // second row same layout
- * nk_widget(...);
- * nk_widget(...);
- * nk_widget(...);
- * }
- * nk_end(...);
- * ```
- *
- * 6. __nk_layout_space_xxx__
- * Finally the most flexible API directly allows you to place widgets inside the
- * window. The space layout API is an immediate mode API which does not support
- * row auto repeat and directly sets position and size of a widget. Position
- * and size hereby can be either specified as ratio of allocated space or
- * allocated space local position and pixel size. Since this API is quite
- * powerful there are a number of utility functions to get the available space
- * and convert between local allocated space and screen space.
- *
- * ```c
- * if (nk_begin_xxx(...) {
- * // static row with height: 500 (you can set column count to INT_MAX if you don't want to be bothered)
- * nk_layout_space_begin(ctx, NK_STATIC, 500, INT_MAX);
- * nk_layout_space_push(ctx, nk_rect(0,0,150,200));
- * nk_widget(...);
- * nk_layout_space_push(ctx, nk_rect(200,200,100,200));
- * nk_widget(...);
- * nk_layout_space_end(ctx);
- * //
- * // dynamic row with height: 500 (you can set column count to INT_MAX if you don't want to be bothered)
- * nk_layout_space_begin(ctx, NK_DYNAMIC, 500, INT_MAX);
- * nk_layout_space_push(ctx, nk_rect(0.5,0.5,0.1,0.1));
- * nk_widget(...);
- * nk_layout_space_push(ctx, nk_rect(0.7,0.6,0.1,0.1));
- * nk_widget(...);
- * }
- * nk_end(...);
- * ```
+ * 1. __nk_layout_row_dynamic__
+ * The easiest layouting function is `nk_layout_row_dynamic`. It provides each
+ * widgets with same horizontal space inside the row and dynamically grows
+ * if the owning window grows in width. So the number of columns dictates
+ * the size of each widget dynamically by formula:
+ *
+ * ```c
+ * widget_width = (window_width - padding - spacing) * (1/column_count)
+ * ```
+ *
+ * Just like all other layouting APIs if you define more widget than columns this
+ * library will allocate a new row and keep all layouting parameters previously
+ * defined.
+ *
+ * ```c
+ * if (nk_begin_xxx(...) {
+ * // first row with height: 30 composed of two widgets
+ * nk_layout_row_dynamic(&ctx, 30, 2);
+ * nk_widget(...);
+ * nk_widget(...);
+ * //
+ * // second row with same parameter as defined above
+ * nk_widget(...);
+ * nk_widget(...);
+ * //
+ * // third row uses 0 for height which will use auto layouting
+ * nk_layout_row_dynamic(&ctx, 0, 2);
+ * nk_widget(...);
+ * nk_widget(...);
+ * }
+ * nk_end(...);
+ * ```
+ *
+ * 2. __nk_layout_row_static__
+ * Another easy layouting function is `nk_layout_row_static`. It provides each
+ * widget with same horizontal pixel width inside the row and does not grow
+ * if the owning window scales smaller or bigger.
+ *
+ * ```c
+ * if (nk_begin_xxx(...) {
+ * // first row with height: 30 composed of two widgets with width: 80
+ * nk_layout_row_static(&ctx, 30, 80, 2);
+ * nk_widget(...);
+ * nk_widget(...);
+ * //
+ * // second row with same parameter as defined above
+ * nk_widget(...);
+ * nk_widget(...);
+ * //
+ * // third row uses 0 for height which will use auto layouting
+ * nk_layout_row_static(&ctx, 0, 80, 2);
+ * nk_widget(...);
+ * nk_widget(...);
+ * }
+ * nk_end(...);
+ * ```
+ *
+ * 3. __nk_layout_row_xxx__
+ * A little bit more advanced layouting API are functions `nk_layout_row_begin`,
+ * `nk_layout_row_push` and `nk_layout_row_end`. They allow to directly
+ * specify each column pixel or window ratio in a row. It supports either
+ * directly setting per column pixel width or widget window ratio but not
+ * both. Furthermore it is a immediate mode API so each value is directly
+ * pushed before calling a widget. Therefore the layout is not automatically
+ * repeating like the last two layouting functions.
+ *
+ * ```c
+ * if (nk_begin_xxx(...) {
+ * // first row with height: 25 composed of two widgets with width 60 and 40
+ * nk_layout_row_begin(ctx, NK_STATIC, 25, 2);
+ * nk_layout_row_push(ctx, 60);
+ * nk_widget(...);
+ * nk_layout_row_push(ctx, 40);
+ * nk_widget(...);
+ * nk_layout_row_end(ctx);
+ * //
+ * // second row with height: 25 composed of two widgets with window ratio 0.25 and 0.75
+ * nk_layout_row_begin(ctx, NK_DYNAMIC, 25, 2);
+ * nk_layout_row_push(ctx, 0.25f);
+ * nk_widget(...);
+ * nk_layout_row_push(ctx, 0.75f);
+ * nk_widget(...);
+ * nk_layout_row_end(ctx);
+ * //
+ * // third row with auto generated height: composed of two widgets with window ratio 0.25 and 0.75
+ * nk_layout_row_begin(ctx, NK_DYNAMIC, 0, 2);
+ * nk_layout_row_push(ctx, 0.25f);
+ * nk_widget(...);
+ * nk_layout_row_push(ctx, 0.75f);
+ * nk_widget(...);
+ * nk_layout_row_end(ctx);
+ * }
+ * nk_end(...);
+ * ```
+ *
+ * 4. __nk_layout_row__
+ * The array counterpart to API nk_layout_row_xxx is the single nk_layout_row
+ * functions. Instead of pushing either pixel or window ratio for every widget
+ * it allows to define it by array. The trade of for less control is that
+ * `nk_layout_row` is automatically repeating. Otherwise the behavior is the
+ * same.
+ *
+ * ```c
+ * if (nk_begin_xxx(...) {
+ * // two rows with height: 30 composed of two widgets with width 60 and 40
+ * const float ratio[] = {60,40};
+ * nk_layout_row(ctx, NK_STATIC, 30, 2, ratio);
+ * nk_widget(...);
+ * nk_widget(...);
+ * nk_widget(...);
+ * nk_widget(...);
+ * //
+ * // two rows with height: 30 composed of two widgets with window ratio 0.25 and 0.75
+ * const float ratio[] = {0.25, 0.75};
+ * nk_layout_row(ctx, NK_DYNAMIC, 30, 2, ratio);
+ * nk_widget(...);
+ * nk_widget(...);
+ * nk_widget(...);
+ * nk_widget(...);
+ * //
+ * // two rows with auto generated height composed of two widgets with window ratio 0.25 and 0.75
+ * const float ratio[] = {0.25, 0.75};
+ * nk_layout_row(ctx, NK_DYNAMIC, 30, 2, ratio);
+ * nk_widget(...);
+ * nk_widget(...);
+ * nk_widget(...);
+ * nk_widget(...);
+ * }
+ * nk_end(...);
+ * ```
+ *
+ * 5. __nk_layout_row_template_xxx__
+ * The most complex and second most flexible API is a simplified flexbox version without
+ * line wrapping and weights for dynamic widgets. It is an immediate mode API but
+ * unlike `nk_layout_row_xxx` it has auto repeat behavior and needs to be called
+ * before calling the templated widgets.
+ * The row template layout has three different per widget size specifier. The first
+ * one is the `nk_layout_row_template_push_static` with fixed widget pixel width.
+ * They do not grow if the row grows and will always stay the same.
+ * The second size specifier is `nk_layout_row_template_push_variable`
+ * which defines a minimum widget size but it also can grow if more space is available
+ * not taken by other widgets.
+ * Finally there are dynamic widgets with `nk_layout_row_template_push_dynamic`
+ * which are completely flexible and unlike variable widgets can even shrink
+ * to zero if not enough space is provided.
+ *
+ * ```c
+ * if (nk_begin_xxx(...) {
+ * // two rows with height: 30 composed of three widgets
+ * nk_layout_row_template_begin(ctx, 30);
+ * nk_layout_row_template_push_dynamic(ctx);
+ * nk_layout_row_template_push_variable(ctx, 80);
+ * nk_layout_row_template_push_static(ctx, 80);
+ * nk_layout_row_template_end(ctx);
+ * //
+ * // first row
+ * nk_widget(...); // dynamic widget can go to zero if not enough space
+ * nk_widget(...); // variable widget with min 80 pixel but can grow bigger if enough space
+ * nk_widget(...); // static widget with fixed 80 pixel width
+ * //
+ * // second row same layout
+ * nk_widget(...);
+ * nk_widget(...);
+ * nk_widget(...);
+ * }
+ * nk_end(...);
+ * ```
+ *
+ * 6. __nk_layout_space_xxx__
+ * Finally the most flexible API directly allows you to place widgets inside the
+ * window. The space layout API is an immediate mode API which does not support
+ * row auto repeat and directly sets position and size of a widget. Position
+ * and size hereby can be either specified as ratio of allocated space or
+ * allocated space local position and pixel size. Since this API is quite
+ * powerful there are a number of utility functions to get the available space
+ * and convert between local allocated space and screen space.
+ *
+ * ```c
+ * if (nk_begin_xxx(...) {
+ * // static row with height: 500 (you can set column count to INT_MAX if you don't want to be bothered)
+ * nk_layout_space_begin(ctx, NK_STATIC, 500, INT_MAX);
+ * nk_layout_space_push(ctx, nk_rect(0,0,150,200));
+ * nk_widget(...);
+ * nk_layout_space_push(ctx, nk_rect(200,200,100,200));
+ * nk_widget(...);
+ * nk_layout_space_end(ctx);
+ * //
+ * // dynamic row with height: 500 (you can set column count to INT_MAX if you don't want to be bothered)
+ * nk_layout_space_begin(ctx, NK_DYNAMIC, 500, INT_MAX);
+ * nk_layout_space_push(ctx, nk_rect(0.5,0.5,0.1,0.1));
+ * nk_widget(...);
+ * nk_layout_space_push(ctx, nk_rect(0.7,0.6,0.1,0.1));
+ * nk_widget(...);
+ * }
+ * nk_end(...);
+ * ```
*
* # Reference
* Function | Description