diff --git a/src/nuklear.h b/src/nuklear.h index 6a30b39..83097cc 100644 --- a/src/nuklear.h +++ b/src/nuklear.h @@ -11,6 +11,7 @@ extern "C" { * * =============================================================== */ + #define NK_UNDEFINED (-1.0f) #define NK_UTF_INVALID 0xFFFD /* internal invalid utf8 rune */ #define NK_UTF_SIZE 4 /* describes the number of bytes a glyph consists of*/ @@ -30,6 +31,7 @@ extern "C" { * * =============================================================== */ + #ifndef NK_API #ifdef NK_PRIVATE #if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199409L)) @@ -108,7 +110,7 @@ extern "C" { * * =============================================================== */ -#ifdef NK_INCLUDE_FIXED_TYPES + #ifdef NK_INCLUDE_FIXED_TYPES #include #define NK_INT8 int8_t #define NK_UINT8 uint8_t @@ -313,19 +315,20 @@ enum nk_symbol_type { * CONTEXT * * =============================================================================*/ -/*/// ### Context +/// \page +/// # Context /// Contexts are the main entry point and the majestro of nuklear and contain all required state. /// They are used for window, memory, input, style, stack, commands and time management and need /// to be passed into all nuklear GUI specific functions. /// -/// #### Usage +/// # Usage /// To use a context it first has to be initialized which can be achieved by calling /// one of either `nk_init_default`, `nk_init_fixed`, `nk_init`, `nk_init_custom`. /// Each takes in a font handle and a specific way of handling memory. Memory control /// hereby ranges from standard library to just specifying a fixed sized block of memory /// which nuklear has to manage itself from. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_context ctx; /// nk_init_xxx(&ctx, ...); /// while (1) { @@ -333,139 +336,132 @@ enum nk_symbol_type { /// nk_clear(&ctx); /// } /// nk_free(&ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// #### Reference +/// # Reference /// Function | Description /// --------------------|------------------------------------------------------- -/// __nk_init_default__ | Initializes context with standard library memory allocation (malloc,free) -/// __nk_init_fixed__ | Initializes context from single fixed size memory block -/// __nk_init__ | Initializes context with memory allocator callbacks for alloc and free -/// __nk_init_custom__ | Initializes context from two buffers. One for draw commands the other for window/panel/table allocations -/// __nk_clear__ | Called at the end of the frame to reset and prepare the context for the next frame -/// __nk_free__ | Shutdown and free all memory allocated inside the context -/// __nk_set_user_data__| Utility function to pass user data to draw command - */ +/// \ref __nk_init_default__ | Initializes context with standard library memory allocation (malloc,free) +/// \ref __nk_init_fixed__ | Initializes context from single fixed size memory block +/// \ref __nk_init__ | Initializes context with memory allocator callbacks for alloc and free +/// \ref __nk_init_custom__ | Initializes context from two buffers. One for draw commands the other for window/panel/table allocations +/// \ref __nk_clear__ | Called at the end of the frame to reset and prepare the context for the next frame +/// \ref __nk_free__ | Shutdown and free all memory allocated inside the context +/// \ref __nk_set_user_data__| Utility function to pass user data to draw command + #ifdef NK_INCLUDE_DEFAULT_ALLOCATOR -/*/// #### nk_init_default + +/// # nk_init_default /// Initializes a `nk_context` struct with a default standard library allocator. /// Should be used if you don't want to be bothered with memory management in nuklear. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// nk_bool nk_init_default(struct nk_context *ctx, const struct nk_user_font *font); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|--------------------------------------------------------------- -/// __ctx__ | Must point to an either stack or heap allocated `nk_context` struct -/// __font__ | Must point to a previously initialized font handle for more info look at font documentation +/// \param[in] __ctx__ | Must point to an either stack or heap allocated `nk_context` struct +/// \param[in] __font__ | Must point to a previously initialized font handle for more info look at font documentation /// -/// Returns either `false(0)` on failure or `true(1)` on success. +/// \returns either `false(0)` on failure or `true(1)` on success. /// -*/ NK_API nk_bool nk_init_default(struct nk_context*, const struct nk_user_font*); #endif -/*/// #### nk_init_fixed + +/// # nk_init_fixed /// Initializes a `nk_context` struct from single fixed size memory block /// Should be used if you want complete control over nuklear's memory management. /// Especially recommended for system with little memory or systems with virtual memory. /// For the later case you can just allocate for example 16MB of virtual memory /// and only the required amount of memory will actually be committed. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// nk_bool nk_init_fixed(struct nk_context *ctx, void *memory, nk_size size, const struct nk_user_font *font); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// !!! Warning /// make sure the passed memory block is aligned correctly for `nk_draw_commands`. /// /// Parameter | Description /// ------------|-------------------------------------------------------------- -/// __ctx__ | Must point to an either stack or heap allocated `nk_context` struct -/// __memory__ | Must point to a previously allocated memory block -/// __size__ | Must contain the total size of __memory__ -/// __font__ | Must point to a previously initialized font handle for more info look at font documentation +/// \param[in] __ctx__ | Must point to an either stack or heap allocated `nk_context` struct +/// \param[in] __memory__ | Must point to a previously allocated memory block +/// \param[in] __size__ | Must contain the total size of __memory__ +/// \param[in] __font__ | Must point to a previously initialized font handle for more info look at font documentation /// -/// Returns either `false(0)` on failure or `true(1)` on success. -*/ +/// \returns either `false(0)` on failure or `true(1)` on success. NK_API nk_bool nk_init_fixed(struct nk_context*, void *memory, nk_size size, const struct nk_user_font*); -/*/// #### nk_init + +/// # nk_init /// Initializes a `nk_context` struct with memory allocation callbacks for nuklear to allocate /// memory from. Used internally for `nk_init_default` and provides a kitchen sink allocation /// interface to nuklear. Can be useful for cases like monitoring memory consumption. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// nk_bool nk_init(struct nk_context *ctx, const struct nk_allocator *alloc, const struct nk_user_font *font); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|--------------------------------------------------------------- -/// __ctx__ | Must point to an either stack or heap allocated `nk_context` struct -/// __alloc__ | Must point to a previously allocated memory allocator -/// __font__ | Must point to a previously initialized font handle for more info look at font documentation +/// \param[in] __ctx__ | Must point to an either stack or heap allocated `nk_context` struct +/// \param[in] __alloc__ | Must point to a previously allocated memory allocator +/// \param[in] __font__ | Must point to a previously initialized font handle for more info look at font documentation /// -/// Returns either `false(0)` on failure or `true(1)` on success. -*/ +/// \returns either `false(0)` on failure or `true(1)` on success. NK_API nk_bool nk_init(struct nk_context*, const struct nk_allocator*, const struct nk_user_font*); -/*/// #### nk_init_custom -/// Initializes a `nk_context` struct from two different either fixed or growing -/// buffers. The first buffer is for allocating draw commands while the second buffer is + +/// \brief Initializes a `nk_context` struct from two different either fixed or growing buffers. +/// +/// \details +/// The first buffer is for allocating draw commands while the second buffer is /// used for allocating windows, panels and state tables. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// nk_bool nk_init_custom(struct nk_context *ctx, struct nk_buffer *cmds, struct nk_buffer *pool, const struct nk_user_font *font); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|--------------------------------------------------------------- -/// __ctx__ | Must point to an either stack or heap allocated `nk_context` struct -/// __cmds__ | Must point to a previously initialized memory buffer either fixed or dynamic to store draw commands into -/// __pool__ | Must point to a previously initialized memory buffer either fixed or dynamic to store windows, panels and tables -/// __font__ | Must point to a previously initialized font handle for more info look at font documentation +/// \param[in] __ctx__ Must point to an either stack or heap allocated `nk_context` struct +/// \param[in] __cmds__ Must point to a previously initialized memory buffer either fixed or dynamic to store draw commands into +/// \param[in] __pool__ Must point to a previously initialized memory buffer either fixed or dynamic to store windows, panels and tables +/// \param[in] __font__ Must point to a previously initialized font handle for more info look at font documentation /// -/// Returns either `false(0)` on failure or `true(1)` on success. -*/ +/// \returns either `false(0)` on failure or `true(1)` on success. NK_API nk_bool nk_init_custom(struct nk_context*, struct nk_buffer *cmds, struct nk_buffer *pool, const struct nk_user_font*); -/*/// #### nk_clear -/// Resets the context state at the end of the frame. This includes mostly -/// garbage collector tasks like removing windows or table not called and therefore -/// used anymore. + +/// \brief Resets the context state at the end of the frame. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// \details +/// This includes mostly garbage collector tasks like removing windows or table +/// not called and therefore used anymore. +/// +/// ```c /// void nk_clear(struct nk_context *ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to a previously initialized `nk_context` struct -*/ +/// \param[in] __ctx__ Must point to a previously initialized `nk_context` struct NK_API void nk_clear(struct nk_context*); -/*/// #### nk_free -/// Frees all memory allocated by nuklear. Not needed if context was -/// initialized with `nk_init_fixed`. + +/// \brief Frees all memory allocated by nuklear; Not needed if context was initialized with `nk_init_fixed`. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// \details +/// ```c /// void nk_free(struct nk_context *ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to a previously initialized `nk_context` struct -*/ +/// \param[in] __ctx__ Must point to a previously initialized `nk_context` struct NK_API void nk_free(struct nk_context*); + #ifdef NK_INCLUDE_COMMAND_USERDATA -/*/// #### nk_set_user_data -/// Sets the currently passed userdata passed down into each draw command. +/// \brief Sets the currently passed userdata passed down into each draw command. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// \details +/// ```c /// void nk_set_user_data(struct nk_context *ctx, nk_handle data); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|-------------------------------------------------------------- -/// __ctx__ | Must point to a previously initialized `nk_context` struct -/// __data__ | Handle with either pointer or index to be passed into every draw commands -*/ +/// \param[in] __ctx__ Must point to a previously initialized `nk_context` struct +/// \param[in] __data__ Handle with either pointer or index to be passed into every draw commands NK_API void nk_set_user_data(struct nk_context*, nk_handle handle); #endif /* ============================================================================= @@ -473,7 +469,9 @@ NK_API void nk_set_user_data(struct nk_context*, nk_handle handle); * INPUT * * =============================================================================*/ -/*/// ### Input +/// \page +/// # Input +/// /// The input API is responsible for holding the current input state composed of /// mouse, key and text input states. /// It is worth noting that no direct OS or window handling is done in nuklear. @@ -482,7 +480,7 @@ NK_API void nk_set_user_data(struct nk_context*, nk_handle handle); /// provides simple abstraction over a big number of platforms, libraries and other /// already provided functionality. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// nk_input_begin(&ctx); /// while (GetEvent(&evt)) { /// if (evt.type == MOUSE_MOVE) @@ -491,9 +489,9 @@ NK_API void nk_set_user_data(struct nk_context*, nk_handle handle); /// // [...] /// } /// } nk_input_end(&ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// #### Usage +/// # Usage /// Input state needs to be provided to nuklear by first calling `nk_input_begin` /// which resets internal state like delta mouse position and button transitions. /// After `nk_input_begin` all current input state needs to be provided. This includes @@ -502,7 +500,7 @@ NK_API void nk_set_user_data(struct nk_context*, nk_handle handle); /// and should work without problems. Finally after all input state has been /// mirrored `nk_input_end` needs to be called to finish input process. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_context ctx; /// nk_init_xxx(&ctx, ...); /// while (1) { @@ -519,21 +517,21 @@ NK_API void nk_set_user_data(struct nk_context*, nk_handle handle); /// // [...] /// nk_clear(&ctx); /// } nk_free(&ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// #### Reference +/// # Reference /// Function | Description /// --------------------|------------------------------------------------------- -/// __nk_input_begin__ | Begins the input mirroring process. Needs to be called before all other `nk_input_xxx` calls -/// __nk_input_motion__ | Mirrors mouse cursor position -/// __nk_input_key__ | Mirrors key state with either pressed or released -/// __nk_input_button__ | Mirrors mouse button state with either pressed or released -/// __nk_input_scroll__ | Mirrors mouse scroll values -/// __nk_input_char__ | Adds a single ASCII text character into an internal text buffer -/// __nk_input_glyph__ | Adds a single multi-byte UTF-8 character into an internal text buffer -/// __nk_input_unicode__| Adds a single unicode rune into an internal text buffer -/// __nk_input_end__ | Ends the input mirroring process by calculating state changes. Don't call any `nk_input_xxx` function referenced above after this call -*/ +/// \ref __nk_input_begin__ | Begins the input mirroring process. Needs to be called before all other `nk_input_xxx` calls +/// \ref __nk_input_motion__ | Mirrors mouse cursor position +/// \ref __nk_input_key__ | Mirrors key state with either pressed or released +/// \ref __nk_input_button__ | Mirrors mouse button state with either pressed or released +/// \ref __nk_input_scroll__ | Mirrors mouse scroll values +/// \ref __nk_input_char__ | Adds a single ASCII text character into an internal text buffer +/// \ref __nk_input_glyph__ | Adds a single multi-byte UTF-8 character into an internal text buffer +/// \ref __nk_input_unicode__| Adds a single unicode rune into an internal text buffer +/// \ref __nk_input_end__ | Ends the input mirroring process by calculating state changes. Don't call any `nk_input_xxx` function referenced above after this call + enum nk_keys { NK_KEY_NONE, NK_KEY_SHIFT, @@ -576,148 +574,134 @@ enum nk_buttons { NK_BUTTON_DOUBLE, NK_BUTTON_MAX }; -/*/// #### nk_input_begin -/// Begins the input mirroring process by resetting text, scroll -/// mouse, previous mouse position and movement as well as key state transitions, + +/// \brief Begins the input mirroring process by resetting text, scroll +/// mouse, previous mouse position and movement as well as key state transitions. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// \details +/// ```c /// void nk_input_begin(struct nk_context*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to a previously initialized `nk_context` struct -*/ +/// \param[in] __ctx__ Must point to a previously initialized `nk_context` struct NK_API void nk_input_begin(struct nk_context*); -/*/// #### nk_input_motion -/// Mirrors current mouse position to nuklear + +/// \brief Mirrors current mouse position to nuklear /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// \details +/// ```c /// void nk_input_motion(struct nk_context *ctx, int x, int y); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to a previously initialized `nk_context` struct -/// __x__ | Must hold an integer describing the current mouse cursor x-position -/// __y__ | Must hold an integer describing the current mouse cursor y-position -*/ +/// \param[in] __ctx__ Must point to a previously initialized `nk_context` struct +/// \param[in] __x__ Must hold an integer describing the current mouse cursor x-position +/// \param[in] __y__ Must hold an integer describing the current mouse cursor y-position NK_API void nk_input_motion(struct nk_context*, int x, int y); -/*/// #### nk_input_key -/// Mirrors the state of a specific key to nuklear + +/// \brief Mirrors the state of a specific key to nuklear /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// \details +/// ```c /// void nk_input_key(struct nk_context*, enum nk_keys key, nk_bool down); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to a previously initialized `nk_context` struct -/// __key__ | Must be any value specified in enum `nk_keys` that needs to be mirrored -/// __down__ | Must be 0 for key is up and 1 for key is down -*/ +/// \param[in] __ctx__ Must point to a previously initialized `nk_context` struct +/// \param[in] __key__ Must be any value specified in enum `nk_keys` that needs to be mirrored +/// \param[in] __down__ Must be 0 for key is up and 1 for key is down NK_API void nk_input_key(struct nk_context*, enum nk_keys, nk_bool down); -/*/// #### nk_input_button -/// Mirrors the state of a specific mouse button to nuklear + +/// \brief Mirrors the state of a specific mouse button to nuklear /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// \details +/// ```c /// void nk_input_button(struct nk_context *ctx, enum nk_buttons btn, int x, int y, nk_bool down); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to a previously initialized `nk_context` struct -/// __btn__ | Must be any value specified in enum `nk_buttons` that needs to be mirrored -/// __x__ | Must contain an integer describing mouse cursor x-position on click up/down -/// __y__ | Must contain an integer describing mouse cursor y-position on click up/down -/// __down__ | Must be 0 for key is up and 1 for key is down -*/ +/// \param[in] __ctx__ Must point to a previously initialized `nk_context` struct +/// \param[in] __btn__ Must be any value specified in enum `nk_buttons` that needs to be mirrored +/// \param[in] __x__ Must contain an integer describing mouse cursor x-position on click up/down +/// \param[in] __y__ Must contain an integer describing mouse cursor y-position on click up/down +/// \param[in] __down__ Must be 0 for key is up and 1 for key is down NK_API void nk_input_button(struct nk_context*, enum nk_buttons, int x, int y, nk_bool down); -/*/// #### nk_input_scroll -/// Copies the last mouse scroll value to nuklear. Is generally -/// a scroll value. So does not have to come from mouse and could also originate -/// TODO finish this sentence + +/// \brief Copies the last mouse scroll value to nuklear. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// \details +/// Is generally a scroll value. So does not have to come from mouse and could +/// also originate from balls, tracks, linear guide rails, or other programs. +/// +/// ```c /// void nk_input_scroll(struct nk_context *ctx, struct nk_vec2 val); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to a previously initialized `nk_context` struct -/// __val__ | vector with both X- as well as Y-scroll value -*/ +/// \param[in] __ctx__ | Must point to a previously initialized `nk_context` struct +/// \param[in] __val__ | vector with both X- as well as Y-scroll value NK_API void nk_input_scroll(struct nk_context*, struct nk_vec2 val); -/*/// #### nk_input_char -/// Copies a single ASCII character into an internal text buffer + +/// \brief Copies a single ASCII character into an internal text buffer +/// +/// \details /// This is basically a helper function to quickly push ASCII characters into /// nuklear. /// -/// !!! Note +/// \note /// Stores up to NK_INPUT_MAX bytes between `nk_input_begin` and `nk_input_end`. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_input_char(struct nk_context *ctx, char c); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to a previously initialized `nk_context` struct -/// __c__ | Must be a single ASCII character preferable one that can be printed -*/ +/// \param[in] __ctx__ | Must point to a previously initialized `nk_context` struct +/// \param[in] __c__ | Must be a single ASCII character preferable one that can be printed NK_API void nk_input_char(struct nk_context*, char); -/*/// #### nk_input_glyph -/// Converts an encoded unicode rune into UTF-8 and copies the result into an + +/// \brief Converts an encoded unicode rune into UTF-8 and copies the result into an /// internal text buffer. /// -/// !!! Note +/// \note /// Stores up to NK_INPUT_MAX bytes between `nk_input_begin` and `nk_input_end`. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_input_glyph(struct nk_context *ctx, const nk_glyph g); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to a previously initialized `nk_context` struct -/// __g__ | UTF-32 unicode codepoint -*/ +/// \param[in] __ctx__ | Must point to a previously initialized `nk_context` struct +/// \param[in] __g__ | UTF-32 unicode codepoint NK_API void nk_input_glyph(struct nk_context*, const nk_glyph); -/*/// #### nk_input_unicode -/// Converts a unicode rune into UTF-8 and copies the result + +/// \brief Converts a unicode rune into UTF-8 and copies the result /// into an internal text buffer. -/// !!! Note +/// +/// \details +/// \note /// Stores up to NK_INPUT_MAX bytes between `nk_input_begin` and `nk_input_end`. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_input_unicode(struct nk_context*, nk_rune rune); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to a previously initialized `nk_context` struct -/// __rune__ | UTF-32 unicode codepoint -*/ +/// \param[in] __ctx__ | Must point to a previously initialized `nk_context` struct +/// \param[in] __rune__ | UTF-32 unicode codepoint NK_API void nk_input_unicode(struct nk_context*, nk_rune); -/*/// #### nk_input_end -/// End the input mirroring process by resetting mouse grabbing + +/// \brief End the input mirroring process by resetting mouse grabbing /// state to ensure the mouse cursor is not grabbed indefinitely. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// \details +/// ```c /// void nk_input_end(struct nk_context *ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to a previously initialized `nk_context` struct -*/ +/// \param[in] __ctx__ | Must point to a previously initialized `nk_context` struct NK_API void nk_input_end(struct nk_context*); + /* ============================================================================= * * DRAWING * * =============================================================================*/ -/*/// ### Drawing +/// \page +/// # Drawing /// This library was designed to be render backend agnostic so it does /// not draw anything to screen directly. Instead all drawn shapes, widgets /// are made of, are buffered into memory and make up a command queue. @@ -728,14 +712,14 @@ NK_API void nk_input_end(struct nk_context*); /// drawing API and the optional vertex buffer API only takes this format and /// converts it into a hardware accessible format. /// -/// #### Usage +/// # Usage /// To draw all draw commands accumulated over a frame you need your own render /// backend able to draw a number of 2D primitives. This includes at least /// filled and stroked rectangles, circles, text, lines, triangles and scissors. /// As soon as this criterion is met you can iterate over each draw command /// and execute each draw command in a interpreter like fashion: /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// const struct nk_command *cmd = 0; /// nk_foreach(cmd, &ctx) { /// switch (cmd->type) { @@ -749,14 +733,14 @@ NK_API void nk_input_end(struct nk_context*); /// //[...] /// } /// } -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// In program flow context draw commands need to be executed after input has been /// gathered and the complete UI with windows and their contained widgets have /// been executed and before calling `nk_clear` which frees all previously /// allocated draw commands. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_context ctx; /// nk_init_xxx(&ctx, ...); /// while (1) { @@ -788,7 +772,7 @@ NK_API void nk_input_end(struct nk_context*); /// nk_clear(&ctx); /// } /// nk_free(&ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// You probably noticed that you have to draw all of the UI each frame which is /// quite wasteful. While the actual UI updating loop is quite fast rendering @@ -801,7 +785,7 @@ NK_API void nk_input_end(struct nk_context*); /// the second pass. In addition it is recommended to also add additional timers /// to make sure the UI is not drawn more than a fixed number of frames per second. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_context ctx; /// nk_init_xxx(&ctx, ...); /// while (1) { @@ -827,7 +811,7 @@ NK_API void nk_input_end(struct nk_context*); /// nk_clear(&ctx); /// } /// nk_free(&ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// The second probably more applicable trick is to only draw if anything changed. /// It is not really useful for applications with continuous draw loop but @@ -840,7 +824,7 @@ NK_API void nk_input_end(struct nk_context*); /// and then draw like usual (this example uses fixed memory but you could /// use dynamically allocated memory). /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// //[... other defines ...] /// #define NK_ZERO_COMMAND_MEMORY /// #include "nuklear.h" @@ -875,7 +859,7 @@ NK_API void nk_input_end(struct nk_context*); /// nk_clear(&ctx); /// } /// nk_free(&ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Finally while using draw commands makes sense for higher abstracted platforms like /// X11 and Win32 or drawing libraries it is often desirable to use graphics @@ -886,7 +870,7 @@ NK_API void nk_input_end(struct nk_context*); /// After successfully converting all draw commands just iterate over and execute all /// vertex draw commands: /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// // fill configuration /// struct your_vertex /// { @@ -927,20 +911,20 @@ NK_API void nk_input_end(struct nk_context*); /// nk_buffer_free(&cms); /// nk_buffer_free(&verts); /// nk_buffer_free(&idx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// #### Reference +/// # Reference /// Function | Description /// --------------------|------------------------------------------------------- -/// __nk__begin__ | Returns the first draw command in the context draw command list to be drawn -/// __nk__next__ | Increments the draw command iterator to the next command inside the context draw command list -/// __nk_foreach__ | Iterates over each draw command inside the context draw command list -/// __nk_convert__ | Converts from the abstract draw commands list into a hardware accessible vertex format -/// __nk_draw_begin__ | Returns the first vertex command in the context vertex draw list to be executed -/// __nk__draw_next__ | Increments the vertex command iterator to the next command inside the context vertex command list -/// __nk__draw_end__ | Returns the end of the vertex draw list -/// __nk_draw_foreach__ | Iterates over each vertex draw command inside the vertex draw list -*/ +/// \ref __nk__begin__ | Returns the first draw command in the context draw command list to be drawn +/// \ref __nk__next__ | Increments the draw command iterator to the next command inside the context draw command list +/// \ref __nk_foreach__ | Iterates over each draw command inside the context draw command list +/// \ref __nk_convert__ | Converts from the abstract draw commands list into a hardware accessible vertex format +/// \ref __nk_draw_begin__ | Returns the first vertex command in the context vertex draw list to be executed +/// \ref __nk__draw_next__ | Increments the vertex command iterator to the next command inside the context vertex command list +/// \ref __nk__draw_end__ | Returns the end of the vertex draw list +/// \ref __nk_draw_foreach__ | Iterates over each vertex draw command inside the vertex draw list + enum nk_anti_aliasing {NK_ANTI_ALIASING_OFF, NK_ANTI_ALIASING_ON}; enum nk_convert_result { NK_CONVERT_SUCCESS = 0, @@ -950,87 +934,79 @@ enum nk_convert_result { NK_CONVERT_ELEMENT_BUFFER_FULL = NK_FLAG(3) }; struct nk_draw_null_texture { - nk_handle texture; /* texture handle to a texture with a white pixel */ - struct nk_vec2 uv; /* coordinates to a white pixel in the texture */ + nk_handle texture; /*!< texture handle to a texture with a white pixel */ + struct nk_vec2 uv; /*!< coordinates to a white pixel in the texture */ }; struct nk_convert_config { - float global_alpha; /* global alpha value */ - enum nk_anti_aliasing line_AA; /* line anti-aliasing flag can be turned off if you are tight on memory */ - enum nk_anti_aliasing shape_AA; /* shape anti-aliasing flag can be turned off if you are tight on memory */ - unsigned circle_segment_count; /* number of segments used for circles: default to 22 */ - unsigned arc_segment_count; /* number of segments used for arcs: default to 22 */ - unsigned curve_segment_count; /* number of segments used for curves: default to 22 */ - struct nk_draw_null_texture tex_null; /* handle to texture with a white pixel for shape drawing */ - const struct nk_draw_vertex_layout_element *vertex_layout; /* describes the vertex output format and packing */ - nk_size vertex_size; /* sizeof one vertex for vertex packing */ - nk_size vertex_alignment; /* vertex alignment: Can be obtained by NK_ALIGNOF */ + float global_alpha; /*!< global alpha value */ + enum nk_anti_aliasing line_AA; /*!< line anti-aliasing flag can be turned off if you are tight on memory */ + enum nk_anti_aliasing shape_AA; /*!< shape anti-aliasing flag can be turned off if you are tight on memory */ + unsigned circle_segment_count; /*!< number of segments used for circles: default to 22 */ + unsigned arc_segment_count; /*!< number of segments used for arcs: default to 22 */ + unsigned curve_segment_count; /*!< number of segments used for curves: default to 22 */ + struct nk_draw_null_texture tex_null; /*!< handle to texture with a white pixel for shape drawing */ + const struct nk_draw_vertex_layout_element *vertex_layout; /*!< describes the vertex output format and packing */ + nk_size vertex_size; /*!< sizeof one vertex for vertex packing */ + nk_size vertex_alignment; /*!< vertex alignment: Can be obtained by NK_ALIGNOF */ }; -/*/// #### nk__begin -/// Returns a draw command list iterator to iterate all draw + +/// \brief Returns a draw command list iterator to iterate all draw /// commands accumulated over one frame. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// \details +/// ```c /// const struct nk_command* nk__begin(struct nk_context*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | must point to an previously initialized `nk_context` struct at the end of a frame +/// \param[in] __ctx__ | must point to an previously initialized `nk_context` struct at the end of a frame /// -/// Returns draw command pointer pointing to the first command inside the draw command list -*/ +/// \returns draw command pointer pointing to the first command inside the draw command list NK_API const struct nk_command* nk__begin(struct nk_context*); -/*/// #### nk__next -/// Returns draw command pointer pointing to the next command inside the draw command list + +/// \brief Returns draw command pointer pointing to the next command inside the draw command list /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// \details +/// ```c /// const struct nk_command* nk__next(struct nk_context*, const struct nk_command*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame -/// __cmd__ | Must point to an previously a draw command either returned by `nk__begin` or `nk__next` +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame +/// \param[in] __cmd__ | Must point to an previously a draw command either returned by `nk__begin` or `nk__next` /// -/// Returns draw command pointer pointing to the next command inside the draw command list -*/ +/// \returns draw command pointer pointing to the next command inside the draw command list NK_API const struct nk_command* nk__next(struct nk_context*, const struct nk_command*); -/*/// #### nk_foreach -/// Iterates over each draw command inside the context draw command list + +/// \brief Iterates over each draw command inside the context draw command list /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// #define nk_foreach(c, ctx) -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame -/// __cmd__ | Command pointer initialized to NULL -/// -/// Iterates over each draw command inside the context draw command list -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame +/// \param[in] __cmd__ | Command pointer initialized to NULL #define nk_foreach(c, ctx) for((c) = nk__begin(ctx); (c) != 0; (c) = nk__next(ctx,c)) + #ifdef NK_INCLUDE_VERTEX_BUFFER_OUTPUT -/*/// #### nk_convert -/// Converts all internal draw commands into vertex draw commands and fills -/// three buffers with vertexes, vertex draw commands and vertex indices. The vertex format -/// as well as some other configuration values have to be configured by filling out a -/// `nk_convert_config` struct. + +/// \brief Converts all internal draw commands into vertex draw commands and fills +/// three buffers with vertexes, vertex draw commands and vertex indices. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// \details +/// The vertex format as well as some other configuration values have to be +/// configured by filling out a `nk_convert_config` struct. +/// +/// ```c /// nk_flags nk_convert(struct nk_context *ctx, struct nk_buffer *cmds, /// struct nk_buffer *vertices, struct nk_buffer *elements, const struct nk_convert_config*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame -/// __cmds__ | Must point to a previously initialized buffer to hold converted vertex draw commands -/// __vertices__| Must point to a previously initialized buffer to hold all produced vertices -/// __elements__| Must point to a previously initialized buffer to hold all produced vertex indices -/// __config__ | Must point to a filled out `nk_config` struct to configure the conversion process +/// \param[in] __ctx__ Must point to an previously initialized `nk_context` struct at the end of a frame +/// \param[out] __cmds__ Must point to a previously initialized buffer to hold converted vertex draw commands +/// \param[out] __vertices__ Must point to a previously initialized buffer to hold all produced vertices +/// \param[out] __elements__ Must point to a previously initialized buffer to hold all produced vertex indices +/// \param[in] __config__ Must point to a filled out `nk_config` struct to configure the conversion process /// -/// Returns one of enum nk_convert_result error codes +/// \returns one of enum nk_convert_result error codes /// /// Parameter | Description /// --------------------------------|----------------------------------------------------------- @@ -1039,75 +1015,74 @@ NK_API const struct nk_command* nk__next(struct nk_context*, const struct nk_com /// NK_CONVERT_COMMAND_BUFFER_FULL | The provided buffer for storing draw commands is full or failed to allocate more memory /// NK_CONVERT_VERTEX_BUFFER_FULL | The provided buffer for storing vertices is full or failed to allocate more memory /// NK_CONVERT_ELEMENT_BUFFER_FULL | The provided buffer for storing indices is full or failed to allocate more memory -*/ NK_API nk_flags nk_convert(struct nk_context*, struct nk_buffer *cmds, struct nk_buffer *vertices, struct nk_buffer *elements, const struct nk_convert_config*); -/*/// #### nk__draw_begin -/// Returns a draw vertex command buffer iterator to iterate over the vertex draw command buffer + +/// \brief Returns a draw vertex command buffer iterator to iterate over the vertex draw command buffer /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// \details +/// ```c /// const struct nk_draw_command* nk__draw_begin(const struct nk_context*, const struct nk_buffer*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame -/// __buf__ | Must point to an previously by `nk_convert` filled out vertex draw command buffer +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame +/// \param[in] __buf__ | Must point to an previously by `nk_convert` filled out vertex draw command buffer /// -/// Returns vertex draw command pointer pointing to the first command inside the vertex draw command buffer -*/ +/// \returns vertex draw command pointer pointing to the first command inside the vertex draw command buffer NK_API const struct nk_draw_command* nk__draw_begin(const struct nk_context*, const struct nk_buffer*); -/*/// #### nk__draw_end -/// Returns the vertex draw command at the end of the vertex draw command buffer + +/// # # nk__draw_end +/// \returns the vertex draw command at the end of the vertex draw command buffer /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// const struct nk_draw_command* nk__draw_end(const struct nk_context *ctx, const struct nk_buffer *buf); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame -/// __buf__ | Must point to an previously by `nk_convert` filled out vertex draw command buffer +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame +/// \param[in] __buf__ | Must point to an previously by `nk_convert` filled out vertex draw command buffer /// -/// Returns vertex draw command pointer pointing to the end of the last vertex draw command inside the vertex draw command buffer -*/ +/// \returns vertex draw command pointer pointing to the end of the last vertex draw command inside the vertex draw command buffer + NK_API const struct nk_draw_command* nk__draw_end(const struct nk_context*, const struct nk_buffer*); -/*/// #### nk__draw_next +/// # # nk__draw_next /// Increments the vertex draw command buffer iterator /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// const struct nk_draw_command* nk__draw_next(const struct nk_draw_command*, const struct nk_buffer*, const struct nk_context*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __cmd__ | Must point to an previously either by `nk__draw_begin` or `nk__draw_next` returned vertex draw command -/// __buf__ | Must point to an previously by `nk_convert` filled out vertex draw command buffer -/// __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame +/// \param[in] __cmd__ | Must point to an previously either by `nk__draw_begin` or `nk__draw_next` returned vertex draw command +/// \param[in] __buf__ | Must point to an previously by `nk_convert` filled out vertex draw command buffer +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame /// -/// Returns vertex draw command pointer pointing to the end of the last vertex draw command inside the vertex draw command buffer -*/ +/// \returns vertex draw command pointer pointing to the end of the last vertex draw command inside the vertex draw command buffer + NK_API const struct nk_draw_command* nk__draw_next(const struct nk_draw_command*, const struct nk_buffer*, const struct nk_context*); -/*/// #### nk_draw_foreach +/// # # nk_draw_foreach /// Iterates over each vertex draw command inside a vertex draw command buffer /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// #define nk_draw_foreach(cmd,ctx, b) -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __cmd__ | `nk_draw_command`iterator set to NULL -/// __buf__ | Must point to an previously by `nk_convert` filled out vertex draw command buffer -/// __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame -*/ +/// \param[in] __cmd__ | `nk_draw_command`iterator set to NULL +/// \param[in] __buf__ | Must point to an previously by `nk_convert` filled out vertex draw command buffer +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct at the end of a frame + #define nk_draw_foreach(cmd,ctx, b) for((cmd)=nk__draw_begin(ctx, b); (cmd)!=0; (cmd)=nk__draw_next(cmd, b, ctx)) #endif /* ============================================================================= * * WINDOW * - * ============================================================================= -/// ### Window + * =============================================================================*/ +/// \page +/// # Window /// Windows are the main persistent state used inside nuklear and are life time /// controlled by simply "retouching" (i.e. calling) each window each frame. /// All widgets inside nuklear can only be added inside the function pair `nk_begin_xxx` @@ -1126,7 +1101,7 @@ NK_API const struct nk_draw_command* nk__draw_next(const struct nk_draw_command* /// `NK_WINDOW_CLOSABLE` or if a window was explicitly hidden by calling /// `nk_window_show`. To explicitly close and destroy a window call `nk_window_close`.

/// -/// #### Usage +/// # Usage /// To create and keep a window you have to call one of the two `nk_begin_xxx` /// functions to start window declarations and `nk_end` at the end. Furthermore it /// is recommended to check the return value of `nk_begin_xxx` and only process @@ -1135,12 +1110,12 @@ NK_API const struct nk_draw_command* nk__draw_next(const struct nk_draw_command* /// nest `nk_begin_xxx` calls which will hopefully result in an assert or if not /// in a segmentation fault. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// if (nk_begin_xxx(...) { /// // [... widgets ...] /// } /// nk_end(ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// In the grand concept window and widget declarations need to occur after input /// handling and before drawing to screen. Not doing so can result in higher @@ -1149,7 +1124,7 @@ NK_API const struct nk_draw_command* nk__draw_next(const struct nk_draw_command* /// already call `nk_clear` for you if you write your own backend not calling /// `nk_clear` can cause asserts or even worse undefined behavior. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_context ctx; /// nk_init_xxx(&ctx, ...); /// while (1) { @@ -1183,51 +1158,50 @@ NK_API const struct nk_draw_command* nk__draw_next(const struct nk_draw_command* /// nk_clear(&ctx); /// } /// nk_free(&ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// #### Reference +/// # Reference /// Function | Description /// ------------------------------------|---------------------------------------- -/// nk_begin | Starts a new window; needs to be called every frame for every window (unless hidden) or otherwise the window gets removed -/// nk_begin_titled | Extended window start with separated title and identifier to allow multiple windows with same name but not title -/// nk_end | Needs to be called at the end of the window building process to process scaling, scrollbars and general cleanup +/// \ref nk_begin | Starts a new window; needs to be called every frame for every window (unless hidden) or otherwise the window gets removed +/// \ref nk_begin_titled | Extended window start with separated title and identifier to allow multiple windows with same name but not title +/// \ref nk_end | Needs to be called at the end of the window building process to process scaling, scrollbars and general cleanup +/// +/// \ref nk_window_find | Finds and returns the window with give name +/// \ref nk_window_get_bounds | Returns a rectangle with screen position and size of the currently processed window. +/// \ref nk_window_get_position | Returns the position of the currently processed window +/// \ref nk_window_get_size | Returns the size with width and height of the currently processed window +/// \ref nk_window_get_width | Returns the width of the currently processed window +/// \ref nk_window_get_height | Returns the height of the currently processed window +/// \ref nk_window_get_panel | Returns the underlying panel which contains all processing state of the current window +/// \ref nk_window_get_content_region | Returns the position and size of the currently visible and non-clipped space inside the currently processed window +/// \ref nk_window_get_content_region_min | Returns the upper rectangle position of the currently visible and non-clipped space inside the currently processed window +/// \ref nk_window_get_content_region_max | Returns the upper rectangle position of the currently visible and non-clipped space inside the currently processed window +/// \ref nk_window_get_content_region_size | Returns the size of the currently visible and non-clipped space inside the currently processed window +/// \ref nk_window_get_canvas | Returns the draw command buffer. Can be used to draw custom widgets +/// \ref nk_window_get_scroll | Gets the scroll offset of the current window +/// \ref nk_window_has_focus | Returns if the currently processed window is currently active +/// \ref nk_window_is_collapsed | Returns if the window with given name is currently minimized/collapsed +/// \ref nk_window_is_closed | Returns if the currently processed window was closed +/// \ref nk_window_is_hidden | Returns if the currently processed window was hidden +/// \ref nk_window_is_active | Same as nk_window_has_focus for some reason +/// \ref nk_window_is_hovered | Returns if the currently processed window is currently being hovered by mouse +/// \ref nk_window_is_any_hovered | Return if any window currently hovered +/// \ref nk_item_is_any_active | Returns if any window or widgets is currently hovered or active // -/// nk_window_find | Finds and returns the window with give name -/// nk_window_get_bounds | Returns a rectangle with screen position and size of the currently processed window. -/// nk_window_get_position | Returns the position of the currently processed window -/// nk_window_get_size | Returns the size with width and height of the currently processed window -/// nk_window_get_width | Returns the width of the currently processed window -/// nk_window_get_height | Returns the height of the currently processed window -/// nk_window_get_panel | Returns the underlying panel which contains all processing state of the current window -/// nk_window_get_content_region | Returns the position and size of the currently visible and non-clipped space inside the currently processed window -/// nk_window_get_content_region_min | Returns the upper rectangle position of the currently visible and non-clipped space inside the currently processed window -/// nk_window_get_content_region_max | Returns the upper rectangle position of the currently visible and non-clipped space inside the currently processed window -/// nk_window_get_content_region_size | Returns the size of the currently visible and non-clipped space inside the currently processed window -/// nk_window_get_canvas | Returns the draw command buffer. Can be used to draw custom widgets -/// nk_window_get_scroll | Gets the scroll offset of the current window -/// nk_window_has_focus | Returns if the currently processed window is currently active -/// nk_window_is_collapsed | Returns if the window with given name is currently minimized/collapsed -/// nk_window_is_closed | Returns if the currently processed window was closed -/// nk_window_is_hidden | Returns if the currently processed window was hidden -/// nk_window_is_active | Same as nk_window_has_focus for some reason -/// nk_window_is_hovered | Returns if the currently processed window is currently being hovered by mouse -/// nk_window_is_any_hovered | Return if any window currently hovered -/// nk_item_is_any_active | Returns if any window or widgets is currently hovered or active +/// \ref nk_window_set_bounds | Updates position and size of the currently processed window +/// \ref nk_window_set_position | Updates position of the currently process window +/// \ref nk_window_set_size | Updates the size of the currently processed window +/// \ref nk_window_set_focus | Set the currently processed window as active window +/// \ref nk_window_set_scroll | Sets the scroll offset of the current window // -/// nk_window_set_bounds | Updates position and size of the currently processed window -/// nk_window_set_position | Updates position of the currently process window -/// nk_window_set_size | Updates the size of the currently processed window -/// nk_window_set_focus | Set the currently processed window as active window -/// nk_window_set_scroll | Sets the scroll offset of the current window -// -/// nk_window_close | Closes the window with given window name which deletes the window at the end of the frame -/// nk_window_collapse | Collapses the window with given window name -/// nk_window_collapse_if | Collapses the window with given window name if the given condition was met -/// nk_window_show | Hides a visible or reshows a hidden window -/// nk_window_show_if | Hides/shows a window depending on condition -*/ -/* -/// #### nk_panel_flags +/// \ref nk_window_close | Closes the window with given window name which deletes the window at the end of the frame +/// \ref nk_window_collapse | Collapses the window with given window name +/// \ref nk_window_collapse_if | Collapses the window with given window name if the given condition was met +/// \ref nk_window_show | Hides a visible or reshows a hidden window +/// \ref nk_window_show_if | Hides/shows a window depending on condition + +/// # nk_panel_flags /// Flag | Description /// ----------------------------|---------------------------------------- /// NK_WINDOW_BORDER | Draws a border around the window to visually separate window from the background @@ -1242,13 +1216,11 @@ NK_API const struct nk_draw_command* nk__draw_next(const struct nk_draw_command* /// NK_WINDOW_SCALE_LEFT | Puts window scaler in the left-bottom corner instead right-bottom /// NK_WINDOW_NO_INPUT | Prevents window of scaling, moving or getting focus /// -/// #### nk_collapse_states +/// # nk_collapse_states /// State | Description /// ----------------|----------------------------------------------------------- -/// __NK_MINIMIZED__| UI section is collapsed and not visible until maximized -/// __NK_MAXIMIZED__| UI section is extended and visible until minimized -///

-*/ +/// \param[in] __NK_MINIMIZED__| UI section is collapsed and not visible until maximized +/// \param[in] __NK_MAXIMIZED__| UI section is extended and visible until minimized enum nk_panel_flags { NK_WINDOW_BORDER = NK_FLAG(0), NK_WINDOW_MOVABLE = NK_FLAG(1), @@ -1262,549 +1234,549 @@ enum nk_panel_flags { NK_WINDOW_SCALE_LEFT = NK_FLAG(9), NK_WINDOW_NO_INPUT = NK_FLAG(10) }; -/*/// #### nk_begin +/// # # nk_begin /// Starts a new window; needs to be called every frame for every /// window (unless hidden) or otherwise the window gets removed /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// nk_bool nk_begin(struct nk_context *ctx, const char *title, struct nk_rect bounds, nk_flags flags); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __title__ | Window title and identifier. Needs to be persistent over frames to identify the window -/// __bounds__ | Initial position and window size. However if you do not define `NK_WINDOW_SCALABLE` or `NK_WINDOW_MOVABLE` you can set window position and size every frame -/// __flags__ | Window flags defined in the nk_panel_flags section with a number of different window behaviors +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __title__ | Window title and identifier. Needs to be persistent over frames to identify the window +/// \param[in] __bounds__ | Initial position and window size. However if you do not define `NK_WINDOW_SCALABLE` or `NK_WINDOW_MOVABLE` you can set window position and size every frame +/// \param[in] __flags__ | Window flags defined in the nk_panel_flags section with a number of different window behaviors /// -/// Returns `true(1)` if the window can be filled up with widgets from this point +/// \returns `true(1)` if the window can be filled up with widgets from this point /// until `nk_end` or `false(0)` otherwise for example if minimized -*/ + NK_API nk_bool nk_begin(struct nk_context *ctx, const char *title, struct nk_rect bounds, nk_flags flags); -/*/// #### nk_begin_titled +/// # # nk_begin_titled /// Extended window start with separated title and identifier to allow multiple /// windows with same title but not name /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// nk_bool nk_begin_titled(struct nk_context *ctx, const char *name, const char *title, struct nk_rect bounds, nk_flags flags); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __name__ | Window identifier. Needs to be persistent over frames to identify the window -/// __title__ | Window title displayed inside header if flag `NK_WINDOW_TITLE` or either `NK_WINDOW_CLOSABLE` or `NK_WINDOW_MINIMIZED` was set -/// __bounds__ | Initial position and window size. However if you do not define `NK_WINDOW_SCALABLE` or `NK_WINDOW_MOVABLE` you can set window position and size every frame -/// __flags__ | Window flags defined in the nk_panel_flags section with a number of different window behaviors +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __name__ | Window identifier. Needs to be persistent over frames to identify the window +/// \param[in] __title__ | Window title displayed inside header if flag `NK_WINDOW_TITLE` or either `NK_WINDOW_CLOSABLE` or `NK_WINDOW_MINIMIZED` was set +/// \param[in] __bounds__ | Initial position and window size. However if you do not define `NK_WINDOW_SCALABLE` or `NK_WINDOW_MOVABLE` you can set window position and size every frame +/// \param[in] __flags__ | Window flags defined in the nk_panel_flags section with a number of different window behaviors /// -/// Returns `true(1)` if the window can be filled up with widgets from this point +/// \returns `true(1)` if the window can be filled up with widgets from this point /// until `nk_end` or `false(0)` otherwise for example if minimized -*/ + NK_API nk_bool nk_begin_titled(struct nk_context *ctx, const char *name, const char *title, struct nk_rect bounds, nk_flags flags); -/*/// #### nk_end +/// # # nk_end /// Needs to be called at the end of the window building process to process scaling, scrollbars and general cleanup. /// All widget calls after this functions will result in asserts or no state changes /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_end(struct nk_context *ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct + NK_API void nk_end(struct nk_context *ctx); -/*/// #### nk_window_find +/// # # nk_window_find /// Finds and returns a window from passed name /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_window *nk_window_find(struct nk_context *ctx, const char *name); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __name__ | Window identifier +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __name__ | Window identifier /// -/// Returns a `nk_window` struct pointing to the identified window or NULL if +/// \returns a `nk_window` struct pointing to the identified window or NULL if /// no window with the given name was found -*/ + NK_API struct nk_window *nk_window_find(struct nk_context *ctx, const char *name); -/*/// #### nk_window_get_bounds -/// Returns a rectangle with screen position and size of the currently processed window +/// # # nk_window_get_bounds +/// \returns a rectangle with screen position and size of the currently processed window /// -/// !!! WARNING +/// !!! \warning /// Only call this function between calls `nk_begin_xxx` and `nk_end` -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_rect nk_window_get_bounds(const struct nk_context *ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct /// -/// Returns a `nk_rect` struct with window upper left window position and size -*/ +/// \returns a `nk_rect` struct with window upper left window position and size + NK_API struct nk_rect nk_window_get_bounds(const struct nk_context *ctx); -/*/// #### nk_window_get_position -/// Returns the position of the currently processed window. +/// # # nk_window_get_position +/// \returns the position of the currently processed window. /// -/// !!! WARNING +/// !!! \warning /// Only call this function between calls `nk_begin_xxx` and `nk_end` -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_vec2 nk_window_get_position(const struct nk_context *ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct /// -/// Returns a `nk_vec2` struct with window upper left position -*/ +/// \returns a `nk_vec2` struct with window upper left position + NK_API struct nk_vec2 nk_window_get_position(const struct nk_context *ctx); -/*/// #### nk_window_get_size -/// Returns the size with width and height of the currently processed window. +/// # # nk_window_get_size +/// \returns the size with width and height of the currently processed window. /// -/// !!! WARNING +/// !!! \warning /// Only call this function between calls `nk_begin_xxx` and `nk_end` -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_vec2 nk_window_get_size(const struct nk_context *ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct /// -/// Returns a `nk_vec2` struct with window width and height -*/ +/// \returns a `nk_vec2` struct with window width and height + NK_API struct nk_vec2 nk_window_get_size(const struct nk_context*); -/*/// #### nk_window_get_width -/// Returns the width of the currently processed window. +/// nk_window_get_width +/// \returns the width of the currently processed window. /// -/// !!! WARNING +/// !!! \warning /// Only call this function between calls `nk_begin_xxx` and `nk_end` -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// float nk_window_get_width(const struct nk_context *ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct /// -/// Returns the current window width -*/ +/// \returns the current window width NK_API float nk_window_get_width(const struct nk_context*); -/*/// #### nk_window_get_height -/// Returns the height of the currently processed window. +/// # # nk_window_get_height +/// \returns the height of the currently processed window. /// -/// !!! WARNING +/// !!! \warning /// Only call this function between calls `nk_begin_xxx` and `nk_end` -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// float nk_window_get_height(const struct nk_context *ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct /// -/// Returns the current window height -*/ +/// \returns the current window height + NK_API float nk_window_get_height(const struct nk_context*); -/*/// #### nk_window_get_panel -/// Returns the underlying panel which contains all processing state of the current window. +/// # # nk_window_get_panel +/// \returns the underlying panel which contains all processing state of the current window. /// -/// !!! WARNING +/// !!! \warning /// Only call this function between calls `nk_begin_xxx` and `nk_end` -/// !!! WARNING +/// !!! \warning /// Do not keep the returned panel pointer around, it is only valid until `nk_end` -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_panel* nk_window_get_panel(struct nk_context *ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct /// -/// Returns a pointer to window internal `nk_panel` state. -*/ +/// \returns a pointer to window internal `nk_panel` state. + NK_API struct nk_panel* nk_window_get_panel(struct nk_context*); -/*/// #### nk_window_get_content_region -/// Returns the position and size of the currently visible and non-clipped space +/// # # nk_window_get_content_region +/// \returns the position and size of the currently visible and non-clipped space /// inside the currently processed window. /// -/// !!! WARNING +/// !!! \warning /// Only call this function between calls `nk_begin_xxx` and `nk_end` /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_rect nk_window_get_content_region(struct nk_context *ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct /// -/// Returns `nk_rect` struct with screen position and size (no scrollbar offset) +/// \returns `nk_rect` struct with screen position and size (no scrollbar offset) /// of the visible space inside the current window -*/ + NK_API struct nk_rect nk_window_get_content_region(struct nk_context*); -/*/// #### nk_window_get_content_region_min -/// Returns the upper left position of the currently visible and non-clipped +/// # # nk_window_get_content_region_min +/// \returns the upper left position of the currently visible and non-clipped /// space inside the currently processed window. /// -/// !!! WARNING +/// !!! \warning /// Only call this function between calls `nk_begin_xxx` and `nk_end` /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_vec2 nk_window_get_content_region_min(struct nk_context *ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct /// /// returns `nk_vec2` struct with upper left screen position (no scrollbar offset) /// of the visible space inside the current window -*/ + NK_API struct nk_vec2 nk_window_get_content_region_min(struct nk_context*); -/*/// #### nk_window_get_content_region_max -/// Returns the lower right screen position of the currently visible and +/// # # nk_window_get_content_region_max +/// \returns the lower right screen position of the currently visible and /// non-clipped space inside the currently processed window. /// -/// !!! WARNING +/// !!! \warning /// Only call this function between calls `nk_begin_xxx` and `nk_end` /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_vec2 nk_window_get_content_region_max(struct nk_context *ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct /// -/// Returns `nk_vec2` struct with lower right screen position (no scrollbar offset) +/// \returns `nk_vec2` struct with lower right screen position (no scrollbar offset) /// of the visible space inside the current window -*/ + NK_API struct nk_vec2 nk_window_get_content_region_max(struct nk_context*); -/*/// #### nk_window_get_content_region_size -/// Returns the size of the currently visible and non-clipped space inside the +/// # # nk_window_get_content_region_size +/// \returns the size of the currently visible and non-clipped space inside the /// currently processed window /// -/// !!! WARNING +/// !!! \warning /// Only call this function between calls `nk_begin_xxx` and `nk_end` /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_vec2 nk_window_get_content_region_size(struct nk_context *ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct /// -/// Returns `nk_vec2` struct with size the visible space inside the current window -*/ +/// \returns `nk_vec2` struct with size the visible space inside the current window + NK_API struct nk_vec2 nk_window_get_content_region_size(struct nk_context*); -/*/// #### nk_window_get_canvas -/// Returns the draw command buffer. Can be used to draw custom widgets -/// !!! WARNING +/// # # nk_window_get_canvas +/// \returns the draw command buffer. Can be used to draw custom widgets +/// !!! \warning /// Only call this function between calls `nk_begin_xxx` and `nk_end` -/// !!! WARNING +/// !!! \warning /// Do not keep the returned command buffer pointer around it is only valid until `nk_end` /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_command_buffer* nk_window_get_canvas(struct nk_context *ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct /// -/// Returns a pointer to window internal `nk_command_buffer` struct used as +/// \returns a pointer to window internal `nk_command_buffer` struct used as /// drawing canvas. Can be used to do custom drawing. -*/ + NK_API struct nk_command_buffer* nk_window_get_canvas(struct nk_context*); -/*/// #### nk_window_get_scroll +/// # # nk_window_get_scroll /// Gets the scroll offset for the current window -/// !!! WARNING +/// !!! \warning /// Only call this function between calls `nk_begin_xxx` and `nk_end` /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_window_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// -------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __offset_x__ | A pointer to the x offset output (or NULL to ignore) -/// __offset_y__ | A pointer to the y offset output (or NULL to ignore) -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __offset_x__ | A pointer to the x offset output (or NULL to ignore) +/// \param[in] __offset_y__ | A pointer to the y offset output (or NULL to ignore) + NK_API void nk_window_get_scroll(struct nk_context*, nk_uint *offset_x, nk_uint *offset_y); -/*/// #### nk_window_has_focus -/// Returns if the currently processed window is currently active -/// !!! WARNING +/// # # nk_window_has_focus +/// \returns if the currently processed window is currently active +/// !!! \warning /// Only call this function between calls `nk_begin_xxx` and `nk_end` -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// nk_bool nk_window_has_focus(const struct nk_context *ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct /// -/// Returns `false(0)` if current window is not active or `true(1)` if it is -*/ +/// \returns `false(0)` if current window is not active or `true(1)` if it is + NK_API nk_bool nk_window_has_focus(const struct nk_context*); -/*/// #### nk_window_is_hovered +/// # # nk_window_is_hovered /// Return if the current window is being hovered -/// !!! WARNING +/// !!! \warning /// Only call this function between calls `nk_begin_xxx` and `nk_end` -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// nk_bool nk_window_is_hovered(struct nk_context *ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct /// -/// Returns `true(1)` if current window is hovered or `false(0)` otherwise -*/ +/// \returns `true(1)` if current window is hovered or `false(0)` otherwise + NK_API nk_bool nk_window_is_hovered(struct nk_context*); -/*/// #### nk_window_is_collapsed -/// Returns if the window with given name is currently minimized/collapsed -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// # # nk_window_is_collapsed +/// \returns if the window with given name is currently minimized/collapsed +/// ```c /// nk_bool nk_window_is_collapsed(struct nk_context *ctx, const char *name); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __name__ | Identifier of window you want to check if it is collapsed +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __name__ | Identifier of window you want to check if it is collapsed /// -/// Returns `true(1)` if current window is minimized and `false(0)` if window not +/// \returns `true(1)` if current window is minimized and `false(0)` if window not /// found or is not minimized -*/ + NK_API nk_bool nk_window_is_collapsed(struct nk_context *ctx, const char *name); -/*/// #### nk_window_is_closed -/// Returns if the window with given name was closed by calling `nk_close` -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// # # nk_window_is_closed +/// \returns if the window with given name was closed by calling `nk_close` +/// ```c /// nk_bool nk_window_is_closed(struct nk_context *ctx, const char *name); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __name__ | Identifier of window you want to check if it is closed +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __name__ | Identifier of window you want to check if it is closed /// -/// Returns `true(1)` if current window was closed or `false(0)` window not found or not closed -*/ +/// \returns `true(1)` if current window was closed or `false(0)` window not found or not closed + NK_API nk_bool nk_window_is_closed(struct nk_context*, const char*); -/*/// #### nk_window_is_hidden -/// Returns if the window with given name is hidden -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// # # nk_window_is_hidden +/// \returns if the window with given name is hidden +/// ```c /// nk_bool nk_window_is_hidden(struct nk_context *ctx, const char *name); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __name__ | Identifier of window you want to check if it is hidden +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __name__ | Identifier of window you want to check if it is hidden /// -/// Returns `true(1)` if current window is hidden or `false(0)` window not found or visible -*/ +/// \returns `true(1)` if current window is hidden or `false(0)` window not found or visible + NK_API nk_bool nk_window_is_hidden(struct nk_context*, const char*); -/*/// #### nk_window_is_active +/// # # nk_window_is_active /// Same as nk_window_has_focus for some reason -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// nk_bool nk_window_is_active(struct nk_context *ctx, const char *name); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __name__ | Identifier of window you want to check if it is active +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __name__ | Identifier of window you want to check if it is active /// -/// Returns `true(1)` if current window is active or `false(0)` window not found or not active -*/ +/// \returns `true(1)` if current window is active or `false(0)` window not found or not active + NK_API nk_bool nk_window_is_active(struct nk_context*, const char*); -/*/// #### nk_window_is_any_hovered -/// Returns if the any window is being hovered -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// # # nk_window_is_any_hovered +/// \returns if the any window is being hovered +/// ```c /// nk_bool nk_window_is_any_hovered(struct nk_context*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct /// -/// Returns `true(1)` if any window is hovered or `false(0)` otherwise -*/ +/// \returns `true(1)` if any window is hovered or `false(0)` otherwise + NK_API nk_bool nk_window_is_any_hovered(struct nk_context*); -/*/// #### nk_item_is_any_active -/// Returns if the any window is being hovered or any widget is currently active. +/// # # nk_item_is_any_active +/// \returns if the any window is being hovered or any widget is currently active. /// Can be used to decide if input should be processed by UI or your specific input handling. /// Example could be UI and 3D camera to move inside a 3D space. -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// nk_bool nk_item_is_any_active(struct nk_context*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct /// -/// Returns `true(1)` if any window is hovered or any item is active or `false(0)` otherwise -*/ +/// \returns `true(1)` if any window is hovered or any item is active or `false(0)` otherwise + NK_API nk_bool nk_item_is_any_active(struct nk_context*); -/*/// #### nk_window_set_bounds +/// # # nk_window_set_bounds /// Updates position and size of window with passed in name -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_window_set_bounds(struct nk_context*, const char *name, struct nk_rect bounds); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __name__ | Identifier of the window to modify both position and size -/// __bounds__ | Must point to a `nk_rect` struct with the new position and size -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __name__ | Identifier of the window to modify both position and size +/// \param[in] __bounds__ | Must point to a `nk_rect` struct with the new position and size + NK_API void nk_window_set_bounds(struct nk_context*, const char *name, struct nk_rect bounds); -/*/// #### nk_window_set_position +/// # # nk_window_set_position /// Updates position of window with passed name -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_window_set_position(struct nk_context*, const char *name, struct nk_vec2 pos); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __name__ | Identifier of the window to modify both position -/// __pos__ | Must point to a `nk_vec2` struct with the new position -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __name__ | Identifier of the window to modify both position +/// \param[in] __pos__ | Must point to a `nk_vec2` struct with the new position + NK_API void nk_window_set_position(struct nk_context*, const char *name, struct nk_vec2 pos); -/*/// #### nk_window_set_size +/// # # nk_window_set_size /// Updates size of window with passed in name -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_window_set_size(struct nk_context*, const char *name, struct nk_vec2); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __name__ | Identifier of the window to modify both window size -/// __size__ | Must point to a `nk_vec2` struct with new window size -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __name__ | Identifier of the window to modify both window size +/// \param[in] __size__ | Must point to a `nk_vec2` struct with new window size + NK_API void nk_window_set_size(struct nk_context*, const char *name, struct nk_vec2); -/*/// #### nk_window_set_focus +/// # # nk_window_set_focus /// Sets the window with given name as active -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_window_set_focus(struct nk_context*, const char *name); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __name__ | Identifier of the window to set focus on -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __name__ | Identifier of the window to set focus on + NK_API void nk_window_set_focus(struct nk_context*, const char *name); -/*/// #### nk_window_set_scroll +/// # # nk_window_set_scroll /// Sets the scroll offset for the current window -/// !!! WARNING +/// !!! \warning /// Only call this function between calls `nk_begin_xxx` and `nk_end` /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_window_set_scroll(struct nk_context *ctx, nk_uint offset_x, nk_uint offset_y); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// -------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __offset_x__ | The x offset to scroll to -/// __offset_y__ | The y offset to scroll to -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __offset_x__ | The x offset to scroll to +/// \param[in] __offset_y__ | The y offset to scroll to + NK_API void nk_window_set_scroll(struct nk_context*, nk_uint offset_x, nk_uint offset_y); -/*/// #### nk_window_close +/// # # nk_window_close /// Closes a window and marks it for being freed at the end of the frame -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_window_close(struct nk_context *ctx, const char *name); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __name__ | Identifier of the window to close -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __name__ | Identifier of the window to close + NK_API void nk_window_close(struct nk_context *ctx, const char *name); -/*/// #### nk_window_collapse +/// # # nk_window_collapse /// Updates collapse state of a window with given name -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_window_collapse(struct nk_context*, const char *name, enum nk_collapse_states state); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __name__ | Identifier of the window to close -/// __state__ | value out of nk_collapse_states section -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __name__ | Identifier of the window to close +/// \param[in] __state__ | value out of nk_collapse_states section + NK_API void nk_window_collapse(struct nk_context*, const char *name, enum nk_collapse_states state); -/*/// #### nk_window_collapse_if +/// # # nk_window_collapse_if /// Updates collapse state of a window with given name if given condition is met -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_window_collapse_if(struct nk_context*, const char *name, enum nk_collapse_states, int cond); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __name__ | Identifier of the window to either collapse or maximize -/// __state__ | value out of nk_collapse_states section the window should be put into -/// __cond__ | condition that has to be met to actually commit the collapse state change -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __name__ | Identifier of the window to either collapse or maximize +/// \param[in] __state__ | value out of nk_collapse_states section the window should be put into +/// \param[in] __cond__ | condition that has to be met to actually commit the collapse state change + NK_API void nk_window_collapse_if(struct nk_context*, const char *name, enum nk_collapse_states, int cond); -/*/// #### nk_window_show +/// # # nk_window_show /// updates visibility state of a window with given name -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_window_show(struct nk_context*, const char *name, enum nk_show_states); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __name__ | Identifier of the window to either collapse or maximize -/// __state__ | state with either visible or hidden to modify the window with -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __name__ | Identifier of the window to either collapse or maximize +/// \param[in] __state__ | state with either visible or hidden to modify the window with + NK_API void nk_window_show(struct nk_context*, const char *name, enum nk_show_states); -/*/// #### nk_window_show_if +/// # # nk_window_show_if /// Updates visibility state of a window with given name if a given condition is met -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_window_show_if(struct nk_context*, const char *name, enum nk_show_states, int cond); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __name__ | Identifier of the window to either hide or show -/// __state__ | state with either visible or hidden to modify the window with -/// __cond__ | condition that has to be met to actually commit the visibility state change -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __name__ | Identifier of the window to either hide or show +/// \param[in] __state__ | state with either visible or hidden to modify the window with +/// \param[in] __cond__ | condition that has to be met to actually commit the visibility state change + NK_API void nk_window_show_if(struct nk_context*, const char *name, enum nk_show_states, int cond); -/*/// #### nk_window_show_if +/// # # nk_window_show_if /// Line for visual separation. Draws a line with thickness determined by the current row height. -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, NK_BOOL rounding) -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ----------------|------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __color__ | Color of the horizontal line -/// __rounding__ | Whether or not to make the line round -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __color__ | Color of the horizontal line +/// \param[in] __rounding__ | Whether or not to make the line round + NK_API void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, nk_bool rounding); /* ============================================================================= * * LAYOUT * - * ============================================================================= -/// ### Layouting + * =============================================================================*/ +/// \page +/// # Layouting /// Layouting in general describes placing widget inside a window with position and size. /// While in this particular implementation there are five different APIs for layouting /// each with different trade offs between control and ease of use.

@@ -1843,22 +1815,22 @@ NK_API void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, nk /// layouting yourself. However for quick and dirty layouting using all the other layouting /// functions should be fine. /// -/// #### Usage +/// # 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 +/// ```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 +/// ```c /// if (nk_begin_xxx(...) { /// // first row with height: 30 composed of two widgets /// nk_layout_row_dynamic(&ctx, 30, 2); @@ -1875,14 +1847,14 @@ NK_API void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, nk /// 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 +/// ```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); @@ -1899,7 +1871,7 @@ NK_API void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, nk /// nk_widget(...); /// } /// nk_end(...); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// 3. __nk_layout_row_xxx__

/// A little bit more advanced layouting API are functions `nk_layout_row_begin`, @@ -1910,7 +1882,7 @@ NK_API void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, nk /// pushed before calling a widget. Therefore the layout is not automatically /// repeating like the last two layouting functions. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```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); @@ -1937,7 +1909,7 @@ NK_API void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, nk /// 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 @@ -1946,7 +1918,7 @@ NK_API void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, nk /// `nk_layout_row` is automatically repeating. Otherwise the behavior is the /// same. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// if (nk_begin_xxx(...) { /// // two rows with height: 30 composed of two widgets with width 60 and 40 /// const float ratio[] = {60,40}; @@ -1973,7 +1945,7 @@ NK_API void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, nk /// nk_widget(...); /// } /// nk_end(...); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// 5. __nk_layout_row_template_xxx__

/// The most complex and second most flexible API is a simplified flexbox version without @@ -1990,7 +1962,7 @@ NK_API void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, nk /// which are completely flexible and unlike variable widgets can even shrink /// to zero if not enough space is provided. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// if (nk_begin_xxx(...) { /// // two rows with height: 30 composed of three widgets /// nk_layout_row_template_begin(ctx, 30); @@ -2010,7 +1982,7 @@ NK_API void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, nk /// nk_widget(...); /// } /// nk_end(...); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// 6. __nk_layout_space_xxx__

/// Finally the most flexible API directly allows you to place widgets inside the @@ -2021,7 +1993,7 @@ NK_API void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, nk /// powerful there are a number of utility functions to get the available space /// and convert between local allocated space and screen space. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```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); @@ -2039,39 +2011,39 @@ NK_API void nk_rule_horizontal(struct nk_context *ctx, struct nk_color color, nk /// nk_widget(...); /// } /// nk_end(...); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// #### Reference -/// Function | Description -/// ----------------------------------------|------------------------------------ -/// nk_layout_set_min_row_height | Set the currently used minimum row height to a specified value -/// nk_layout_reset_min_row_height | Resets the currently used minimum row height to font height -/// nk_layout_widget_bounds | Calculates current width a static layout row can fit inside a window -/// nk_layout_ratio_from_pixel | Utility functions to calculate window ratio from pixel size +/// # Reference +/// Function | Description +/// ---------------------------------------------|------------------------------------ +/// \ref nk_layout_set_min_row_height | Set the currently used minimum row height to a specified value +/// \ref nk_layout_reset_min_row_height | Resets the currently used minimum row height to font height +/// \ref nk_layout_widget_bounds | Calculates current width a static layout row can fit inside a window +/// \ref nk_layout_ratio_from_pixel | Utility functions to calculate window ratio from pixel size // -/// nk_layout_row_dynamic | Current layout is divided into n same sized growing columns -/// nk_layout_row_static | Current layout is divided into n same fixed sized columns -/// nk_layout_row_begin | Starts a new row with given height and number of columns -/// nk_layout_row_push | Pushes another column with given size or window ratio -/// nk_layout_row_end | Finished previously started row -/// nk_layout_row | Specifies row columns in array as either window ratio or size +/// \ref nk_layout_row_dynamic | Current layout is divided into n same sized growing columns +/// \ref nk_layout_row_static | Current layout is divided into n same fixed sized columns +/// \ref nk_layout_row_begin | Starts a new row with given height and number of columns +/// \ref nk_layout_row_push | Pushes another column with given size or window ratio +/// \ref nk_layout_row_end | Finished previously started row +/// \ref nk_layout_row | Specifies row columns in array as either window ratio or size // -/// nk_layout_row_template_begin | Begins the row template declaration -/// nk_layout_row_template_push_dynamic | Adds a dynamic column that dynamically grows and can go to zero if not enough space -/// nk_layout_row_template_push_variable | Adds a variable column that dynamically grows but does not shrink below specified pixel width -/// nk_layout_row_template_push_static | Adds a static column that does not grow and will always have the same size -/// nk_layout_row_template_end | Marks the end of the row template +/// \ref nk_layout_row_template_begin | Begins the row template declaration +/// \ref nk_layout_row_template_push_dynamic | Adds a dynamic column that dynamically grows and can go to zero if not enough space +/// \ref nk_layout_row_template_push_variable | Adds a variable column that dynamically grows but does not shrink below specified pixel width +/// \ref nk_layout_row_template_push_static | Adds a static column that does not grow and will always have the same size +/// \ref nk_layout_row_template_end | Marks the end of the row template // -/// nk_layout_space_begin | Begins a new layouting space that allows to specify each widgets position and size -/// nk_layout_space_push | Pushes position and size of the next widget in own coordinate space either as pixel or ratio -/// nk_layout_space_end | Marks the end of the layouting space +/// \ref nk_layout_space_begin | Begins a new layouting space that allows to specify each widgets position and size +/// \ref nk_layout_space_push | Pushes position and size of the next widget in own coordinate space either as pixel or ratio +/// \ref nk_layout_space_end | Marks the end of the layouting space // -/// nk_layout_space_bounds | Callable after nk_layout_space_begin and returns total space allocated -/// nk_layout_space_to_screen | Converts vector from nk_layout_space coordinate space into screen space -/// nk_layout_space_to_local | Converts vector from screen space into nk_layout_space coordinates -/// nk_layout_space_rect_to_screen | Converts rectangle from nk_layout_space coordinate space into screen space -/// nk_layout_space_rect_to_local | Converts rectangle from screen space into nk_layout_space coordinates -*/ +/// \ref nk_layout_space_bounds | Callable after nk_layout_space_begin and returns total space allocated +/// \ref nk_layout_space_to_screen | Converts vector from nk_layout_space coordinate space into screen space +/// \ref nk_layout_space_to_local | Converts vector from screen space into nk_layout_space coordinates +/// \ref nk_layout_space_rect_to_screen | Converts rectangle from nk_layout_space coordinate space into screen space +/// \ref nk_layout_space_rect_to_local | Converts rectangle from screen space into nk_layout_space coordinates + enum nk_widget_align { NK_WIDGET_ALIGN_LEFT = 0x01, @@ -2087,319 +2059,304 @@ enum nk_widget_alignment { NK_WIDGET_RIGHT = NK_WIDGET_ALIGN_MIDDLE|NK_WIDGET_ALIGN_RIGHT }; -/*/// #### nk_layout_set_min_row_height /// Sets the currently used minimum row height. -/// !!! WARNING +/// !!! \warning /// The passed height needs to include both your preferred row height /// as well as padding. No internal padding is added. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_layout_set_min_row_height(struct nk_context*, float height); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` -/// __height__ | New minimum row height to be used for auto generating the row height -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` +/// \param[in] __height__ | New minimum row height to be used for auto generating the row height NK_API void nk_layout_set_min_row_height(struct nk_context*, float height); -/*/// #### nk_layout_reset_min_row_height + /// Reset the currently used minimum row height back to `font_height + text_padding + padding` -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_layout_reset_min_row_height(struct nk_context*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` NK_API void nk_layout_reset_min_row_height(struct nk_context*); -/*/// #### nk_layout_widget_bounds -/// Returns the width of the next row allocate by one of the layouting functions -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c + +/// \brief Returns the width of the next row allocate by one of the layouting functions +/// +/// \details +/// ```c /// struct nk_rect nk_layout_widget_bounds(struct nk_context*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` /// -/// Return `nk_rect` with both position and size of the next row -*/ +/// \return `nk_rect` with both position and size of the next row NK_API struct nk_rect nk_layout_widget_bounds(struct nk_context*); -/*/// #### nk_layout_ratio_from_pixel -/// Utility functions to calculate window ratio from pixel size -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c + +/// \brief Utility functions to calculate window ratio from pixel size +/// +/// \details +/// ```c /// float nk_layout_ratio_from_pixel(struct nk_context*, float pixel_width); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` -/// __pixel__ | Pixel_width to convert to window ratio +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` +/// \param[in] __pixel__ | Pixel_width to convert to window ratio /// -/// Returns `nk_rect` with both position and size of the next row -*/ +/// \returns `nk_rect` with both position and size of the next row NK_API float nk_layout_ratio_from_pixel(struct nk_context*, float pixel_width); -/*/// #### nk_layout_row_dynamic -/// Sets current row layout to share horizontal space + +/// \brief Sets current row layout to share horizontal space /// between @cols number of widgets evenly. Once called all subsequent widget /// calls greater than @cols will allocate a new row with same layout. -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c -/// void nk_layout_row_dynamic(struct nk_context *ctx, float height, int cols); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` -/// __height__ | Holds height of each widget in row or zero for auto layouting -/// __columns__ | Number of widget inside row -*/ +/// \details +/// ```c +/// void nk_layout_row_dynamic(struct nk_context *ctx, float height, int cols); +/// ``` +/// +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` +/// \param[in] __height__ | Holds height of each widget in row or zero for auto layouting +/// \param[in] __columns__ | Number of widget inside row NK_API void nk_layout_row_dynamic(struct nk_context *ctx, float height, int cols); -/*/// #### nk_layout_row_static -/// Sets current row layout to fill @cols number of widgets + +/// \brief Sets current row layout to fill @cols number of widgets /// in row with same @item_width horizontal size. Once called all subsequent widget /// calls greater than @cols will allocate a new row with same layout. -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// +/// \details +/// ```c /// void nk_layout_row_static(struct nk_context *ctx, float height, int item_width, int cols); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` -/// __height__ | Holds height of each widget in row or zero for auto layouting -/// __width__ | Holds pixel width of each widget in the row -/// __columns__ | Number of widget inside row -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` +/// \param[in] __height__ | Holds height of each widget in row or zero for auto layouting +/// \param[in] __width__ | Holds pixel width of each widget in the row +/// \param[in] __columns__ | Number of widget inside row NK_API void nk_layout_row_static(struct nk_context *ctx, float height, int item_width, int cols); -/*/// #### nk_layout_row_begin -/// Starts a new dynamic or fixed row with given height and columns. -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c + +/// \brief Starts a new dynamic or fixed row with given height and columns. +/// +/// \details +/// ```c /// void nk_layout_row_begin(struct nk_context *ctx, enum nk_layout_format fmt, float row_height, int cols); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` -/// __fmt__ | either `NK_DYNAMIC` for window ratio or `NK_STATIC` for fixed size columns -/// __height__ | holds height of each widget in row or zero for auto layouting -/// __columns__ | Number of widget inside row -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` +/// \param[in] __fmt__ | either `NK_DYNAMIC` for window ratio or `NK_STATIC` for fixed size columns +/// \param[in] __height__ | holds height of each widget in row or zero for auto layouting +/// \param[in] __columns__ | Number of widget inside row NK_API void nk_layout_row_begin(struct nk_context *ctx, enum nk_layout_format fmt, float row_height, int cols); -/*/// #### nk_layout_row_push -/// Specifies either window ratio or width of a single column -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c + +/// \breif Specifies either window ratio or width of a single column +/// +/// \details +/// ```c /// void nk_layout_row_push(struct nk_context*, float value); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` -/// __value__ | either a window ratio or fixed width depending on @fmt in previous `nk_layout_row_begin` call -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` +/// \param[in] __value__ | either a window ratio or fixed width depending on @fmt in previous `nk_layout_row_begin` call NK_API void nk_layout_row_push(struct nk_context*, float value); -/*/// #### nk_layout_row_end -/// Finished previously started row -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c + +/// \brief Finished previously started row +/// +/// \details +/// ```c /// void nk_layout_row_end(struct nk_context*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` NK_API void nk_layout_row_end(struct nk_context*); -/*/// #### nk_layout_row -/// Specifies row columns in array as either window ratio or size -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c + +/// \brief Specifies row columns in array as either window ratio or size +/// +/// \details +/// ```c /// void nk_layout_row(struct nk_context*, enum nk_layout_format, float height, int cols, const float *ratio); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` -/// __fmt__ | Either `NK_DYNAMIC` for window ratio or `NK_STATIC` for fixed size columns -/// __height__ | Holds height of each widget in row or zero for auto layouting -/// __columns__ | Number of widget inside row -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` +/// \param[in] __fmt__ | Either `NK_DYNAMIC` for window ratio or `NK_STATIC` for fixed size columns +/// \param[in] __height__ | Holds height of each widget in row or zero for auto layouting +/// \param[in] __columns__ | Number of widget inside row NK_API void nk_layout_row(struct nk_context*, enum nk_layout_format, float height, int cols, const float *ratio); -/*/// #### nk_layout_row_template_begin + +/// # # nk_layout_row_template_begin /// Begins the row template declaration -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_layout_row_template_begin(struct nk_context*, float row_height); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` -/// __height__ | Holds height of each widget in row or zero for auto layouting -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` +/// \param[in] __height__ | Holds height of each widget in row or zero for auto layouting NK_API void nk_layout_row_template_begin(struct nk_context*, float row_height); -/*/// #### nk_layout_row_template_push_dynamic + +/// # # nk_layout_row_template_push_dynamic /// Adds a dynamic column that dynamically grows and can go to zero if not enough space -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_layout_row_template_push_dynamic(struct nk_context*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` -/// __height__ | Holds height of each widget in row or zero for auto layouting -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` +/// \param[in] __height__ | Holds height of each widget in row or zero for auto layouting NK_API void nk_layout_row_template_push_dynamic(struct nk_context*); -/*/// #### nk_layout_row_template_push_variable + +/// # # nk_layout_row_template_push_variable /// Adds a variable column that dynamically grows but does not shrink below specified pixel width -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_layout_row_template_push_variable(struct nk_context*, float min_width); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` -/// __width__ | Holds the minimum pixel width the next column must always be -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` +/// \param[in] __width__ | Holds the minimum pixel width the next column must always be NK_API void nk_layout_row_template_push_variable(struct nk_context*, float min_width); -/*/// #### nk_layout_row_template_push_static + +/// # # nk_layout_row_template_push_static /// Adds a static column that does not grow and will always have the same size -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_layout_row_template_push_static(struct nk_context*, float width); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` -/// __width__ | Holds the absolute pixel width value the next column must be -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` +/// \param[in] __width__ | Holds the absolute pixel width value the next column must be NK_API void nk_layout_row_template_push_static(struct nk_context*, float width); -/*/// #### nk_layout_row_template_end + +/// # # nk_layout_row_template_end /// Marks the end of the row template -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_layout_row_template_end(struct nk_context*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` NK_API void nk_layout_row_template_end(struct nk_context*); -/*/// #### nk_layout_space_begin + +/// # # nk_layout_space_begin /// Begins a new layouting space that allows to specify each widgets position and size. -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_layout_space_begin(struct nk_context*, enum nk_layout_format, float height, int widget_count); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` -/// __fmt__ | Either `NK_DYNAMIC` for window ratio or `NK_STATIC` for fixed size columns -/// __height__ | Holds height of each widget in row or zero for auto layouting -/// __columns__ | Number of widgets inside row -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx` +/// \param[in] __fmt__ | Either `NK_DYNAMIC` for window ratio or `NK_STATIC` for fixed size columns +/// \param[in] __height__ | Holds height of each widget in row or zero for auto layouting +/// \param[in] __columns__ | Number of widgets inside row NK_API void nk_layout_space_begin(struct nk_context*, enum nk_layout_format, float height, int widget_count); -/*/// #### nk_layout_space_push + +/// # # nk_layout_space_push /// Pushes position and size of the next widget in own coordinate space either as pixel or ratio -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_layout_space_push(struct nk_context *ctx, struct nk_rect bounds); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin` -/// __bounds__ | Position and size in laoyut space local coordinates -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin` +/// \param[in] __bounds__ | Position and size in laoyut space local coordinates NK_API void nk_layout_space_push(struct nk_context*, struct nk_rect bounds); -/*/// #### nk_layout_space_end + +/// # # nk_layout_space_end /// Marks the end of the layout space -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_layout_space_end(struct nk_context*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin` -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin` NK_API void nk_layout_space_end(struct nk_context*); -/*/// #### nk_layout_space_bounds + +/// # # nk_layout_space_bounds /// Utility function to calculate total space allocated for `nk_layout_space` -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_rect nk_layout_space_bounds(struct nk_context*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin` +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin` /// -/// Returns `nk_rect` holding the total space allocated -*/ +/// \returns `nk_rect` holding the total space allocated NK_API struct nk_rect nk_layout_space_bounds(struct nk_context*); -/*/// #### nk_layout_space_to_screen + +/// # # nk_layout_space_to_screen /// Converts vector from nk_layout_space coordinate space into screen space -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_vec2 nk_layout_space_to_screen(struct nk_context*, struct nk_vec2); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin` -/// __vec__ | Position to convert from layout space into screen coordinate space +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin` +/// \param[in] __vec__ | Position to convert from layout space into screen coordinate space /// -/// Returns transformed `nk_vec2` in screen space coordinates -*/ +/// \returns transformed `nk_vec2` in screen space coordinates NK_API struct nk_vec2 nk_layout_space_to_screen(struct nk_context*, struct nk_vec2); -/*/// #### nk_layout_space_to_local + +/// # # nk_layout_space_to_local /// Converts vector from layout space into screen space -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_vec2 nk_layout_space_to_local(struct nk_context*, struct nk_vec2); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin` -/// __vec__ | Position to convert from screen space into layout coordinate space +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin` +/// \param[in] __vec__ | Position to convert from screen space into layout coordinate space /// -/// Returns transformed `nk_vec2` in layout space coordinates -*/ +/// \returns transformed `nk_vec2` in layout space coordinates NK_API struct nk_vec2 nk_layout_space_to_local(struct nk_context*, struct nk_vec2); -/*/// #### nk_layout_space_rect_to_screen + +/// # # nk_layout_space_rect_to_screen /// Converts rectangle from screen space into layout space -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_rect nk_layout_space_rect_to_screen(struct nk_context*, struct nk_rect); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin` -/// __bounds__ | Rectangle to convert from layout space into screen space +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin` +/// \param[in] __bounds__ | Rectangle to convert from layout space into screen space /// -/// Returns transformed `nk_rect` in screen space coordinates -*/ +/// \returns transformed `nk_rect` in screen space coordinates NK_API struct nk_rect nk_layout_space_rect_to_screen(struct nk_context*, struct nk_rect); -/*/// #### nk_layout_space_rect_to_local + +/// # # nk_layout_space_rect_to_local /// Converts rectangle from layout space into screen space -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_rect nk_layout_space_rect_to_local(struct nk_context*, struct nk_rect); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin` -/// __bounds__ | Rectangle to convert from layout space into screen space +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin` +/// \param[in] __bounds__ | Rectangle to convert from layout space into screen space /// -/// Returns transformed `nk_rect` in layout space coordinates -*/ +/// \returns transformed `nk_rect` in layout space coordinates NK_API struct nk_rect nk_layout_space_rect_to_local(struct nk_context*, struct nk_rect); -/*/// #### nk_spacer +/// # # nk_spacer /// Spacer is a dummy widget that consumes space as usual but doesn't draw anything -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_spacer(struct nk_context* ); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin` +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin` /// -*/ + NK_API void nk_spacer(struct nk_context* ); @@ -2407,8 +2364,9 @@ NK_API void nk_spacer(struct nk_context* ); * * GROUP * - * ============================================================================= -/// ### Groups + * =============================================================================*/ +/// \page +/// # Groups /// Groups are basically windows inside windows. They allow to subdivide space /// in a window to layout widgets as a group. Almost all more complex widget /// layouting requirements can be solved using groups and basic layouting @@ -2416,7 +2374,7 @@ NK_API void nk_spacer(struct nk_context* ); /// internally keep track of scrollbar offsets by default. However additional /// versions are provided to directly manage the scrollbar. /// -/// #### Usage +/// # Usage /// To create a group you have to call one of the three `nk_group_begin_xxx` /// functions to start group declarations and `nk_group_end` at the end. Furthermore it /// is required to check the return value of `nk_group_begin_xxx` and only process @@ -2425,17 +2383,17 @@ NK_API void nk_spacer(struct nk_context* ); /// can only be achieved by nesting. Groups, unlike windows, need `nk_group_end` /// to be only called if the corresponding `nk_group_begin_xxx` call does not return 0: /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// if (nk_group_begin_xxx(ctx, ...) { /// // [... widgets ...] /// nk_group_end(ctx); /// } -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// In the grand concept groups can be called after starting a window /// with `nk_begin_xxx` and before calling `nk_end`: /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// struct nk_context ctx; /// nk_init_xxx(&ctx, ...); /// while (1) { @@ -2478,141 +2436,138 @@ NK_API void nk_spacer(struct nk_context* ); /// nk_clear(&ctx); /// } /// nk_free(&ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -/// #### Reference +/// ``` +/// # Reference /// Function | Description /// --------------------------------|------------------------------------------- -/// nk_group_begin | Start a new group with internal scrollbar handling -/// nk_group_begin_titled | Start a new group with separated name and title and internal scrollbar handling -/// nk_group_end | Ends a group. Should only be called if nk_group_begin returned non-zero -/// nk_group_scrolled_offset_begin | Start a new group with manual separated handling of scrollbar x- and y-offset -/// nk_group_scrolled_begin | Start a new group with manual scrollbar handling -/// nk_group_scrolled_end | Ends a group with manual scrollbar handling. Should only be called if nk_group_begin returned non-zero -/// nk_group_get_scroll | Gets the scroll offset for the given group -/// nk_group_set_scroll | Sets the scroll offset for the given group -*/ -/*/// #### nk_group_begin -/// Starts a new widget group. Requires a previous layouting function to specify a pos/size. -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// \ref nk_group_begin | Start a new group with internal scrollbar handling +/// \ref nk_group_begin_titled | Start a new group with separated name and title and internal scrollbar handling +/// \ref nk_group_end | Ends a group. Should only be called if nk_group_begin returned non-zero +/// \ref nk_group_scrolled_offset_begin | Start a new group with manual separated handling of scrollbar x- and y-offset +/// \ref nk_group_scrolled_begin | Start a new group with manual scrollbar handling +/// \ref nk_group_scrolled_end | Ends a group with manual scrollbar handling. Should only be called if nk_group_begin returned non-zero +/// \ref nk_group_get_scroll | Gets the scroll offset for the given group +/// \ref nk_group_set_scroll | Sets the scroll offset for the given group + +/// \brief Starts a new widget group. Requires a previous layouting function to specify a pos/size. +/// ```c /// nk_bool nk_group_begin(struct nk_context*, const char *title, nk_flags); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __title__ | Must be an unique identifier for this group that is also used for the group header -/// __flags__ | Window flags defined in the nk_panel_flags section with a number of different group behaviors +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __title__ | Must be an unique identifier for this group that is also used for the group header +/// \param[in] __flags__ | Window flags defined in the nk_panel_flags section with a number of different group behaviors /// -/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise -*/ +/// \returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise NK_API nk_bool nk_group_begin(struct nk_context*, const char *title, nk_flags); -/*/// #### nk_group_begin_titled -/// Starts a new widget group. Requires a previous layouting function to specify a pos/size. -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c + +/// \brief Starts a new widget group. Requires a previous layouting function to specify a pos/size. +/// ```c /// nk_bool nk_group_begin_titled(struct nk_context*, const char *name, const char *title, nk_flags); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __id__ | Must be an unique identifier for this group -/// __title__ | Group header title -/// __flags__ | Window flags defined in the nk_panel_flags section with a number of different group behaviors +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __id__ | Must be an unique identifier for this group +/// \param[in] __title__ | Group header title +/// \param[in] __flags__ | Window flags defined in the nk_panel_flags section with a number of different group behaviors /// -/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise -*/ +/// \returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise NK_API nk_bool nk_group_begin_titled(struct nk_context*, const char *name, const char *title, nk_flags); -/*/// #### nk_group_end + +/// # # nk_group_end /// Ends a widget group -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_group_end(struct nk_context*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct NK_API void nk_group_end(struct nk_context*); -/*/// #### nk_group_scrolled_offset_begin + +/// # # nk_group_scrolled_offset_begin /// starts a new widget group. requires a previous layouting function to specify /// a size. Does not keep track of scrollbar. -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// nk_bool nk_group_scrolled_offset_begin(struct nk_context*, nk_uint *x_offset, nk_uint *y_offset, const char *title, nk_flags flags); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __x_offset__| Scrollbar x-offset to offset all widgets inside the group horizontally. -/// __y_offset__| Scrollbar y-offset to offset all widgets inside the group vertically -/// __title__ | Window unique group title used to both identify and display in the group header -/// __flags__ | Window flags from the nk_panel_flags section +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __x_offset__| Scrollbar x-offset to offset all widgets inside the group horizontally. +/// \param[in] __y_offset__| Scrollbar y-offset to offset all widgets inside the group vertically +/// \param[in] __title__ | Window unique group title used to both identify and display in the group header +/// \param[in] __flags__ | Window flags from the nk_panel_flags section /// -/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise -*/ +/// \returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise NK_API nk_bool nk_group_scrolled_offset_begin(struct nk_context*, nk_uint *x_offset, nk_uint *y_offset, const char *title, nk_flags flags); -/*/// #### nk_group_scrolled_begin + +/// # # nk_group_scrolled_begin /// Starts a new widget group. requires a previous /// layouting function to specify a size. Does not keep track of scrollbar. -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// nk_bool nk_group_scrolled_begin(struct nk_context*, struct nk_scroll *off, const char *title, nk_flags); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __off__ | Both x- and y- scroll offset. Allows for manual scrollbar control -/// __title__ | Window unique group title used to both identify and display in the group header -/// __flags__ | Window flags from nk_panel_flags section +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __off__ | Both x- and y- scroll offset. Allows for manual scrollbar control +/// \param[in] __title__ | Window unique group title used to both identify and display in the group header +/// \param[in] __flags__ | Window flags from nk_panel_flags section /// -/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise -*/ +/// \returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise NK_API nk_bool nk_group_scrolled_begin(struct nk_context*, struct nk_scroll *off, const char *title, nk_flags); -/*/// #### nk_group_scrolled_end + +/// # # nk_group_scrolled_end /// Ends a widget group after calling nk_group_scrolled_offset_begin or nk_group_scrolled_begin. -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_group_scrolled_end(struct nk_context*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct NK_API void nk_group_scrolled_end(struct nk_context*); -/*/// #### nk_group_get_scroll + +/// # # nk_group_get_scroll /// Gets the scroll position of the given group. -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_group_get_scroll(struct nk_context*, const char *id, nk_uint *x_offset, nk_uint *y_offset); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// -------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __id__ | The id of the group to get the scroll position of -/// __x_offset__ | A pointer to the x offset output (or NULL to ignore) -/// __y_offset__ | A pointer to the y offset output (or NULL to ignore) -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __id__ | The id of the group to get the scroll position of +/// \param[in] __x_offset__ | A pointer to the x offset output (or NULL to ignore) +/// \param[in] __y_offset__ | A pointer to the y offset output (or NULL to ignore) NK_API void nk_group_get_scroll(struct nk_context*, const char *id, nk_uint *x_offset, nk_uint *y_offset); -/*/// #### nk_group_set_scroll + +/// # # nk_group_set_scroll /// Sets the scroll position of the given group. -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_group_set_scroll(struct nk_context*, const char *id, nk_uint x_offset, nk_uint y_offset); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// -------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __id__ | The id of the group to scroll -/// __x_offset__ | The x offset to scroll to -/// __y_offset__ | The y offset to scroll to -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __id__ | The id of the group to scroll +/// \param[in] __x_offset__ | The x offset to scroll to +/// \param[in] __y_offset__ | The y offset to scroll to NK_API void nk_group_set_scroll(struct nk_context*, const char *id, nk_uint x_offset, nk_uint y_offset); + /* ============================================================================= * * TREE * - * ============================================================================= -/// ### Tree + * =============================================================================*/ +/// \page +/// # Tree /// Trees represent two different concept. First the concept of a collapsible /// UI section that can be either in a hidden or visible state. They allow the UI /// user to selectively minimize the current set of visible UI to comprehend. @@ -2632,7 +2587,7 @@ NK_API void nk_group_set_scroll(struct nk_context*, const char *id, nk_uint x_of /// function `nk_tree_push_id` or completely provided from outside by user with /// function `nk_tree_push_hashed`. /// -/// #### Usage +/// # Usage /// To create a tree you have to call one of the seven `nk_tree_xxx_push_xxx` /// functions to start a collapsible UI section and `nk_tree_xxx_pop` to mark the /// end. @@ -2648,15 +2603,15 @@ NK_API void nk_group_set_scroll(struct nk_context*, const char *id, nk_uint x_of /// actually visible. So make sure the tree push function is guarded by `if` /// and the pop call is only taken if the tree is visible. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// if (nk_tree_push(ctx, NK_TREE_TAB, "Tree", NK_MINIMIZED)) { /// nk_layout_row_dynamic(...); /// nk_widget(...); /// nk_tree_pop(ctx); /// } -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// #### Reference +/// # Reference /// Function | Description /// ----------------------------|------------------------------------------- /// nk_tree_push | Start a collapsible UI section with internal state management @@ -2671,189 +2626,188 @@ NK_API void nk_group_set_scroll(struct nk_context*, const char *id, nk_uint x_of /// nk_tree_state_image_push | Start a collapsible UI section with image and label header and external state management /// nk_tree_state_pop | Ends a collapsabale UI section /// -/// #### nk_tree_type +/// # nk_tree_type /// Flag | Description /// ----------------|---------------------------------------- /// NK_TREE_NODE | Highlighted tree header to mark a collapsible UI section /// NK_TREE_TAB | Non-highlighted tree header closer to tree representations -*/ -/*/// #### nk_tree_push + +/// # # nk_tree_push /// Starts a collapsible UI section with internal state management -/// !!! WARNING +/// !!! \warning /// To keep track of the runtime tree collapsible state this function uses /// defines `__FILE__` and `__LINE__` to generate a unique ID. If you want /// to call this function in a loop please use `nk_tree_push_id` or /// `nk_tree_push_hashed` instead. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// #define nk_tree_push(ctx, type, title, state) -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node -/// __title__ | Label printed in the tree header -/// __state__ | Initial tree state value out of nk_collapse_states +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node +/// \param[in] __title__ | Label printed in the tree header +/// \param[in] __state__ | Initial tree state value out of nk_collapse_states /// -/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise -*/ +/// \returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise + #define nk_tree_push(ctx, type, title, state) nk_tree_push_hashed(ctx, type, title, state, NK_FILE_LINE,nk_strlen(NK_FILE_LINE),__LINE__) -/*/// #### nk_tree_push_id +/// # # nk_tree_push_id /// Starts a collapsible UI section with internal state management callable in a look -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// #define nk_tree_push_id(ctx, type, title, state, id) -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node -/// __title__ | Label printed in the tree header -/// __state__ | Initial tree state value out of nk_collapse_states -/// __id__ | Loop counter index if this function is called in a loop +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node +/// \param[in] __title__ | Label printed in the tree header +/// \param[in] __state__ | Initial tree state value out of nk_collapse_states +/// \param[in] __id__ | Loop counter index if this function is called in a loop /// -/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise -*/ +/// \returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise #define nk_tree_push_id(ctx, type, title, state, id) nk_tree_push_hashed(ctx, type, title, state, NK_FILE_LINE,nk_strlen(NK_FILE_LINE),id) -/*/// #### nk_tree_push_hashed + +/// # # nk_tree_push_hashed /// Start a collapsible UI section with internal state management with full /// control over internal unique ID used to store state -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// nk_bool nk_tree_push_hashed(struct nk_context*, enum nk_tree_type, const char *title, enum nk_collapse_states initial_state, const char *hash, int len,int seed); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node -/// __title__ | Label printed in the tree header -/// __state__ | Initial tree state value out of nk_collapse_states -/// __hash__ | Memory block or string to generate the ID from -/// __len__ | Size of passed memory block or string in __hash__ -/// __seed__ | Seeding value if this function is called in a loop or default to `0` +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node +/// \param[in] __title__ | Label printed in the tree header +/// \param[in] __state__ | Initial tree state value out of nk_collapse_states +/// \param[in] __hash__ | Memory block or string to generate the ID from +/// \param[in] __len__ | Size of passed memory block or string in __hash__ +/// \param[in] __seed__ | Seeding value if this function is called in a loop or default to `0` /// -/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise -*/ +/// \returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise NK_API nk_bool nk_tree_push_hashed(struct nk_context*, enum nk_tree_type, const char *title, enum nk_collapse_states initial_state, const char *hash, int len,int seed); -/*/// #### nk_tree_image_push + +/// # # nk_tree_image_push /// Start a collapsible UI section with image and label header -/// !!! WARNING +/// !!! \warning /// To keep track of the runtime tree collapsible state this function uses /// defines `__FILE__` and `__LINE__` to generate a unique ID. If you want /// to call this function in a loop please use `nk_tree_image_push_id` or /// `nk_tree_image_push_hashed` instead. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// #define nk_tree_image_push(ctx, type, img, title, state) -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` // /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node -/// __img__ | Image to display inside the header on the left of the label -/// __title__ | Label printed in the tree header -/// __state__ | Initial tree state value out of nk_collapse_states +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node +/// \param[in] __img__ | Image to display inside the header on the left of the label +/// \param[in] __title__ | Label printed in the tree header +/// \param[in] __state__ | Initial tree state value out of nk_collapse_states /// -/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise -*/ +/// \returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise #define nk_tree_image_push(ctx, type, img, title, state) nk_tree_image_push_hashed(ctx, type, img, title, state, NK_FILE_LINE,nk_strlen(NK_FILE_LINE),__LINE__) -/*/// #### nk_tree_image_push_id + +/// # # nk_tree_image_push_id /// Start a collapsible UI section with image and label header and internal state /// management callable in a look /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// #define nk_tree_image_push_id(ctx, type, img, title, state, id) -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node -/// __img__ | Image to display inside the header on the left of the label -/// __title__ | Label printed in the tree header -/// __state__ | Initial tree state value out of nk_collapse_states -/// __id__ | Loop counter index if this function is called in a loop +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node +/// \param[in] __img__ | Image to display inside the header on the left of the label +/// \param[in] __title__ | Label printed in the tree header +/// \param[in] __state__ | Initial tree state value out of nk_collapse_states +/// \param[in] __id__ | Loop counter index if this function is called in a loop /// -/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise -*/ +/// \returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise #define nk_tree_image_push_id(ctx, type, img, title, state, id) nk_tree_image_push_hashed(ctx, type, img, title, state, NK_FILE_LINE,nk_strlen(NK_FILE_LINE),id) -/*/// #### nk_tree_image_push_hashed + +/// # # nk_tree_image_push_hashed /// Start a collapsible UI section with internal state management with full /// control over internal unique ID used to store state -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// nk_bool nk_tree_image_push_hashed(struct nk_context*, enum nk_tree_type, struct nk_image, const char *title, enum nk_collapse_states initial_state, const char *hash, int len,int seed); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct -/// __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node -/// __img__ | Image to display inside the header on the left of the label -/// __title__ | Label printed in the tree header -/// __state__ | Initial tree state value out of nk_collapse_states -/// __hash__ | Memory block or string to generate the ID from -/// __len__ | Size of passed memory block or string in __hash__ -/// __seed__ | Seeding value if this function is called in a loop or default to `0` +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct +/// \param[in] __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node +/// \param[in] __img__ | Image to display inside the header on the left of the label +/// \param[in] __title__ | Label printed in the tree header +/// \param[in] __state__ | Initial tree state value out of nk_collapse_states +/// \param[in] __hash__ | Memory block or string to generate the ID from +/// \param[in] __len__ | Size of passed memory block or string in __hash__ +/// \param[in] __seed__ | Seeding value if this function is called in a loop or default to `0` /// -/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise -*/ +/// \returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise NK_API nk_bool nk_tree_image_push_hashed(struct nk_context*, enum nk_tree_type, struct nk_image, const char *title, enum nk_collapse_states initial_state, const char *hash, int len,int seed); -/*/// #### nk_tree_pop + +/// # # nk_tree_pop /// Ends a collapsabale UI section -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_tree_pop(struct nk_context*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after calling `nk_tree_xxx_push_xxx` -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after calling `nk_tree_xxx_push_xxx` NK_API void nk_tree_pop(struct nk_context*); -/*/// #### nk_tree_state_push + +/// # # nk_tree_state_push /// Start a collapsible UI section with external state management -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// nk_bool nk_tree_state_push(struct nk_context*, enum nk_tree_type, const char *title, enum nk_collapse_states *state); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after calling `nk_tree_xxx_push_xxx` -/// __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node -/// __title__ | Label printed in the tree header -/// __state__ | Persistent state to update +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after calling `nk_tree_xxx_push_xxx` +/// \param[in] __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node +/// \param[in] __title__ | Label printed in the tree header +/// \param[in] __state__ | Persistent state to update /// -/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise -*/ +/// \returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise NK_API nk_bool nk_tree_state_push(struct nk_context*, enum nk_tree_type, const char *title, enum nk_collapse_states *state); -/*/// #### nk_tree_state_image_push + +/// # # nk_tree_state_image_push /// Start a collapsible UI section with image and label header and external state management -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// nk_bool nk_tree_state_image_push(struct nk_context*, enum nk_tree_type, struct nk_image, const char *title, enum nk_collapse_states *state); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after calling `nk_tree_xxx_push_xxx` -/// __img__ | Image to display inside the header on the left of the label -/// __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node -/// __title__ | Label printed in the tree header -/// __state__ | Persistent state to update +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after calling `nk_tree_xxx_push_xxx` +/// \param[in] __img__ | Image to display inside the header on the left of the label +/// \param[in] __type__ | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node +/// \param[in] __title__ | Label printed in the tree header +/// \param[in] __state__ | Persistent state to update /// -/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise -*/ +/// \returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise NK_API nk_bool nk_tree_state_image_push(struct nk_context*, enum nk_tree_type, struct nk_image, const char *title, enum nk_collapse_states *state); -/*/// #### nk_tree_state_pop + +/// # # nk_tree_state_pop /// Ends a collapsabale UI section -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_tree_state_pop(struct nk_context*); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// ------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after calling `nk_tree_xxx_push_xxx` -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after calling `nk_tree_xxx_push_xxx` NK_API void nk_tree_state_pop(struct nk_context*); #define nk_tree_element_push(ctx, type, title, state, sel) nk_tree_element_push_hashed(ctx, type, title, state, sel, NK_FILE_LINE,nk_strlen(NK_FILE_LINE),__LINE__) @@ -2884,20 +2838,20 @@ NK_API void nk_list_view_end(struct nk_list_view*); * * ============================================================================= */ enum nk_widget_layout_states { - NK_WIDGET_INVALID, /* The widget cannot be seen and is completely out of view */ - NK_WIDGET_VALID, /* The widget is completely inside the window and can be updated and drawn */ - NK_WIDGET_ROM, /* The widget is partially visible and cannot be updated */ - NK_WIDGET_DISABLED /* The widget is manually disabled and acts like NK_WIDGET_ROM */ + NK_WIDGET_INVALID, /*!< The widget cannot be seen and is completely out of view */ + NK_WIDGET_VALID, /*!< The widget is completely inside the window and can be updated and drawn */ + NK_WIDGET_ROM, /*!< The widget is partially visible and cannot be updated */ + NK_WIDGET_DISABLED /*!< The widget is manually disabled and acts like NK_WIDGET_ROM */ }; enum nk_widget_states { NK_WIDGET_STATE_MODIFIED = NK_FLAG(1), - NK_WIDGET_STATE_INACTIVE = NK_FLAG(2), /* widget is neither active nor hovered */ - NK_WIDGET_STATE_ENTERED = NK_FLAG(3), /* widget has been hovered on the current frame */ - NK_WIDGET_STATE_HOVER = NK_FLAG(4), /* widget is being hovered */ - NK_WIDGET_STATE_ACTIVED = NK_FLAG(5),/* widget is currently activated */ - NK_WIDGET_STATE_LEFT = NK_FLAG(6), /* widget is from this frame on not hovered anymore */ - NK_WIDGET_STATE_HOVERED = NK_WIDGET_STATE_HOVER|NK_WIDGET_STATE_MODIFIED, /* widget is being hovered */ - NK_WIDGET_STATE_ACTIVE = NK_WIDGET_STATE_ACTIVED|NK_WIDGET_STATE_MODIFIED /* widget is currently activated */ + NK_WIDGET_STATE_INACTIVE = NK_FLAG(2), /*!< widget is neither active nor hovered */ + NK_WIDGET_STATE_ENTERED = NK_FLAG(3), /*!< widget has been hovered on the current frame */ + NK_WIDGET_STATE_HOVER = NK_FLAG(4), /*!< widget is being hovered */ + NK_WIDGET_STATE_ACTIVED = NK_FLAG(5),/*!< widget is currently activated */ + NK_WIDGET_STATE_LEFT = NK_FLAG(6), /*!< widget is from this frame on not hovered anymore */ + NK_WIDGET_STATE_HOVERED = NK_WIDGET_STATE_HOVER|NK_WIDGET_STATE_MODIFIED, /*!< widget is being hovered */ + NK_WIDGET_STATE_ACTIVE = NK_WIDGET_STATE_ACTIVED|NK_WIDGET_STATE_MODIFIED /*!< widget is currently activated */ }; NK_API enum nk_widget_layout_states nk_widget(struct nk_rect*, const struct nk_context*); NK_API enum nk_widget_layout_states nk_widget_fitting(struct nk_rect*, struct nk_context*, struct nk_vec2); @@ -3067,13 +3021,14 @@ NK_API nk_bool nk_color_pick(struct nk_context*, struct nk_colorf*, enum nk_colo * * PROPERTIES * - * ============================================================================= -/// ### Properties + * =============================================================================*/ +/// \page +/// # Properties /// Properties are the main value modification widgets in Nuklear. Changing a value /// can be achieved by dragging, adding/removing incremental steps on button click /// or by directly typing a number. /// -/// #### Usage +/// # Usage /// Each property requires a unique name for identification that is also used for /// displaying a label. If you want to use the same name multiple times make sure /// add a '#' before your name. The '#' will not be shown but will generate a @@ -3085,7 +3040,7 @@ NK_API nk_bool nk_color_pick(struct nk_context*, struct nk_colorf*, enum nk_colo /// decrement button is clicked. Finally there is a value for increment per pixel /// dragged that is added or subtracted from the value. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// int value = 0; /// struct nk_context ctx; /// nk_init_xxx(&ctx, ...); @@ -3126,151 +3081,145 @@ NK_API nk_bool nk_color_pick(struct nk_context*, struct nk_colorf*, enum nk_colo /// nk_clear(&ctx); /// } /// nk_free(&ctx); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// #### Reference +/// # Reference /// Function | Description /// --------------------|------------------------------------------- -/// nk_property_int | Integer property directly modifying a passed in value -/// nk_property_float | Float property directly modifying a passed in value -/// nk_property_double | Double property directly modifying a passed in value -/// nk_propertyi | Integer property returning the modified int value -/// nk_propertyf | Float property returning the modified float value -/// nk_propertyd | Double property returning the modified double value +/// \ref nk_property_int | Integer property directly modifying a passed in value +/// \ref nk_property_float | Float property directly modifying a passed in value +/// \ref nk_property_double | Double property directly modifying a passed in value +/// \ref nk_propertyi | Integer property returning the modified int value +/// \ref nk_propertyf | Float property returning the modified float value +/// \ref nk_propertyd | Double property returning the modified double value /// -*/ -/*/// #### nk_property_int + +/// # # nk_property_int /// Integer property directly modifying a passed in value -/// !!! WARNING +/// !!! \warning /// To generate a unique property ID using the same label make sure to insert /// a `#` at the beginning. It will not be shown but guarantees correct behavior. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_property_int(struct nk_context *ctx, const char *name, int min, int *val, int max, int step, float inc_per_pixel); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// --------------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after calling a layouting function -/// __name__ | String used both as a label as well as a unique identifier -/// __min__ | Minimum value not allowed to be underflown -/// __val__ | Integer pointer to be modified -/// __max__ | Maximum value not allowed to be overflown -/// __step__ | Increment added and subtracted on increment and decrement button -/// __inc_per_pixel__ | Value per pixel added or subtracted on dragging -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after calling a layouting function +/// \param[in] __name__ | String used both as a label as well as a unique identifier +/// \param[in] __min__ | Minimum value not allowed to be underflown +/// \param[in] __val__ | Integer pointer to be modified +/// \param[in] __max__ | Maximum value not allowed to be overflown +/// \param[in] __step__ | Increment added and subtracted on increment and decrement button +/// \param[in] __inc_per_pixel__ | Value per pixel added or subtracted on dragging NK_API void nk_property_int(struct nk_context*, const char *name, int min, int *val, int max, int step, float inc_per_pixel); -/*/// #### nk_property_float + +/// # # nk_property_float /// Float property directly modifying a passed in value -/// !!! WARNING +/// !!! \warning /// To generate a unique property ID using the same label make sure to insert /// a `#` at the beginning. It will not be shown but guarantees correct behavior. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_property_float(struct nk_context *ctx, const char *name, float min, float *val, float max, float step, float inc_per_pixel); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// --------------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after calling a layouting function -/// __name__ | String used both as a label as well as a unique identifier -/// __min__ | Minimum value not allowed to be underflown -/// __val__ | Float pointer to be modified -/// __max__ | Maximum value not allowed to be overflown -/// __step__ | Increment added and subtracted on increment and decrement button -/// __inc_per_pixel__ | Value per pixel added or subtracted on dragging -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after calling a layouting function +/// \param[in] __name__ | String used both as a label as well as a unique identifier +/// \param[in] __min__ | Minimum value not allowed to be underflown +/// \param[in] __val__ | Float pointer to be modified +/// \param[in] __max__ | Maximum value not allowed to be overflown +/// \param[in] __step__ | Increment added and subtracted on increment and decrement button +/// \param[in] __inc_per_pixel__ | Value per pixel added or subtracted on dragging NK_API void nk_property_float(struct nk_context*, const char *name, float min, float *val, float max, float step, float inc_per_pixel); -/*/// #### nk_property_double + +/// # # nk_property_double /// Double property directly modifying a passed in value -/// !!! WARNING +/// !!! \warning /// To generate a unique property ID using the same label make sure to insert /// a `#` at the beginning. It will not be shown but guarantees correct behavior. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// void nk_property_double(struct nk_context *ctx, const char *name, double min, double *val, double max, double step, double inc_per_pixel); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// /// Parameter | Description /// --------------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after calling a layouting function -/// __name__ | String used both as a label as well as a unique identifier -/// __min__ | Minimum value not allowed to be underflown -/// __val__ | Double pointer to be modified -/// __max__ | Maximum value not allowed to be overflown -/// __step__ | Increment added and subtracted on increment and decrement button -/// __inc_per_pixel__ | Value per pixel added or subtracted on dragging -*/ +/// \param[in] __ctx__ | Must point to an previously initialized `nk_context` struct after calling a layouting function +/// \param[in] __name__ | String used both as a label as well as a unique identifier +/// \param[in] __min__ | Minimum value not allowed to be underflown +/// \param[in] __val__ | Double pointer to be modified +/// \param[in] __max__ | Maximum value not allowed to be overflown +/// \param[in] __step__ | Increment added and subtracted on increment and decrement button +/// \param[in] __inc_per_pixel__ | Value per pixel added or subtracted on dragging NK_API void nk_property_double(struct nk_context*, const char *name, double min, double *val, double max, double step, float inc_per_pixel); -/*/// #### nk_propertyi + +/// # # nk_propertyi /// Integer property modifying a passed in value and returning the new value -/// !!! WARNING +/// !!! \warning /// To generate a unique property ID using the same label make sure to insert /// a `#` at the beginning. It will not be shown but guarantees correct behavior. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// int nk_propertyi(struct nk_context *ctx, const char *name, int min, int val, int max, int step, float inc_per_pixel); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// --------------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after calling a layouting function -/// __name__ | String used both as a label as well as a unique identifier -/// __min__ | Minimum value not allowed to be underflown -/// __val__ | Current integer value to be modified and returned -/// __max__ | Maximum value not allowed to be overflown -/// __step__ | Increment added and subtracted on increment and decrement button -/// __inc_per_pixel__ | Value per pixel added or subtracted on dragging +/// \param[in] __ctx__ Must point to an previously initialized `nk_context` struct after calling a layouting function +/// \param[in] __name__ String used both as a label as well as a unique identifier +/// \param[in] __min__ Minimum value not allowed to be underflown +/// \param[in] __val__ Current integer value to be modified and returned +/// \param[in] __max__ Maximum value not allowed to be overflown +/// \param[in] __step__ Increment added and subtracted on increment and decrement button +/// \param[in] __inc_per_pixel__ Value per pixel added or subtracted on dragging /// -/// Returns the new modified integer value -*/ +/// \returns the new modified integer value NK_API int nk_propertyi(struct nk_context*, const char *name, int min, int val, int max, int step, float inc_per_pixel); -/*/// #### nk_propertyf + +/// # # nk_propertyf /// Float property modifying a passed in value and returning the new value -/// !!! WARNING +/// !!! \warning /// To generate a unique property ID using the same label make sure to insert /// a `#` at the beginning. It will not be shown but guarantees correct behavior. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// float nk_propertyf(struct nk_context *ctx, const char *name, float min, float val, float max, float step, float inc_per_pixel); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// --------------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after calling a layouting function -/// __name__ | String used both as a label as well as a unique identifier -/// __min__ | Minimum value not allowed to be underflown -/// __val__ | Current float value to be modified and returned -/// __max__ | Maximum value not allowed to be overflown -/// __step__ | Increment added and subtracted on increment and decrement button -/// __inc_per_pixel__ | Value per pixel added or subtracted on dragging +/// \param[in] __ctx__ Must point to an previously initialized `nk_context` struct after calling a layouting function +/// \param[in] __name__ String used both as a label as well as a unique identifier +/// \param[in] __min__ Minimum value not allowed to be underflown +/// \param[in] __val__ Current float value to be modified and returned +/// \param[in] __max__ Maximum value not allowed to be overflown +/// \param[in] __step__ Increment added and subtracted on increment and decrement button +/// \param[in] __inc_per_pixel__ Value per pixel added or subtracted on dragging /// -/// Returns the new modified float value -*/ +/// \returns the new modified float value NK_API float nk_propertyf(struct nk_context*, const char *name, float min, float val, float max, float step, float inc_per_pixel); -/*/// #### nk_propertyd + +/// # # nk_propertyd /// Float property modifying a passed in value and returning the new value -/// !!! WARNING +/// !!! \warning /// To generate a unique property ID using the same label make sure to insert /// a `#` at the beginning. It will not be shown but guarantees correct behavior. /// -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// ```c /// float nk_propertyd(struct nk_context *ctx, const char *name, double min, double val, double max, double step, double inc_per_pixel); -/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// ``` /// -/// Parameter | Description -/// --------------------|----------------------------------------------------------- -/// __ctx__ | Must point to an previously initialized `nk_context` struct after calling a layouting function -/// __name__ | String used both as a label as well as a unique identifier -/// __min__ | Minimum value not allowed to be underflown -/// __val__ | Current double value to be modified and returned -/// __max__ | Maximum value not allowed to be overflown -/// __step__ | Increment added and subtracted on increment and decrement button -/// __inc_per_pixel__ | Value per pixel added or subtracted on dragging +/// \param[in] __ctx__ Must point to an previously initialized `nk_context` struct after calling a layouting function +/// \param[in] __name__ String used both as a label as well as a unique identifier +/// \param[in] __min__ Minimum value not allowed to be underflown +/// \param[in] __val__ Current double value to be modified and returned +/// \param[in] __max__ Maximum value not allowed to be overflown +/// \param[in] __step__ Increment added and subtracted on increment and decrement button +/// \param[in] __inc_per_pixel__ Value per pixel added or subtracted on dragging /// -/// Returns the new modified double value -*/ +/// \returns the new modified double value NK_API double nk_propertyd(struct nk_context*, const char *name, double min, double val, double max, double step, float inc_per_pixel); + /* ============================================================================= * * TEXT EDIT @@ -3298,11 +3247,11 @@ enum nk_edit_types { NK_EDIT_EDITOR = NK_EDIT_SELECTABLE|NK_EDIT_MULTILINE|NK_EDIT_ALLOW_TAB| NK_EDIT_CLIPBOARD }; enum nk_edit_events { - NK_EDIT_ACTIVE = NK_FLAG(0), /* edit widget is currently being modified */ - NK_EDIT_INACTIVE = NK_FLAG(1), /* edit widget is not active and is not being modified */ - NK_EDIT_ACTIVATED = NK_FLAG(2), /* edit widget went from state inactive to state active */ - NK_EDIT_DEACTIVATED = NK_FLAG(3), /* edit widget went from state active to state inactive */ - NK_EDIT_COMMITED = NK_FLAG(4) /* edit widget has received an enter and lost focus */ + NK_EDIT_ACTIVE = NK_FLAG(0), /*!< edit widget is currently being modified */ + NK_EDIT_INACTIVE = NK_FLAG(1), /*!< edit widget is not active and is not being modified */ + NK_EDIT_ACTIVATED = NK_FLAG(2), /*!< edit widget went from state inactive to state active */ + NK_EDIT_DEACTIVATED = NK_FLAG(3), /*!< edit widget went from state active to state inactive */ + NK_EDIT_COMMITED = NK_FLAG(4) /*!< edit widget has received an enter and lost focus */ }; NK_API nk_flags nk_edit_string(struct nk_context*, nk_flags, char *buffer, int *len, int max, nk_plugin_filter); NK_API nk_flags nk_edit_string_zero_terminated(struct nk_context*, nk_flags, char *buffer, int max, nk_plugin_filter); @@ -3635,7 +3584,8 @@ NK_API const char* nk_utf_at(const char *buffer, int length, int index, nk_rune * FONT * * ===============================================================*/ -/*/// ### Font +/// \page +/// # # Font /// Font handling in this library was designed to be quite customizable and lets /// you decide what you want to use and what you want to provide. There are three /// different ways to use the font atlas. The first two will use your font @@ -3643,7 +3593,7 @@ NK_API const char* nk_utf_at(const char *buffer, int length, int index, nk_rune /// slightly more advanced features is font handling with vertex buffer output. /// Finally the most complex API wise is using nuklear's font baking API. // -/// #### Using your own implementation without vertex buffer output +/// # Using your own implementation without vertex buffer output /// /// So first up the easiest way to do font handling is by just providing a /// `nk_user_font` struct which only requires the height in pixel of the used @@ -3671,7 +3621,7 @@ NK_API const char* nk_utf_at(const char *buffer, int length, int index, nk_rune /// struct nk_context ctx; /// nk_init_default(&ctx, &font); /// ``` -/// #### Using your own implementation with vertex buffer output +/// # Using your own implementation with vertex buffer output /// /// While the first approach works fine if you don't want to use the optional /// vertex buffer output it is not enough if you do. To get font handling working @@ -3713,7 +3663,7 @@ NK_API const char* nk_utf_at(const char *buffer, int length, int index, nk_rune /// nk_init_default(&ctx, &font); /// ``` /// -/// #### Nuklear font baker +/// # Nuklear font baker /// /// The final approach if you do not have a font handling functionality or don't /// want to use it in this library is by using the optional font baker. @@ -3784,7 +3734,7 @@ NK_API const char* nk_utf_at(const char *buffer, int length, int index, nk_rune /// cfg.coord_type = NK_COORD_PIXEL; /// nk_font *font = nk_font_atlas_add_from_file(&atlas, "Path/To/Your/TTF_Font.ttf", 13, &cfg); /// ``` -*/ + struct nk_user_font_glyph; typedef float(*nk_text_width_f)(nk_handle, float h, const char*, int len); typedef void(*nk_query_font_glyph_f)(nk_handle handle, float font_height, @@ -3793,84 +3743,56 @@ typedef void(*nk_query_font_glyph_f)(nk_handle handle, float font_height, #if defined(NK_INCLUDE_VERTEX_BUFFER_OUTPUT) || defined(NK_INCLUDE_SOFTWARE_FONT) struct nk_user_font_glyph { - struct nk_vec2 uv[2]; - /* texture coordinates */ - struct nk_vec2 offset; - /* offset between top left and glyph */ - float width, height; - /* size of the glyph */ - float xadvance; - /* offset to the next glyph */ + struct nk_vec2 uv[2]; /*!< texture coordinates */ + struct nk_vec2 offset; /*!< offset between top left and glyph */ + float width, height; /*!< size of the glyph */ + float xadvance; /*!< offset to the next glyph */ }; #endif struct nk_user_font { - nk_handle userdata; - /* user provided font handle */ - float height; - /* max height of the font */ - nk_text_width_f width; - /* font string width in pixel callback */ + nk_handle userdata; /*!< user provided font handle */ + float height; /*!< max height of the font */ + nk_text_width_f width; /*!< font string width in pixel callback */ #ifdef NK_INCLUDE_VERTEX_BUFFER_OUTPUT - nk_query_font_glyph_f query; - /* font glyph callback to query drawing info */ - nk_handle texture; - /* texture handle to the used font atlas or texture */ + nk_query_font_glyph_f query; /*!< font glyph callback to query drawing info */ + nk_handle texture; /*!< texture handle to the used font atlas or texture */ #endif }; #ifdef NK_INCLUDE_FONT_BAKING enum nk_font_coord_type { - NK_COORD_UV, /* texture coordinates inside font glyphs are clamped between 0-1 */ - NK_COORD_PIXEL /* texture coordinates inside font glyphs are in absolute pixel */ + NK_COORD_UV, /*!< texture coordinates inside font glyphs are clamped between 0-1 */ + NK_COORD_PIXEL /*!< texture coordinates inside font glyphs are in absolute pixel */ }; struct nk_font; struct nk_baked_font { - float height; - /* height of the font */ - float ascent, descent; - /* font glyphs ascent and descent */ - nk_rune glyph_offset; - /* glyph array offset inside the font glyph baking output array */ - nk_rune glyph_count; - /* number of glyphs of this font inside the glyph baking array output */ - const nk_rune *ranges; - /* font codepoint ranges as pairs of (from/to) and 0 as last element */ + float height; /*!< height of the font */ + float ascent; /*!< font glyphs ascent and descent */ + float descent; /*!< font glyphs ascent and descent */ + nk_rune glyph_offset; /*!< glyph array offset inside the font glyph baking output array */ + nk_rune glyph_count; /*!< number of glyphs of this font inside the glyph baking array output */ + const nk_rune *ranges; /*!< font codepoint ranges as pairs of (from/to) and 0 as last element */ }; struct nk_font_config { - struct nk_font_config *next; - /* NOTE: only used internally */ - void *ttf_blob; - /* pointer to loaded TTF file memory block. - * NOTE: not needed for nk_font_atlas_add_from_memory and nk_font_atlas_add_from_file. */ - nk_size ttf_size; - /* size of the loaded TTF file memory block - * NOTE: not needed for nk_font_atlas_add_from_memory and nk_font_atlas_add_from_file. */ + struct nk_font_config *next; /*!< NOTE: only used internally */ + void *ttf_blob; /*!< pointer to loaded TTF file memory block. * \note not needed for nk_font_atlas_add_from_memory and nk_font_atlas_add_from_file. */ + nk_size ttf_size; /*!< size of the loaded TTF file memory block * \note not needed for nk_font_atlas_add_from_memory and nk_font_atlas_add_from_file. */ - unsigned char ttf_data_owned_by_atlas; - /* used inside font atlas: default to: 0*/ - unsigned char merge_mode; - /* merges this font into the last font */ - unsigned char pixel_snap; - /* align every character to pixel boundary (if true set oversample (1,1)) */ - unsigned char oversample_v, oversample_h; - /* rasterize at high quality for sub-pixel position */ + unsigned char ttf_data_owned_by_atlas; /*!< used inside font atlas: default to: 0*/ + unsigned char merge_mode; /*!< merges this font into the last font */ + unsigned char pixel_snap; /*!< align every character to pixel boundary (if true set oversample (1,1)) */ + unsigned char oversample_v, oversample_h; /*!< rasterize at high quality for sub-pixel position */ unsigned char padding[3]; - float size; - /* baked pixel height of the font */ - enum nk_font_coord_type coord_type; - /* texture coordinate format with either pixel or UV coordinates */ - struct nk_vec2 spacing; - /* extra pixel spacing between glyphs */ - const nk_rune *range; - /* list of unicode ranges (2 values per range, zero terminated) */ - struct nk_baked_font *font; - /* font to setup in the baking process: NOTE: not needed for font atlas */ - nk_rune fallback_glyph; - /* fallback glyph to use if a given rune is not found */ + float size; /*!< baked pixel height of the font */ + enum nk_font_coord_type coord_type; /*!< texture coordinate format with either pixel or UV coordinates */ + struct nk_vec2 spacing; /*!< extra pixel spacing between glyphs */ + const nk_rune *range; /*!< list of unicode ranges (2 values per range, zero terminated) */ + struct nk_baked_font *font; /*!< font to setup in the baking process: NOTE: not needed for font atlas */ + nk_rune fallback_glyph; /*!< fallback glyph to use if a given rune is not found */ struct nk_font_config *n; struct nk_font_config *p; }; @@ -3954,7 +3876,8 @@ NK_API void nk_font_atlas_clear(struct nk_font_atlas*); * MEMORY BUFFER * * ===============================================================*/ -/*/// ### Memory Buffer +/// \page +/// # # Memory Buffer /// A basic (double)-buffer with linear allocation and resetting as only /// freeing policy. The buffer's main purpose is to control all memory management /// inside the GUI toolkit and still leave memory control as much as possible in @@ -3982,7 +3905,7 @@ NK_API void nk_font_atlas_clear(struct nk_font_atlas*); /// NK_INCLUDE_DEFAULT_ALLOCATOR which uses the standard library memory /// allocation functions malloc and free and takes over complete control over /// memory in this library. -*/ + struct nk_memory_status { void *memory; unsigned int type; @@ -4010,24 +3933,15 @@ struct nk_buffer_marker { struct nk_memory {void *ptr;nk_size size;}; struct nk_buffer { - struct nk_buffer_marker marker[NK_BUFFER_MAX]; - /* buffer marker to free a buffer to a certain offset */ - struct nk_allocator pool; - /* allocator callback for dynamic buffers */ - enum nk_allocation_type type; - /* memory management type */ - struct nk_memory memory; - /* memory and size of the current memory block */ - float grow_factor; - /* growing factor for dynamic memory management */ - nk_size allocated; - /* total amount of memory allocated */ - nk_size needed; - /* totally consumed memory given that enough memory is present */ - nk_size calls; - /* number of allocation calls */ - nk_size size; - /* current size of the buffer */ + struct nk_buffer_marker marker[NK_BUFFER_MAX]; /*!< buffer marker to free a buffer to a certain offset */ + struct nk_allocator pool; /*!< allocator callback for dynamic buffers */ + enum nk_allocation_type type; /*!< memory management type */ + struct nk_memory memory; /*!< memory and size of the current memory block */ + float grow_factor; /*!< growing factor for dynamic memory management */ + nk_size allocated; /*!< total amount of memory allocated */ + nk_size needed; /*!< totally consumed memory given that enough memory is present */ + nk_size calls; /*!< number of allocation calls */ + nk_size size; /*!< current size of the buffer */ }; #ifdef NK_INCLUDE_DEFAULT_ALLOCATOR @@ -4057,7 +3971,7 @@ NK_API nk_size nk_buffer_total(struct nk_buffer*); * copy and paste functions and even there only for more advanced cases. */ struct nk_str { struct nk_buffer buffer; - int len; /* in codepoints/runes/glyphs */ + int len; /*!< in codepoints/runes/glyphs */ }; #ifdef NK_INCLUDE_DEFAULT_ALLOCATOR @@ -4106,7 +4020,8 @@ NK_API int nk_str_len_char(struct nk_str*); * TEXT EDITOR * * ===============================================================*/ -/*/// ### Text Editor +/// \page +/// # # Text Editor /// Editing text in this library is handled by either `nk_edit_string` or /// `nk_edit_buffer`. But like almost everything in this library there are multiple /// ways of doing it and a balance between control and ease of use with memory @@ -4129,7 +4044,7 @@ NK_API int nk_str_len_char(struct nk_str*); /// complexity I would not recommend editing gigabytes of data with it. /// It is rather designed for uses cases which make sense for a GUI library not for /// an full blown text editor. - */ + #ifndef NK_TEXTEDIT_UNDOSTATECOUNT #define NK_TEXTEDIT_UNDOSTATECOUNT 99 #endif @@ -4222,7 +4137,8 @@ NK_API void nk_textedit_redo(struct nk_text_edit*); * DRAWING * * ===============================================================*/ -/*/// ### Drawing +/// \page +/// # Drawing /// This library was designed to be render backend agnostic so it does /// not draw anything to screen. Instead all drawn shapes, widgets /// are made of, are buffered into memory and make up a command queue. @@ -4268,7 +4184,7 @@ NK_API void nk_textedit_redo(struct nk_text_edit*); /// to be drawn the state will be `NK_WIDGET_ROM` otherwise you can do both /// update and draw your widget. The reason for separating is to only draw and /// update what is actually necessary which is crucial for performance. -*/ + enum nk_command_type { NK_COMMAND_NOP, NK_COMMAND_SCISSOR, @@ -4291,7 +4207,7 @@ enum nk_command_type { NK_COMMAND_CUSTOM }; -/* command base and header of every command inside the buffer */ +/// command base and header of every command inside the buffer struct nk_command { enum nk_command_type type; nk_size next; @@ -4552,7 +4468,7 @@ NK_API nk_bool nk_input_is_key_down(const struct nk_input*, enum nk_keys); * * ===============================================================*/ #ifdef NK_INCLUDE_VERTEX_BUFFER_OUTPUT -/* ### Draw List +/// # Draw List /// The optional vertex buffer draw list provides a 2D drawing context /// with antialiasing functionality which takes basic filled or outlined shapes /// or a path and outputs vertexes, elements and draw commands. @@ -4565,17 +4481,15 @@ NK_API nk_bool nk_input_is_key_down(const struct nk_input*, enum nk_keys); /// rendering API which allows a lot of ways to draw 2D content to screen. /// In fact it is probably more powerful than needed but allows even more crazy /// things than this library provides by default. -*/ + #ifdef NK_UINT_DRAW_INDEX typedef nk_uint nk_draw_index; #else typedef nk_ushort nk_draw_index; #endif enum nk_draw_list_stroke { - NK_STROKE_OPEN = nk_false, - /* build up path has no connection back to the beginning */ - NK_STROKE_CLOSED = nk_true - /* build up path has a connection back to the beginning */ + NK_STROKE_OPEN = nk_false, /**< build up path has no connection back to the beginning */ + NK_STROKE_CLOSED = nk_true /**< build up path has a connection back to the beginning */ }; enum nk_draw_vertex_layout_attribute { @@ -5404,7 +5318,7 @@ struct nk_window { /*============================================================== * STACK * =============================================================*/ -/*/// ### Stack +/// # Stack /// The style modifier stack can be used to temporarily change a /// property inside `nk_style`. For example if you want a special /// red button you can temporarily push the old button color onto a stack @@ -5426,7 +5340,7 @@ struct nk_window { /// Nuklear has a stack for style_items, float properties, vector properties, /// flags, colors, fonts and for button_behavior. Each has it's own fixed size stack /// which can be changed at compile time. - */ + #ifndef NK_BUTTON_BEHAVIOR_STACK_SIZE #define NK_BUTTON_BEHAVIOR_STACK_SIZE 8 #endif