Blame src-nuklear/nuklear.h

Ivan Mahonin b53a5c
#ifndef NK_NUKLEAR_H_
Ivan Mahonin b53a5c
#define NK_NUKLEAR_H_
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifdef __cplusplus
Ivan Mahonin b53a5c
extern "C" {
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
/*
Ivan Mahonin b53a5c
 * ==============================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                          CONSTANTS
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ===============================================================
Ivan Mahonin b53a5c
 */
Ivan Mahonin b53a5c
#define NK_UNDEFINED (-1.0f)
Ivan Mahonin b53a5c
#define NK_UTF_INVALID 0xFFFD /* internal invalid utf8 rune */
Ivan Mahonin b53a5c
#define NK_UTF_SIZE 4 /* describes the number of bytes a glyph consists of*/
Ivan Mahonin b53a5c
#ifndef NK_INPUT_MAX
Ivan Mahonin b53a5c
  #define NK_INPUT_MAX 16
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
#ifndef NK_MAX_NUMBER_BUFFER
Ivan Mahonin b53a5c
  #define NK_MAX_NUMBER_BUFFER 64
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
#ifndef NK_SCROLLBAR_HIDING_TIMEOUT
Ivan Mahonin b53a5c
  #define NK_SCROLLBAR_HIDING_TIMEOUT 4.0f
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
/*
Ivan Mahonin b53a5c
 * ==============================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                          HELPER
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ===============================================================
Ivan Mahonin b53a5c
 */
Ivan Mahonin b53a5c
#ifndef NK_API
Ivan Mahonin b53a5c
  #ifdef NK_PRIVATE
Ivan Mahonin b53a5c
    #if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199409L))
Ivan Mahonin b53a5c
      #define NK_API static inline
Ivan Mahonin b53a5c
    #elif defined(__cplusplus)
Ivan Mahonin b53a5c
      #define NK_API static inline
Ivan Mahonin b53a5c
    #else
Ivan Mahonin b53a5c
      #define NK_API static
Ivan Mahonin b53a5c
    #endif
Ivan Mahonin b53a5c
  #else
Ivan Mahonin b53a5c
    #define NK_API extern
Ivan Mahonin b53a5c
  #endif
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
#ifndef NK_LIB
Ivan Mahonin b53a5c
  #ifdef NK_SINGLE_FILE
Ivan Mahonin b53a5c
    #define NK_LIB static
Ivan Mahonin b53a5c
  #else
Ivan Mahonin b53a5c
    #define NK_LIB extern
Ivan Mahonin b53a5c
  #endif
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#define NK_INTERN static
Ivan Mahonin b53a5c
#define NK_STORAGE static
Ivan Mahonin b53a5c
#define NK_GLOBAL static
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#define NK_FLAG(x) (1 << (x))
Ivan Mahonin b53a5c
#define NK_STRINGIFY(x) #x
Ivan Mahonin b53a5c
#define NK_MACRO_STRINGIFY(x) NK_STRINGIFY(x)
Ivan Mahonin b53a5c
#define NK_STRING_JOIN_IMMEDIATE(arg1, arg2) arg1 ## arg2
Ivan Mahonin b53a5c
#define NK_STRING_JOIN_DELAY(arg1, arg2) NK_STRING_JOIN_IMMEDIATE(arg1, arg2)
Ivan Mahonin b53a5c
#define NK_STRING_JOIN(arg1, arg2) NK_STRING_JOIN_DELAY(arg1, arg2)
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifdef _MSC_VER
Ivan Mahonin b53a5c
  #define NK_UNIQUE_NAME(name) NK_STRING_JOIN(name,__COUNTER__)
Ivan Mahonin b53a5c
#else
Ivan Mahonin b53a5c
  #define NK_UNIQUE_NAME(name) NK_STRING_JOIN(name,__LINE__)
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifndef NK_STATIC_ASSERT
Ivan Mahonin b53a5c
  #define NK_STATIC_ASSERT(exp) typedef char NK_UNIQUE_NAME(_dummy_array)[(exp)?1:-1]
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifndef NK_FILE_LINE
Ivan Mahonin b53a5c
#ifdef _MSC_VER
Ivan Mahonin b53a5c
  #define NK_FILE_LINE __FILE__ ":" NK_MACRO_STRINGIFY(__COUNTER__)
Ivan Mahonin b53a5c
#else
Ivan Mahonin b53a5c
  #define NK_FILE_LINE __FILE__ ":" NK_MACRO_STRINGIFY(__LINE__)
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#define NK_MIN(a,b) ((a) < (b) ? (a) : (b))
Ivan Mahonin b53a5c
#define NK_MAX(a,b) ((a) < (b) ? (b) : (a))
Ivan Mahonin b53a5c
#define NK_CLAMP(i,v,x) (NK_MAX(NK_MIN(v,x), i))
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_STANDARD_VARARGS
Ivan Mahonin b53a5c
  #include <stdarg.h>
Ivan Mahonin b53a5c
  #if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */
Ivan Mahonin b53a5c
    #include <sal.h>
Ivan Mahonin b53a5c
    #define NK_PRINTF_FORMAT_STRING _Printf_format_string_
Ivan Mahonin b53a5c
  #else
Ivan Mahonin b53a5c
    #define NK_PRINTF_FORMAT_STRING
Ivan Mahonin b53a5c
  #endif
Ivan Mahonin b53a5c
  #if defined(__GNUC__)
Ivan Mahonin b53a5c
    #define NK_PRINTF_VARARG_FUNC(fmtargnumber) __attribute__((format(__printf__, fmtargnumber, fmtargnumber+1)))
Ivan Mahonin b53a5c
    #define NK_PRINTF_VALIST_FUNC(fmtargnumber) __attribute__((format(__printf__, fmtargnumber, 0)))
Ivan Mahonin b53a5c
  #else
Ivan Mahonin b53a5c
    #define NK_PRINTF_VARARG_FUNC(fmtargnumber)
Ivan Mahonin b53a5c
    #define NK_PRINTF_VALIST_FUNC(fmtargnumber)
Ivan Mahonin b53a5c
  #endif
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/*
Ivan Mahonin b53a5c
 * ===============================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                          BASIC
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ===============================================================
Ivan Mahonin b53a5c
 */
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_FIXED_TYPES
Ivan Mahonin b53a5c
 #include <stdint.h>
Ivan Mahonin b53a5c
 #define NK_INT8 int8_t
Ivan Mahonin b53a5c
 #define NK_UINT8 uint8_t
Ivan Mahonin b53a5c
 #define NK_INT16 int16_t
Ivan Mahonin b53a5c
 #define NK_UINT16 uint16_t
Ivan Mahonin b53a5c
 #define NK_INT32 int32_t
Ivan Mahonin b53a5c
 #define NK_UINT32 uint32_t
Ivan Mahonin b53a5c
 #define NK_SIZE_TYPE uintptr_t
Ivan Mahonin b53a5c
 #define NK_POINTER_TYPE uintptr_t
Ivan Mahonin b53a5c
#else
Ivan Mahonin b53a5c
  #ifndef NK_INT8
Ivan Mahonin b53a5c
    #define NK_INT8 signed char
Ivan Mahonin b53a5c
  #endif
Ivan Mahonin b53a5c
  #ifndef NK_UINT8
Ivan Mahonin b53a5c
    #define NK_UINT8 unsigned char
Ivan Mahonin b53a5c
  #endif
Ivan Mahonin b53a5c
  #ifndef NK_INT16
Ivan Mahonin b53a5c
    #define NK_INT16 signed short
Ivan Mahonin b53a5c
  #endif
Ivan Mahonin b53a5c
  #ifndef NK_UINT16
Ivan Mahonin b53a5c
    #define NK_UINT16 unsigned short
Ivan Mahonin b53a5c
  #endif
Ivan Mahonin b53a5c
  #ifndef NK_INT32
Ivan Mahonin b53a5c
    #if defined(_MSC_VER)
Ivan Mahonin b53a5c
      #define NK_INT32 __int32
Ivan Mahonin b53a5c
    #else
Ivan Mahonin b53a5c
      #define NK_INT32 signed int
Ivan Mahonin b53a5c
    #endif
Ivan Mahonin b53a5c
  #endif
Ivan Mahonin b53a5c
  #ifndef NK_UINT32
Ivan Mahonin b53a5c
    #if defined(_MSC_VER)
Ivan Mahonin b53a5c
      #define NK_UINT32 unsigned __int32
Ivan Mahonin b53a5c
    #else
Ivan Mahonin b53a5c
      #define NK_UINT32 unsigned int
Ivan Mahonin b53a5c
    #endif
Ivan Mahonin b53a5c
  #endif
Ivan Mahonin b53a5c
  #ifndef NK_SIZE_TYPE
Ivan Mahonin b53a5c
    #if defined(_WIN64) && defined(_MSC_VER)
Ivan Mahonin b53a5c
      #define NK_SIZE_TYPE unsigned __int64
Ivan Mahonin b53a5c
    #elif (defined(_WIN32) || defined(WIN32)) && defined(_MSC_VER)
Ivan Mahonin b53a5c
      #define NK_SIZE_TYPE unsigned __int32
Ivan Mahonin b53a5c
    #elif defined(__GNUC__) || defined(__clang__)
Ivan Mahonin b53a5c
      #if defined(__x86_64__) || defined(__ppc64__) || defined(__PPC64__) || defined(__aarch64__)
Ivan Mahonin b53a5c
        #define NK_SIZE_TYPE unsigned long
Ivan Mahonin b53a5c
      #else
Ivan Mahonin b53a5c
        #define NK_SIZE_TYPE unsigned int
Ivan Mahonin b53a5c
      #endif
Ivan Mahonin b53a5c
    #else
Ivan Mahonin b53a5c
      #define NK_SIZE_TYPE unsigned long
Ivan Mahonin b53a5c
    #endif
Ivan Mahonin b53a5c
  #endif
Ivan Mahonin b53a5c
  #ifndef NK_POINTER_TYPE
Ivan Mahonin b53a5c
    #if defined(_WIN64) && defined(_MSC_VER)
Ivan Mahonin b53a5c
      #define NK_POINTER_TYPE unsigned __int64
Ivan Mahonin b53a5c
    #elif (defined(_WIN32) || defined(WIN32)) && defined(_MSC_VER)
Ivan Mahonin b53a5c
      #define NK_POINTER_TYPE unsigned __int32
Ivan Mahonin b53a5c
    #elif defined(__GNUC__) || defined(__clang__)
Ivan Mahonin b53a5c
      #if defined(__x86_64__) || defined(__ppc64__) || defined(__PPC64__) || defined(__aarch64__)
Ivan Mahonin b53a5c
        #define NK_POINTER_TYPE unsigned long
Ivan Mahonin b53a5c
      #else
Ivan Mahonin b53a5c
        #define NK_POINTER_TYPE unsigned int
Ivan Mahonin b53a5c
      #endif
Ivan Mahonin b53a5c
    #else
Ivan Mahonin b53a5c
      #define NK_POINTER_TYPE unsigned long
Ivan Mahonin b53a5c
    #endif
Ivan Mahonin b53a5c
  #endif
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifndef NK_BOOL
Ivan Mahonin b53a5c
  #ifdef NK_INCLUDE_STANDARD_BOOL
Ivan Mahonin b53a5c
    #include <stdbool.h>
Ivan Mahonin b53a5c
    #define NK_BOOL bool
Ivan Mahonin b53a5c
  #else
Ivan Mahonin b53a5c
    #define NK_BOOL int /* could be char, use int for drop-in replacement backwards compatibility */
Ivan Mahonin b53a5c
  #endif
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
typedef NK_INT8 nk_char;
Ivan Mahonin b53a5c
typedef NK_UINT8 nk_uchar;
Ivan Mahonin b53a5c
typedef NK_UINT8 nk_byte;
Ivan Mahonin b53a5c
typedef NK_INT16 nk_short;
Ivan Mahonin b53a5c
typedef NK_UINT16 nk_ushort;
Ivan Mahonin b53a5c
typedef NK_INT32 nk_int;
Ivan Mahonin b53a5c
typedef NK_UINT32 nk_uint;
Ivan Mahonin b53a5c
typedef NK_SIZE_TYPE nk_size;
Ivan Mahonin b53a5c
typedef NK_POINTER_TYPE nk_ptr;
Ivan Mahonin b53a5c
typedef NK_BOOL nk_bool;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
typedef nk_uint nk_hash;
Ivan Mahonin b53a5c
typedef nk_uint nk_flags;
Ivan Mahonin b53a5c
typedef nk_uint nk_rune;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* Make sure correct type size:
Ivan Mahonin b53a5c
 * This will fire with a negative subscript error if the type sizes
Ivan Mahonin b53a5c
 * are set incorrectly by the compiler, and compile out if not */
Ivan Mahonin b53a5c
NK_STATIC_ASSERT(sizeof(nk_short) == 2);
Ivan Mahonin b53a5c
NK_STATIC_ASSERT(sizeof(nk_ushort) == 2);
Ivan Mahonin b53a5c
NK_STATIC_ASSERT(sizeof(nk_uint) == 4);
Ivan Mahonin b53a5c
NK_STATIC_ASSERT(sizeof(nk_int) == 4);
Ivan Mahonin b53a5c
NK_STATIC_ASSERT(sizeof(nk_byte) == 1);
Ivan Mahonin b53a5c
NK_STATIC_ASSERT(sizeof(nk_flags) >= 4);
Ivan Mahonin b53a5c
NK_STATIC_ASSERT(sizeof(nk_rune) >= 4);
Ivan Mahonin b53a5c
NK_STATIC_ASSERT(sizeof(nk_size) >= sizeof(void*));
Ivan Mahonin b53a5c
NK_STATIC_ASSERT(sizeof(nk_ptr) >= sizeof(void*));
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_STANDARD_BOOL
Ivan Mahonin b53a5c
NK_STATIC_ASSERT(sizeof(nk_bool) == sizeof(bool));
Ivan Mahonin b53a5c
#else
Ivan Mahonin b53a5c
NK_STATIC_ASSERT(sizeof(nk_bool) >= 2);
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* ============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  API
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * =========================================================================== */
Ivan Mahonin b53a5c
struct nk_buffer;
Ivan Mahonin b53a5c
struct nk_allocator;
Ivan Mahonin b53a5c
struct nk_command_buffer;
Ivan Mahonin b53a5c
struct nk_draw_command;
Ivan Mahonin b53a5c
struct nk_convert_config;
Ivan Mahonin b53a5c
struct nk_style_item;
Ivan Mahonin b53a5c
struct nk_text_edit;
Ivan Mahonin b53a5c
struct nk_draw_list;
Ivan Mahonin b53a5c
struct nk_user_font;
Ivan Mahonin b53a5c
struct nk_panel;
Ivan Mahonin b53a5c
struct nk_context;
Ivan Mahonin b53a5c
struct nk_draw_vertex_layout_element;
Ivan Mahonin b53a5c
struct nk_style_button;
Ivan Mahonin b53a5c
struct nk_style_toggle;
Ivan Mahonin b53a5c
struct nk_style_selectable;
Ivan Mahonin b53a5c
struct nk_style_slide;
Ivan Mahonin b53a5c
struct nk_style_progress;
Ivan Mahonin b53a5c
struct nk_style_scrollbar;
Ivan Mahonin b53a5c
struct nk_style_edit;
Ivan Mahonin b53a5c
struct nk_style_property;
Ivan Mahonin b53a5c
struct nk_style_chart;
Ivan Mahonin b53a5c
struct nk_style_combo;
Ivan Mahonin b53a5c
struct nk_style_tab;
Ivan Mahonin b53a5c
struct nk_style_window_header;
Ivan Mahonin b53a5c
struct nk_style_window;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
enum {nk_false, nk_true};
Ivan Mahonin b53a5c
struct nk_color {nk_byte r,g,b,a;};
Ivan Mahonin b53a5c
struct nk_colorf {float r,g,b,a;};
Ivan Mahonin b53a5c
struct nk_vec2 {float x,y;};
Ivan Mahonin b53a5c
struct nk_vec2i {short x, y;};
Ivan Mahonin b53a5c
struct nk_rect {float x,y,w,h;};
Ivan Mahonin b53a5c
struct nk_recti {short x,y,w,h;};
Ivan Mahonin b53a5c
typedef char nk_glyph[NK_UTF_SIZE];
Ivan Mahonin b53a5c
typedef union {void *ptr; int id;} nk_handle;
Ivan Mahonin b53a5c
struct nk_image {nk_handle handle; nk_ushort w, h; nk_ushort region[4];};
Ivan Mahonin b53a5c
struct nk_nine_slice {struct nk_image img; nk_ushort l, t, r, b;};
Ivan Mahonin b53a5c
struct nk_cursor {struct nk_image img; struct nk_vec2 size, offset;};
Ivan Mahonin b53a5c
struct nk_scroll {nk_uint x, y;};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
enum nk_heading         {NK_UP, NK_RIGHT, NK_DOWN, NK_LEFT};
Ivan Mahonin b53a5c
enum nk_button_behavior {NK_BUTTON_DEFAULT, NK_BUTTON_REPEATER};
Ivan Mahonin b53a5c
enum nk_modify          {NK_FIXED = nk_false, NK_MODIFIABLE = nk_true};
Ivan Mahonin b53a5c
enum nk_orientation     {NK_VERTICAL, NK_HORIZONTAL};
Ivan Mahonin b53a5c
enum nk_collapse_states {NK_MINIMIZED = nk_false, NK_MAXIMIZED = nk_true};
Ivan Mahonin b53a5c
enum nk_show_states     {NK_HIDDEN = nk_false, NK_SHOWN = nk_true};
Ivan Mahonin b53a5c
enum nk_chart_type      {NK_CHART_LINES, NK_CHART_COLUMN, NK_CHART_MAX};
Ivan Mahonin b53a5c
enum nk_chart_event     {NK_CHART_HOVERING = 0x01, NK_CHART_CLICKED = 0x02};
Ivan Mahonin b53a5c
enum nk_color_format    {NK_RGB, NK_RGBA};
Ivan Mahonin b53a5c
enum nk_popup_type      {NK_POPUP_STATIC, NK_POPUP_DYNAMIC};
Ivan Mahonin b53a5c
enum nk_layout_format   {NK_DYNAMIC, NK_STATIC};
Ivan Mahonin b53a5c
enum nk_tree_type       {NK_TREE_NODE, NK_TREE_TAB};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
typedef void*(*nk_plugin_alloc)(nk_handle, void *old, nk_size);
Ivan Mahonin b53a5c
typedef void (*nk_plugin_free)(nk_handle, void *old);
Ivan Mahonin b53a5c
typedef nk_bool(*nk_plugin_filter)(const struct nk_text_edit*, nk_rune unicode);
Ivan Mahonin b53a5c
typedef void(*nk_plugin_paste)(nk_handle, struct nk_text_edit*);
Ivan Mahonin b53a5c
typedef void(*nk_plugin_copy)(nk_handle, const char*, int len);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_allocator {
Ivan Mahonin b53a5c
    nk_handle userdata;
Ivan Mahonin b53a5c
    nk_plugin_alloc alloc;
Ivan Mahonin b53a5c
    nk_plugin_free free;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
enum nk_symbol_type {
Ivan Mahonin b53a5c
    NK_SYMBOL_NONE,
Ivan Mahonin b53a5c
    NK_SYMBOL_X,
Ivan Mahonin b53a5c
    NK_SYMBOL_UNDERSCORE,
Ivan Mahonin b53a5c
    NK_SYMBOL_CIRCLE_SOLID,
Ivan Mahonin b53a5c
    NK_SYMBOL_CIRCLE_OUTLINE,
Ivan Mahonin b53a5c
    NK_SYMBOL_RECT_SOLID,
Ivan Mahonin b53a5c
    NK_SYMBOL_RECT_OUTLINE,
Ivan Mahonin b53a5c
    NK_SYMBOL_TRIANGLE_UP,
Ivan Mahonin b53a5c
    NK_SYMBOL_TRIANGLE_DOWN,
Ivan Mahonin b53a5c
    NK_SYMBOL_TRIANGLE_LEFT,
Ivan Mahonin b53a5c
    NK_SYMBOL_TRIANGLE_RIGHT,
Ivan Mahonin b53a5c
    NK_SYMBOL_PLUS,
Ivan Mahonin b53a5c
    NK_SYMBOL_MINUS,
Ivan Mahonin b53a5c
    NK_SYMBOL_MAX
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  CONTEXT
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * =============================================================================*/
Ivan Mahonin b53a5c
/*/// ### Context
Ivan Mahonin b53a5c
/// Contexts are the main entry point and the majestro of nuklear and contain all required state.
Ivan Mahonin b53a5c
/// They are used for window, memory, input, style, stack, commands and time management and need
Ivan Mahonin b53a5c
/// to be passed into all nuklear GUI specific functions.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### Usage
Ivan Mahonin b53a5c
/// To use a context it first has to be initialized which can be achieved by calling
Ivan Mahonin b53a5c
/// one of either `nk_init_default`, `nk_init_fixed`, `nk_init`, `nk_init_custom`.
Ivan Mahonin b53a5c
/// Each takes in a font handle and a specific way of handling memory. Memory control
Ivan Mahonin b53a5c
/// hereby ranges from standard library to just specifying a fixed sized block of memory
Ivan Mahonin b53a5c
/// which nuklear has to manage itself from.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// struct nk_context ctx;
Ivan Mahonin b53a5c
/// nk_init_xxx(&ctx, ...);
Ivan Mahonin b53a5c
/// while (1) {
Ivan Mahonin b53a5c
///     // [...]
Ivan Mahonin b53a5c
///     nk_clear(&ctx);
Ivan Mahonin b53a5c
/// }
Ivan Mahonin b53a5c
/// nk_free(&ctx);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### Reference
Ivan Mahonin b53a5c
/// Function            | Description
Ivan Mahonin b53a5c
/// --------------------|-------------------------------------------------------
Ivan Mahonin b53a5c
/// __nk_init_default__ | Initializes context with standard library memory allocation (malloc,free)
Ivan Mahonin b53a5c
/// __nk_init_fixed__   | Initializes context from single fixed size memory block
Ivan Mahonin b53a5c
/// __nk_init__         | Initializes context with memory allocator callbacks for alloc and free
Ivan Mahonin b53a5c
/// __nk_init_custom__  | Initializes context from two buffers. One for draw commands the other for window/panel/table allocations
Ivan Mahonin b53a5c
/// __nk_clear__        | Called at the end of the frame to reset and prepare the context for the next frame
Ivan Mahonin b53a5c
/// __nk_free__         | Shutdown and free all memory allocated inside the context
Ivan Mahonin b53a5c
/// __nk_set_user_data__| Utility function to pass user data to draw command
Ivan Mahonin b53a5c
 */
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_DEFAULT_ALLOCATOR
Ivan Mahonin b53a5c
/*/// #### nk_init_default
Ivan Mahonin b53a5c
/// Initializes a `nk_context` struct with a default standard library allocator.
Ivan Mahonin b53a5c
/// Should be used if you don't want to be bothered with memory management in nuklear.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// nk_bool nk_init_default(struct nk_context *ctx, const struct nk_user_font *font);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|---------------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an either stack or heap allocated `nk_context` struct
Ivan Mahonin b53a5c
/// __font__    | Must point to a previously initialized font handle for more info look at font documentation
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns either `false(0)` on failure or `true(1)` on success.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API nk_bool nk_init_default(struct nk_context*, const struct nk_user_font*);
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
/*/// #### nk_init_fixed
Ivan Mahonin b53a5c
/// Initializes a `nk_context` struct from single fixed size memory block
Ivan Mahonin b53a5c
/// Should be used if you want complete control over nuklear's memory management.
Ivan Mahonin b53a5c
/// Especially recommended for system with little memory or systems with virtual memory.
Ivan Mahonin b53a5c
/// For the later case you can just allocate for example 16MB of virtual memory
Ivan Mahonin b53a5c
/// and only the required amount of memory will actually be committed.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// nk_bool nk_init_fixed(struct nk_context *ctx, void *memory, nk_size size, const struct nk_user_font *font);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// !!! Warning
Ivan Mahonin b53a5c
///     make sure the passed memory block is aligned correctly for `nk_draw_commands`.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|--------------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an either stack or heap allocated `nk_context` struct
Ivan Mahonin b53a5c
/// __memory__  | Must point to a previously allocated memory block
Ivan Mahonin b53a5c
/// __size__    | Must contain the total size of __memory__
Ivan Mahonin b53a5c
/// __font__    | Must point to a previously initialized font handle for more info look at font documentation
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns either `false(0)` on failure or `true(1)` on success.
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API nk_bool nk_init_fixed(struct nk_context*, void *memory, nk_size size, const struct nk_user_font*);
Ivan Mahonin b53a5c
/*/// #### nk_init
Ivan Mahonin b53a5c
/// Initializes a `nk_context` struct with memory allocation callbacks for nuklear to allocate
Ivan Mahonin b53a5c
/// memory from. Used internally for `nk_init_default` and provides a kitchen sink allocation
Ivan Mahonin b53a5c
/// interface to nuklear. Can be useful for cases like monitoring memory consumption.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// nk_bool nk_init(struct nk_context *ctx, struct nk_allocator *alloc, const struct nk_user_font *font);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|---------------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an either stack or heap allocated `nk_context` struct
Ivan Mahonin b53a5c
/// __alloc__   | Must point to a previously allocated memory allocator
Ivan Mahonin b53a5c
/// __font__    | Must point to a previously initialized font handle for more info look at font documentation
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns either `false(0)` on failure or `true(1)` on success.
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API nk_bool nk_init(struct nk_context*, struct nk_allocator*, const struct nk_user_font*);
Ivan Mahonin b53a5c
/*/// #### nk_init_custom
Ivan Mahonin b53a5c
/// Initializes a `nk_context` struct from two different either fixed or growing
Ivan Mahonin b53a5c
/// buffers. The first buffer is for allocating draw commands while the second buffer is
Ivan Mahonin b53a5c
/// used for allocating windows, panels and state tables.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// nk_bool nk_init_custom(struct nk_context *ctx, struct nk_buffer *cmds, struct nk_buffer *pool, const struct nk_user_font *font);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|---------------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an either stack or heap allocated `nk_context` struct
Ivan Mahonin b53a5c
/// __cmds__    | Must point to a previously initialized memory buffer either fixed or dynamic to store draw commands into
Ivan Mahonin b53a5c
/// __pool__    | Must point to a previously initialized memory buffer either fixed or dynamic to store windows, panels and tables
Ivan Mahonin b53a5c
/// __font__    | Must point to a previously initialized font handle for more info look at font documentation
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns either `false(0)` on failure or `true(1)` on success.
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API nk_bool nk_init_custom(struct nk_context*, struct nk_buffer *cmds, struct nk_buffer *pool, const struct nk_user_font*);
Ivan Mahonin b53a5c
/*/// #### nk_clear
Ivan Mahonin b53a5c
/// Resets the context state at the end of the frame. This includes mostly
Ivan Mahonin b53a5c
/// garbage collector tasks like removing windows or table not called and therefore
Ivan Mahonin b53a5c
/// used anymore.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_clear(struct nk_context *ctx);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to a previously initialized `nk_context` struct
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_clear(struct nk_context*);
Ivan Mahonin b53a5c
/*/// #### nk_free
Ivan Mahonin b53a5c
/// Frees all memory allocated by nuklear. Not needed if context was
Ivan Mahonin b53a5c
/// initialized with `nk_init_fixed`.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_free(struct nk_context *ctx);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to a previously initialized `nk_context` struct
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_free(struct nk_context*);
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_COMMAND_USERDATA
Ivan Mahonin b53a5c
/*/// #### nk_set_user_data
Ivan Mahonin b53a5c
/// Sets the currently passed userdata passed down into each draw command.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_set_user_data(struct nk_context *ctx, nk_handle data);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|--------------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to a previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __data__    | Handle with either pointer or index to be passed into every draw commands
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_set_user_data(struct nk_context*, nk_handle handle);
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  INPUT
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * =============================================================================*/
Ivan Mahonin b53a5c
/*/// ### Input
Ivan Mahonin b53a5c
/// The input API is responsible for holding the current input state composed of
Ivan Mahonin b53a5c
/// mouse, key and text input states.
Ivan Mahonin b53a5c
/// It is worth noting that no direct OS or window handling is done in nuklear.
Ivan Mahonin b53a5c
/// Instead all input state has to be provided by platform specific code. This on one hand
Ivan Mahonin b53a5c
/// expects more work from the user and complicates usage but on the other hand
Ivan Mahonin b53a5c
/// provides simple abstraction over a big number of platforms, libraries and other
Ivan Mahonin b53a5c
/// already provided functionality.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// nk_input_begin(&ctx);
Ivan Mahonin b53a5c
/// while (GetEvent(&evt)) {
Ivan Mahonin b53a5c
///     if (evt.type == MOUSE_MOVE)
Ivan Mahonin b53a5c
///         nk_input_motion(&ctx, evt.motion.x, evt.motion.y);
Ivan Mahonin b53a5c
///     else if (evt.type == [...]) {
Ivan Mahonin b53a5c
///         // [...]
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
/// } nk_input_end(&ctx);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### Usage
Ivan Mahonin b53a5c
/// Input state needs to be provided to nuklear by first calling `nk_input_begin`
Ivan Mahonin b53a5c
/// which resets internal state like delta mouse position and button transitions.
Ivan Mahonin b53a5c
/// After `nk_input_begin` all current input state needs to be provided. This includes
Ivan Mahonin b53a5c
/// mouse motion, button and key pressed and released, text input and scrolling.
Ivan Mahonin b53a5c
/// Both event- or state-based input handling are supported by this API
Ivan Mahonin b53a5c
/// and should work without problems. Finally after all input state has been
Ivan Mahonin b53a5c
/// mirrored `nk_input_end` needs to be called to finish input process.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// struct nk_context ctx;
Ivan Mahonin b53a5c
/// nk_init_xxx(&ctx, ...);
Ivan Mahonin b53a5c
/// while (1) {
Ivan Mahonin b53a5c
///     Event evt;
Ivan Mahonin b53a5c
///     nk_input_begin(&ctx);
Ivan Mahonin b53a5c
///     while (GetEvent(&evt)) {
Ivan Mahonin b53a5c
///         if (evt.type == MOUSE_MOVE)
Ivan Mahonin b53a5c
///             nk_input_motion(&ctx, evt.motion.x, evt.motion.y);
Ivan Mahonin b53a5c
///         else if (evt.type == [...]) {
Ivan Mahonin b53a5c
///             // [...]
Ivan Mahonin b53a5c
///         }
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_input_end(&ctx);
Ivan Mahonin b53a5c
///     // [...]
Ivan Mahonin b53a5c
///     nk_clear(&ctx);
Ivan Mahonin b53a5c
/// } nk_free(&ctx);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### Reference
Ivan Mahonin b53a5c
/// Function            | Description
Ivan Mahonin b53a5c
/// --------------------|-------------------------------------------------------
Ivan Mahonin b53a5c
/// __nk_input_begin__  | Begins the input mirroring process. Needs to be called before all other `nk_input_xxx` calls
Ivan Mahonin b53a5c
/// __nk_input_motion__ | Mirrors mouse cursor position
Ivan Mahonin b53a5c
/// __nk_input_key__    | Mirrors key state with either pressed or released
Ivan Mahonin b53a5c
/// __nk_input_button__ | Mirrors mouse button state with either pressed or released
Ivan Mahonin b53a5c
/// __nk_input_scroll__ | Mirrors mouse scroll values
Ivan Mahonin b53a5c
/// __nk_input_char__   | Adds a single ASCII text character into an internal text buffer
Ivan Mahonin b53a5c
/// __nk_input_glyph__  | Adds a single multi-byte UTF-8 character into an internal text buffer
Ivan Mahonin b53a5c
/// __nk_input_unicode__| Adds a single unicode rune into an internal text buffer
Ivan Mahonin b53a5c
/// __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
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
enum nk_keys {
Ivan Mahonin b53a5c
    NK_KEY_NONE,
Ivan Mahonin b53a5c
    NK_KEY_SHIFT,
Ivan Mahonin b53a5c
    NK_KEY_CTRL,
Ivan Mahonin b53a5c
    NK_KEY_DEL,
Ivan Mahonin b53a5c
    NK_KEY_ENTER,
Ivan Mahonin b53a5c
    NK_KEY_TAB,
Ivan Mahonin b53a5c
    NK_KEY_BACKSPACE,
Ivan Mahonin b53a5c
    NK_KEY_COPY,
Ivan Mahonin b53a5c
    NK_KEY_CUT,
Ivan Mahonin b53a5c
    NK_KEY_PASTE,
Ivan Mahonin b53a5c
    NK_KEY_UP,
Ivan Mahonin b53a5c
    NK_KEY_DOWN,
Ivan Mahonin b53a5c
    NK_KEY_LEFT,
Ivan Mahonin b53a5c
    NK_KEY_RIGHT,
Ivan Mahonin b53a5c
    /* Shortcuts: text field */
Ivan Mahonin b53a5c
    NK_KEY_TEXT_INSERT_MODE,
Ivan Mahonin b53a5c
    NK_KEY_TEXT_REPLACE_MODE,
Ivan Mahonin b53a5c
    NK_KEY_TEXT_RESET_MODE,
Ivan Mahonin b53a5c
    NK_KEY_TEXT_LINE_START,
Ivan Mahonin b53a5c
    NK_KEY_TEXT_LINE_END,
Ivan Mahonin b53a5c
    NK_KEY_TEXT_START,
Ivan Mahonin b53a5c
    NK_KEY_TEXT_END,
Ivan Mahonin b53a5c
    NK_KEY_TEXT_UNDO,
Ivan Mahonin b53a5c
    NK_KEY_TEXT_REDO,
Ivan Mahonin b53a5c
    NK_KEY_TEXT_SELECT_ALL,
Ivan Mahonin b53a5c
    NK_KEY_TEXT_WORD_LEFT,
Ivan Mahonin b53a5c
    NK_KEY_TEXT_WORD_RIGHT,
Ivan Mahonin b53a5c
    /* Shortcuts: scrollbar */
Ivan Mahonin b53a5c
    NK_KEY_SCROLL_START,
Ivan Mahonin b53a5c
    NK_KEY_SCROLL_END,
Ivan Mahonin b53a5c
    NK_KEY_SCROLL_DOWN,
Ivan Mahonin b53a5c
    NK_KEY_SCROLL_UP,
Ivan Mahonin b53a5c
    NK_KEY_MAX
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
enum nk_buttons {
Ivan Mahonin b53a5c
    NK_BUTTON_LEFT,
Ivan Mahonin b53a5c
    NK_BUTTON_MIDDLE,
Ivan Mahonin b53a5c
    NK_BUTTON_RIGHT,
Ivan Mahonin b53a5c
    NK_BUTTON_DOUBLE,
Ivan Mahonin b53a5c
    NK_BUTTON_MAX
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
/*/// #### nk_input_begin
Ivan Mahonin b53a5c
/// Begins the input mirroring process by resetting text, scroll
Ivan Mahonin b53a5c
/// mouse, previous mouse position and movement as well as key state transitions,
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_input_begin(struct nk_context*);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to a previously initialized `nk_context` struct
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_input_begin(struct nk_context*);
Ivan Mahonin b53a5c
/*/// #### nk_input_motion
Ivan Mahonin b53a5c
/// Mirrors current mouse position to nuklear
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_input_motion(struct nk_context *ctx, int x, int y);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to a previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __x__       | Must hold an integer describing the current mouse cursor x-position
Ivan Mahonin b53a5c
/// __y__       | Must hold an integer describing the current mouse cursor y-position
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_input_motion(struct nk_context*, int x, int y);
Ivan Mahonin b53a5c
/*/// #### nk_input_key
Ivan Mahonin b53a5c
/// Mirrors the state of a specific key to nuklear
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_input_key(struct nk_context*, enum nk_keys key, nk_bool down);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to a previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __key__     | Must be any value specified in enum `nk_keys` that needs to be mirrored
Ivan Mahonin b53a5c
/// __down__    | Must be 0 for key is up and 1 for key is down
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_input_key(struct nk_context*, enum nk_keys, nk_bool down);
Ivan Mahonin b53a5c
/*/// #### nk_input_button
Ivan Mahonin b53a5c
/// Mirrors the state of a specific mouse button to nuklear
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_input_button(struct nk_context *ctx, enum nk_buttons btn, int x, int y, nk_bool down);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to a previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __btn__     | Must be any value specified in enum `nk_buttons` that needs to be mirrored
Ivan Mahonin b53a5c
/// __x__       | Must contain an integer describing mouse cursor x-position on click up/down
Ivan Mahonin b53a5c
/// __y__       | Must contain an integer describing mouse cursor y-position on click up/down
Ivan Mahonin b53a5c
/// __down__    | Must be 0 for key is up and 1 for key is down
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_input_button(struct nk_context*, enum nk_buttons, int x, int y, nk_bool down);
Ivan Mahonin b53a5c
/*/// #### nk_input_scroll
Ivan Mahonin b53a5c
/// Copies the last mouse scroll value to nuklear. Is generally
Ivan Mahonin b53a5c
/// a scroll value. So does not have to come from mouse and could also originate
Ivan Mahonin b53a5c
/// TODO finish this sentence
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_input_scroll(struct nk_context *ctx, struct nk_vec2 val);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to a previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __val__     | vector with both X- as well as Y-scroll value
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_input_scroll(struct nk_context*, struct nk_vec2 val);
Ivan Mahonin b53a5c
/*/// #### nk_input_char
Ivan Mahonin b53a5c
/// Copies a single ASCII character into an internal text buffer
Ivan Mahonin b53a5c
/// This is basically a helper function to quickly push ASCII characters into
Ivan Mahonin b53a5c
/// nuklear.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// !!! Note
Ivan Mahonin b53a5c
///     Stores up to NK_INPUT_MAX bytes between `nk_input_begin` and `nk_input_end`.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_input_char(struct nk_context *ctx, char c);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to a previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __c__       | Must be a single ASCII character preferable one that can be printed
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_input_char(struct nk_context*, char);
Ivan Mahonin b53a5c
/*/// #### nk_input_glyph
Ivan Mahonin b53a5c
/// Converts an encoded unicode rune into UTF-8 and copies the result into an
Ivan Mahonin b53a5c
/// internal text buffer.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// !!! Note
Ivan Mahonin b53a5c
///     Stores up to NK_INPUT_MAX bytes between `nk_input_begin` and `nk_input_end`.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_input_glyph(struct nk_context *ctx, const nk_glyph g);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to a previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __g__       | UTF-32 unicode codepoint
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_input_glyph(struct nk_context*, const nk_glyph);
Ivan Mahonin b53a5c
/*/// #### nk_input_unicode
Ivan Mahonin b53a5c
/// Converts a unicode rune into UTF-8 and copies the result
Ivan Mahonin b53a5c
/// into an internal text buffer.
Ivan Mahonin b53a5c
/// !!! Note
Ivan Mahonin b53a5c
///     Stores up to NK_INPUT_MAX bytes between `nk_input_begin` and `nk_input_end`.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_input_unicode(struct nk_context*, nk_rune rune);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to a previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __rune__    | UTF-32 unicode codepoint
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_input_unicode(struct nk_context*, nk_rune);
Ivan Mahonin b53a5c
/*/// #### nk_input_end
Ivan Mahonin b53a5c
/// End the input mirroring process by resetting mouse grabbing
Ivan Mahonin b53a5c
/// state to ensure the mouse cursor is not grabbed indefinitely.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_input_end(struct nk_context *ctx);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to a previously initialized `nk_context` struct
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_input_end(struct nk_context*);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  DRAWING
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * =============================================================================*/
Ivan Mahonin b53a5c
/*/// ### Drawing
Ivan Mahonin b53a5c
/// This library was designed to be render backend agnostic so it does
Ivan Mahonin b53a5c
/// not draw anything to screen directly. Instead all drawn shapes, widgets
Ivan Mahonin b53a5c
/// are made of, are buffered into memory and make up a command queue.
Ivan Mahonin b53a5c
/// Each frame therefore fills the command buffer with draw commands
Ivan Mahonin b53a5c
/// that then need to be executed by the user and his own render backend.
Ivan Mahonin b53a5c
/// After that the command buffer needs to be cleared and a new frame can be
Ivan Mahonin b53a5c
/// started. It is probably important to note that the command buffer is the main
Ivan Mahonin b53a5c
/// drawing API and the optional vertex buffer API only takes this format and
Ivan Mahonin b53a5c
/// converts it into a hardware accessible format.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### Usage
Ivan Mahonin b53a5c
/// To draw all draw commands accumulated over a frame you need your own render
Ivan Mahonin b53a5c
/// backend able to draw a number of 2D primitives. This includes at least
Ivan Mahonin b53a5c
/// filled and stroked rectangles, circles, text, lines, triangles and scissors.
Ivan Mahonin b53a5c
/// As soon as this criterion is met you can iterate over each draw command
Ivan Mahonin b53a5c
/// and execute each draw command in a interpreter like fashion:
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// const struct nk_command *cmd = 0;
Ivan Mahonin b53a5c
/// nk_foreach(cmd, &ctx) {
Ivan Mahonin b53a5c
///     switch (cmd->type) {
Ivan Mahonin b53a5c
///     case NK_COMMAND_LINE:
Ivan Mahonin b53a5c
///         your_draw_line_function(...)
Ivan Mahonin b53a5c
///         break;
Ivan Mahonin b53a5c
///     case NK_COMMAND_RECT
Ivan Mahonin b53a5c
///         your_draw_rect_function(...)
Ivan Mahonin b53a5c
///         break;
Ivan Mahonin b53a5c
///     case //...:
Ivan Mahonin b53a5c
///         //[...]
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
/// }
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// In program flow context draw commands need to be executed after input has been
Ivan Mahonin b53a5c
/// gathered and the complete UI with windows and their contained widgets have
Ivan Mahonin b53a5c
/// been executed and before calling `nk_clear` which frees all previously
Ivan Mahonin b53a5c
/// allocated draw commands.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// struct nk_context ctx;
Ivan Mahonin b53a5c
/// nk_init_xxx(&ctx, ...);
Ivan Mahonin b53a5c
/// while (1) {
Ivan Mahonin b53a5c
///     Event evt;
Ivan Mahonin b53a5c
///     nk_input_begin(&ctx);
Ivan Mahonin b53a5c
///     while (GetEvent(&evt)) {
Ivan Mahonin b53a5c
///         if (evt.type == MOUSE_MOVE)
Ivan Mahonin b53a5c
///             nk_input_motion(&ctx, evt.motion.x, evt.motion.y);
Ivan Mahonin b53a5c
///         else if (evt.type == [...]) {
Ivan Mahonin b53a5c
///             [...]
Ivan Mahonin b53a5c
///         }
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_input_end(&ctx);
Ivan Mahonin b53a5c
///     //
Ivan Mahonin b53a5c
///     // [...]
Ivan Mahonin b53a5c
///     //
Ivan Mahonin b53a5c
///     const struct nk_command *cmd = 0;
Ivan Mahonin b53a5c
///     nk_foreach(cmd, &ctx) {
Ivan Mahonin b53a5c
///     switch (cmd->type) {
Ivan Mahonin b53a5c
///     case NK_COMMAND_LINE:
Ivan Mahonin b53a5c
///         your_draw_line_function(...)
Ivan Mahonin b53a5c
///         break;
Ivan Mahonin b53a5c
///     case NK_COMMAND_RECT
Ivan Mahonin b53a5c
///         your_draw_rect_function(...)
Ivan Mahonin b53a5c
///         break;
Ivan Mahonin b53a5c
///     case ...:
Ivan Mahonin b53a5c
///         // [...]
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_clear(&ctx);
Ivan Mahonin b53a5c
/// }
Ivan Mahonin b53a5c
/// nk_free(&ctx);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// You probably noticed that you have to draw all of the UI each frame which is
Ivan Mahonin b53a5c
/// quite wasteful. While the actual UI updating loop is quite fast rendering
Ivan Mahonin b53a5c
/// without actually needing it is not. So there are multiple things you could do.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// First is only update on input. This of course is only an option if your
Ivan Mahonin b53a5c
/// application only depends on the UI and does not require any outside calculations.
Ivan Mahonin b53a5c
/// If you actually only update on input make sure to update the UI two times each
Ivan Mahonin b53a5c
/// frame and call `nk_clear` directly after the first pass and only draw in
Ivan Mahonin b53a5c
/// the second pass. In addition it is recommended to also add additional timers
Ivan Mahonin b53a5c
/// to make sure the UI is not drawn more than a fixed number of frames per second.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// struct nk_context ctx;
Ivan Mahonin b53a5c
/// nk_init_xxx(&ctx, ...);
Ivan Mahonin b53a5c
/// while (1) {
Ivan Mahonin b53a5c
///     // [...wait for input ]
Ivan Mahonin b53a5c
///     // [...do two UI passes ...]
Ivan Mahonin b53a5c
///     do_ui(...)
Ivan Mahonin b53a5c
///     nk_clear(&ctx);
Ivan Mahonin b53a5c
///     do_ui(...)
Ivan Mahonin b53a5c
///     //
Ivan Mahonin b53a5c
///     // draw
Ivan Mahonin b53a5c
///     const struct nk_command *cmd = 0;
Ivan Mahonin b53a5c
///     nk_foreach(cmd, &ctx) {
Ivan Mahonin b53a5c
///     switch (cmd->type) {
Ivan Mahonin b53a5c
///     case NK_COMMAND_LINE:
Ivan Mahonin b53a5c
///         your_draw_line_function(...)
Ivan Mahonin b53a5c
///         break;
Ivan Mahonin b53a5c
///     case NK_COMMAND_RECT
Ivan Mahonin b53a5c
///         your_draw_rect_function(...)
Ivan Mahonin b53a5c
///         break;
Ivan Mahonin b53a5c
///     case ...:
Ivan Mahonin b53a5c
///         //[...]
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_clear(&ctx);
Ivan Mahonin b53a5c
/// }
Ivan Mahonin b53a5c
/// nk_free(&ctx);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// The second probably more applicable trick is to only draw if anything changed.
Ivan Mahonin b53a5c
/// It is not really useful for applications with continuous draw loop but
Ivan Mahonin b53a5c
/// quite useful for desktop applications. To actually get nuklear to only
Ivan Mahonin b53a5c
/// draw on changes you first have to define `NK_ZERO_COMMAND_MEMORY` and
Ivan Mahonin b53a5c
/// allocate a memory buffer that will store each unique drawing output.
Ivan Mahonin b53a5c
/// After each frame you compare the draw command memory inside the library
Ivan Mahonin b53a5c
/// with your allocated buffer by memcmp. If memcmp detects differences
Ivan Mahonin b53a5c
/// you have to copy the command buffer into the allocated buffer
Ivan Mahonin b53a5c
/// and then draw like usual (this example uses fixed memory but you could
Ivan Mahonin b53a5c
/// use dynamically allocated memory).
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// //[... other defines ...]
Ivan Mahonin b53a5c
/// #define NK_ZERO_COMMAND_MEMORY
Ivan Mahonin b53a5c
/// #include "nuklear.h"
Ivan Mahonin b53a5c
/// //
Ivan Mahonin b53a5c
/// // setup context
Ivan Mahonin b53a5c
/// struct nk_context ctx;
Ivan Mahonin b53a5c
/// void *last = calloc(1,64*1024);
Ivan Mahonin b53a5c
/// void *buf = calloc(1,64*1024);
Ivan Mahonin b53a5c
/// nk_init_fixed(&ctx, buf, 64*1024);
Ivan Mahonin b53a5c
/// //
Ivan Mahonin b53a5c
/// // loop
Ivan Mahonin b53a5c
/// while (1) {
Ivan Mahonin b53a5c
///     // [...input...]
Ivan Mahonin b53a5c
///     // [...ui...]
Ivan Mahonin b53a5c
///     void *cmds = nk_buffer_memory(&ctx.memory);
Ivan Mahonin b53a5c
///     if (memcmp(cmds, last, ctx.memory.allocated)) {
Ivan Mahonin b53a5c
///         memcpy(last,cmds,ctx.memory.allocated);
Ivan Mahonin b53a5c
///         const struct nk_command *cmd = 0;
Ivan Mahonin b53a5c
///         nk_foreach(cmd, &ctx) {
Ivan Mahonin b53a5c
///             switch (cmd->type) {
Ivan Mahonin b53a5c
///             case NK_COMMAND_LINE:
Ivan Mahonin b53a5c
///                 your_draw_line_function(...)
Ivan Mahonin b53a5c
///                 break;
Ivan Mahonin b53a5c
///             case NK_COMMAND_RECT
Ivan Mahonin b53a5c
///                 your_draw_rect_function(...)
Ivan Mahonin b53a5c
///                 break;
Ivan Mahonin b53a5c
///             case ...:
Ivan Mahonin b53a5c
///                 // [...]
Ivan Mahonin b53a5c
///             }
Ivan Mahonin b53a5c
///         }
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_clear(&ctx);
Ivan Mahonin b53a5c
/// }
Ivan Mahonin b53a5c
/// nk_free(&ctx);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Finally while using draw commands makes sense for higher abstracted platforms like
Ivan Mahonin b53a5c
/// X11 and Win32 or drawing libraries it is often desirable to use graphics
Ivan Mahonin b53a5c
/// hardware directly. Therefore it is possible to just define
Ivan Mahonin b53a5c
/// `NK_INCLUDE_VERTEX_BUFFER_OUTPUT` which includes optional vertex output.
Ivan Mahonin b53a5c
/// To access the vertex output you first have to convert all draw commands into
Ivan Mahonin b53a5c
/// vertexes by calling `nk_convert` which takes in your preferred vertex format.
Ivan Mahonin b53a5c
/// After successfully converting all draw commands just iterate over and execute all
Ivan Mahonin b53a5c
/// vertex draw commands:
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// // fill configuration
Ivan Mahonin b53a5c
/// struct your_vertex
Ivan Mahonin b53a5c
/// {
Ivan Mahonin b53a5c
///     float pos[2]; // important to keep it to 2 floats
Ivan Mahonin b53a5c
///     float uv[2];
Ivan Mahonin b53a5c
///     unsigned char col[4];
Ivan Mahonin b53a5c
/// };
Ivan Mahonin b53a5c
/// struct nk_convert_config cfg = {};
Ivan Mahonin b53a5c
/// static const struct nk_draw_vertex_layout_element vertex_layout[] = {
Ivan Mahonin b53a5c
///     {NK_VERTEX_POSITION, NK_FORMAT_FLOAT, NK_OFFSETOF(struct your_vertex, pos)},
Ivan Mahonin b53a5c
///     {NK_VERTEX_TEXCOORD, NK_FORMAT_FLOAT, NK_OFFSETOF(struct your_vertex, uv)},
Ivan Mahonin b53a5c
///     {NK_VERTEX_COLOR, NK_FORMAT_R8G8B8A8, NK_OFFSETOF(struct your_vertex, col)},
Ivan Mahonin b53a5c
///     {NK_VERTEX_LAYOUT_END}
Ivan Mahonin b53a5c
/// };
Ivan Mahonin b53a5c
/// cfg.shape_AA = NK_ANTI_ALIASING_ON;
Ivan Mahonin b53a5c
/// cfg.line_AA = NK_ANTI_ALIASING_ON;
Ivan Mahonin b53a5c
/// cfg.vertex_layout = vertex_layout;
Ivan Mahonin b53a5c
/// cfg.vertex_size = sizeof(struct your_vertex);
Ivan Mahonin b53a5c
/// cfg.vertex_alignment = NK_ALIGNOF(struct your_vertex);
Ivan Mahonin b53a5c
/// cfg.circle_segment_count = 22;
Ivan Mahonin b53a5c
/// cfg.curve_segment_count = 22;
Ivan Mahonin b53a5c
/// cfg.arc_segment_count = 22;
Ivan Mahonin b53a5c
/// cfg.global_alpha = 1.0f;
Ivan Mahonin b53a5c
/// cfg.tex_null = dev->tex_null;
Ivan Mahonin b53a5c
/// //
Ivan Mahonin b53a5c
/// // setup buffers and convert
Ivan Mahonin b53a5c
/// struct nk_buffer cmds, verts, idx;
Ivan Mahonin b53a5c
/// nk_buffer_init_default(&cmds);
Ivan Mahonin b53a5c
/// nk_buffer_init_default(&verts);
Ivan Mahonin b53a5c
/// nk_buffer_init_default(&idx);
Ivan Mahonin b53a5c
/// nk_convert(&ctx, &cmds, &verts, &idx, &cfg);
Ivan Mahonin b53a5c
/// //
Ivan Mahonin b53a5c
/// // draw
Ivan Mahonin b53a5c
/// nk_draw_foreach(cmd, &ctx, &cmds) {
Ivan Mahonin b53a5c
/// if (!cmd->elem_count) continue;
Ivan Mahonin b53a5c
///     //[...]
Ivan Mahonin b53a5c
/// }
Ivan Mahonin b53a5c
/// nk_buffer_free(&cms);
Ivan Mahonin b53a5c
/// nk_buffer_free(&verts);
Ivan Mahonin b53a5c
/// nk_buffer_free(&idx);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### Reference
Ivan Mahonin b53a5c
/// Function            | Description
Ivan Mahonin b53a5c
/// --------------------|-------------------------------------------------------
Ivan Mahonin b53a5c
/// __nk__begin__       | Returns the first draw command in the context draw command list to be drawn
Ivan Mahonin b53a5c
/// __nk__next__        | Increments the draw command iterator to the next command inside the context draw command list
Ivan Mahonin b53a5c
/// __nk_foreach__      | Iterates over each draw command inside the context draw command list
Ivan Mahonin b53a5c
/// __nk_convert__      | Converts from the abstract draw commands list into a hardware accessible vertex format
Ivan Mahonin b53a5c
/// __nk_draw_begin__   | Returns the first vertex command in the context vertex draw list to be executed
Ivan Mahonin b53a5c
/// __nk__draw_next__   | Increments the vertex command iterator to the next command inside the context vertex command list
Ivan Mahonin b53a5c
/// __nk__draw_end__    | Returns the end of the vertex draw list
Ivan Mahonin b53a5c
/// __nk_draw_foreach__ | Iterates over each vertex draw command inside the vertex draw list
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
enum nk_anti_aliasing {NK_ANTI_ALIASING_OFF, NK_ANTI_ALIASING_ON};
Ivan Mahonin b53a5c
enum nk_convert_result {
Ivan Mahonin b53a5c
    NK_CONVERT_SUCCESS = 0,
Ivan Mahonin b53a5c
    NK_CONVERT_INVALID_PARAM = 1,
Ivan Mahonin b53a5c
    NK_CONVERT_COMMAND_BUFFER_FULL = NK_FLAG(1),
Ivan Mahonin b53a5c
    NK_CONVERT_VERTEX_BUFFER_FULL = NK_FLAG(2),
Ivan Mahonin b53a5c
    NK_CONVERT_ELEMENT_BUFFER_FULL = NK_FLAG(3)
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
struct nk_draw_null_texture {
Ivan Mahonin b53a5c
    nk_handle texture; /* texture handle to a texture with a white pixel */
Ivan Mahonin b53a5c
    struct nk_vec2 uv; /* coordinates to a white pixel in the texture  */
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
struct nk_convert_config {
Ivan Mahonin b53a5c
    float global_alpha; /* global alpha value */
Ivan Mahonin b53a5c
    enum nk_anti_aliasing line_AA; /* line anti-aliasing flag can be turned off if you are tight on memory */
Ivan Mahonin b53a5c
    enum nk_anti_aliasing shape_AA; /* shape anti-aliasing flag can be turned off if you are tight on memory */
Ivan Mahonin b53a5c
    unsigned circle_segment_count; /* number of segments used for circles: default to 22 */
Ivan Mahonin b53a5c
    unsigned arc_segment_count; /* number of segments used for arcs: default to 22 */
Ivan Mahonin b53a5c
    unsigned curve_segment_count; /* number of segments used for curves: default to 22 */
Ivan Mahonin b53a5c
    struct nk_draw_null_texture tex_null; /* handle to texture with a white pixel for shape drawing */
Ivan Mahonin b53a5c
    const struct nk_draw_vertex_layout_element *vertex_layout; /* describes the vertex output format and packing */
Ivan Mahonin b53a5c
    nk_size vertex_size; /* sizeof one vertex for vertex packing */
Ivan Mahonin b53a5c
    nk_size vertex_alignment; /* vertex alignment: Can be obtained by NK_ALIGNOF */
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
/*/// #### nk__begin
Ivan Mahonin b53a5c
/// Returns a draw command list iterator to iterate all draw
Ivan Mahonin b53a5c
/// commands accumulated over one frame.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// const struct nk_command* nk__begin(struct nk_context*);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | must point to an previously initialized `nk_context` struct at the end of a frame
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns draw command pointer pointing to the first command inside the draw command list
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API const struct nk_command* nk__begin(struct nk_context*);
Ivan Mahonin b53a5c
/*/// #### nk__next
Ivan Mahonin b53a5c
/// Returns draw command pointer pointing to the next command inside the draw command list
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// const struct nk_command* nk__next(struct nk_context*, const struct nk_command*);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct at the end of a frame
Ivan Mahonin b53a5c
/// __cmd__     | Must point to an previously a draw command either returned by `nk__begin` or `nk__next`
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns draw command pointer pointing to the next command inside the draw command list
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API const struct nk_command* nk__next(struct nk_context*, const struct nk_command*);
Ivan Mahonin b53a5c
/*/// #### nk_foreach
Ivan Mahonin b53a5c
/// Iterates over each draw command inside the context draw command list
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// #define nk_foreach(c, ctx)
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct at the end of a frame
Ivan Mahonin b53a5c
/// __cmd__     | Command pointer initialized to NULL
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Iterates over each draw command inside the context draw command list
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
#define nk_foreach(c, ctx) for((c) = nk__begin(ctx); (c) != 0; (c) = nk__next(ctx,c))
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_VERTEX_BUFFER_OUTPUT
Ivan Mahonin b53a5c
/*/// #### nk_convert
Ivan Mahonin b53a5c
/// Converts all internal draw commands into vertex draw commands and fills
Ivan Mahonin b53a5c
/// three buffers with vertexes, vertex draw commands and vertex indices. The vertex format
Ivan Mahonin b53a5c
/// as well as some other configuration values have to be configured by filling out a
Ivan Mahonin b53a5c
/// `nk_convert_config` struct.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// nk_flags nk_convert(struct nk_context *ctx, struct nk_buffer *cmds,
Ivan Mahonin b53a5c
///     struct nk_buffer *vertices, struct nk_buffer *elements, const struct nk_convert_config*);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct at the end of a frame
Ivan Mahonin b53a5c
/// __cmds__    | Must point to a previously initialized buffer to hold converted vertex draw commands
Ivan Mahonin b53a5c
/// __vertices__| Must point to a previously initialized buffer to hold all produced vertices
Ivan Mahonin b53a5c
/// __elements__| Must point to a previously initialized buffer to hold all produced vertex indices
Ivan Mahonin b53a5c
/// __config__  | Must point to a filled out `nk_config` struct to configure the conversion process
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns one of enum nk_convert_result error codes
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter                       | Description
Ivan Mahonin b53a5c
/// --------------------------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// NK_CONVERT_SUCCESS              | Signals a successful draw command to vertex buffer conversion
Ivan Mahonin b53a5c
/// NK_CONVERT_INVALID_PARAM        | An invalid argument was passed in the function call
Ivan Mahonin b53a5c
/// NK_CONVERT_COMMAND_BUFFER_FULL  | The provided buffer for storing draw commands is full or failed to allocate more memory
Ivan Mahonin b53a5c
/// NK_CONVERT_VERTEX_BUFFER_FULL   | The provided buffer for storing vertices is full or failed to allocate more memory
Ivan Mahonin b53a5c
/// NK_CONVERT_ELEMENT_BUFFER_FULL  | The provided buffer for storing indices is full or failed to allocate more memory
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
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*);
Ivan Mahonin b53a5c
/*/// #### nk__draw_begin
Ivan Mahonin b53a5c
/// Returns a draw vertex command buffer iterator to iterate over the vertex draw command buffer
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// const struct nk_draw_command* nk__draw_begin(const struct nk_context*, const struct nk_buffer*);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct at the end of a frame
Ivan Mahonin b53a5c
/// __buf__     | Must point to an previously by `nk_convert` filled out vertex draw command buffer
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns vertex draw command pointer pointing to the first command inside the vertex draw command buffer
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API const struct nk_draw_command* nk__draw_begin(const struct nk_context*, const struct nk_buffer*);
Ivan Mahonin b53a5c
/*/// #### nk__draw_end
Ivan Mahonin b53a5c
/// Returns the vertex draw command at the end of the vertex draw command buffer
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// const struct nk_draw_command* nk__draw_end(const struct nk_context *ctx, const struct nk_buffer *buf);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct at the end of a frame
Ivan Mahonin b53a5c
/// __buf__     | Must point to an previously by `nk_convert` filled out vertex draw command buffer
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns vertex draw command pointer pointing to the end of the last vertex draw command inside the vertex draw command buffer
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API const struct nk_draw_command* nk__draw_end(const struct nk_context*, const struct nk_buffer*);
Ivan Mahonin b53a5c
/*/// #### nk__draw_next
Ivan Mahonin b53a5c
/// Increments the vertex draw command buffer iterator
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// const struct nk_draw_command* nk__draw_next(const struct nk_draw_command*, const struct nk_buffer*, const struct nk_context*);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __cmd__     | Must point to an previously either by `nk__draw_begin` or `nk__draw_next` returned vertex draw command
Ivan Mahonin b53a5c
/// __buf__     | Must point to an previously by `nk_convert` filled out vertex draw command buffer
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct at the end of a frame
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns vertex draw command pointer pointing to the end of the last vertex draw command inside the vertex draw command buffer
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API const struct nk_draw_command* nk__draw_next(const struct nk_draw_command*, const struct nk_buffer*, const struct nk_context*);
Ivan Mahonin b53a5c
/*/// #### nk_draw_foreach
Ivan Mahonin b53a5c
/// Iterates over each vertex draw command inside a vertex draw command buffer
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// #define nk_draw_foreach(cmd,ctx, b)
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __cmd__     | `nk_draw_command`iterator set to NULL
Ivan Mahonin b53a5c
/// __buf__     | Must point to an previously by `nk_convert` filled out vertex draw command buffer
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct at the end of a frame
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
#define nk_draw_foreach(cmd,ctx, b) for((cmd)=nk__draw_begin(ctx, b); (cmd)!=0; (cmd)=nk__draw_next(cmd, b, ctx))
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  WINDOW
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * =============================================================================
Ivan Mahonin b53a5c
/// ### Window
Ivan Mahonin b53a5c
/// Windows are the main persistent state used inside nuklear and are life time
Ivan Mahonin b53a5c
/// controlled by simply "retouching" (i.e. calling) each window each frame.
Ivan Mahonin b53a5c
/// All widgets inside nuklear can only be added inside the function pair `nk_begin_xxx`
Ivan Mahonin b53a5c
/// and `nk_end`. Calling any widgets outside these two functions will result in an
Ivan Mahonin b53a5c
/// assert in debug or no state change in release mode.

Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Each window holds frame persistent state like position, size, flags, state tables,
Ivan Mahonin b53a5c
/// and some garbage collected internal persistent widget state. Each window
Ivan Mahonin b53a5c
/// is linked into a window stack list which determines the drawing and overlapping
Ivan Mahonin b53a5c
/// order. The topmost window thereby is the currently active window.

Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// To change window position inside the stack occurs either automatically by
Ivan Mahonin b53a5c
/// user input by being clicked on or programmatically by calling `nk_window_focus`.
Ivan Mahonin b53a5c
/// Windows by default are visible unless explicitly being defined with flag
Ivan Mahonin b53a5c
/// `NK_WINDOW_HIDDEN`, the user clicked the close button on windows with flag
Ivan Mahonin b53a5c
/// `NK_WINDOW_CLOSABLE` or if a window was explicitly hidden by calling
Ivan Mahonin b53a5c
/// `nk_window_show`. To explicitly close and destroy a window call `nk_window_close`.

Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### Usage
Ivan Mahonin b53a5c
/// To create and keep a window you have to call one of the two `nk_begin_xxx`
Ivan Mahonin b53a5c
/// functions to start window declarations and `nk_end` at the end. Furthermore it
Ivan Mahonin b53a5c
/// is recommended to check the return value of `nk_begin_xxx` and only process
Ivan Mahonin b53a5c
/// widgets inside the window if the value is not 0. Either way you have to call
Ivan Mahonin b53a5c
/// `nk_end` at the end of window declarations. Furthermore, do not attempt to
Ivan Mahonin b53a5c
/// nest `nk_begin_xxx` calls which will hopefully result in an assert or if not
Ivan Mahonin b53a5c
/// in a segmentation fault.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// if (nk_begin_xxx(...) {
Ivan Mahonin b53a5c
///     // [... widgets ...]
Ivan Mahonin b53a5c
/// }
Ivan Mahonin b53a5c
/// nk_end(ctx);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// In the grand concept window and widget declarations need to occur after input
Ivan Mahonin b53a5c
/// handling and before drawing to screen. Not doing so can result in higher
Ivan Mahonin b53a5c
/// latency or at worst invalid behavior. Furthermore make sure that `nk_clear`
Ivan Mahonin b53a5c
/// is called at the end of the frame. While nuklear's default platform backends
Ivan Mahonin b53a5c
/// already call `nk_clear` for you if you write your own backend not calling
Ivan Mahonin b53a5c
/// `nk_clear` can cause asserts or even worse undefined behavior.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// struct nk_context ctx;
Ivan Mahonin b53a5c
/// nk_init_xxx(&ctx, ...);
Ivan Mahonin b53a5c
/// while (1) {
Ivan Mahonin b53a5c
///     Event evt;
Ivan Mahonin b53a5c
///     nk_input_begin(&ctx);
Ivan Mahonin b53a5c
///     while (GetEvent(&evt)) {
Ivan Mahonin b53a5c
///         if (evt.type == MOUSE_MOVE)
Ivan Mahonin b53a5c
///             nk_input_motion(&ctx, evt.motion.x, evt.motion.y);
Ivan Mahonin b53a5c
///         else if (evt.type == [...]) {
Ivan Mahonin b53a5c
///             nk_input_xxx(...);
Ivan Mahonin b53a5c
///         }
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_input_end(&ctx);
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
///     if (nk_begin_xxx(...) {
Ivan Mahonin b53a5c
///         //[...]
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_end(ctx);
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
///     const struct nk_command *cmd = 0;
Ivan Mahonin b53a5c
///     nk_foreach(cmd, &ctx) {
Ivan Mahonin b53a5c
///     case NK_COMMAND_LINE:
Ivan Mahonin b53a5c
///         your_draw_line_function(...)
Ivan Mahonin b53a5c
///         break;
Ivan Mahonin b53a5c
///     case NK_COMMAND_RECT
Ivan Mahonin b53a5c
///         your_draw_rect_function(...)
Ivan Mahonin b53a5c
///         break;
Ivan Mahonin b53a5c
///     case //...:
Ivan Mahonin b53a5c
///         //[...]
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_clear(&ctx);
Ivan Mahonin b53a5c
/// }
Ivan Mahonin b53a5c
/// nk_free(&ctx);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### Reference
Ivan Mahonin b53a5c
/// Function                            | Description
Ivan Mahonin b53a5c
/// ------------------------------------|----------------------------------------
Ivan Mahonin b53a5c
/// nk_begin                            | Starts a new window; needs to be called every frame for every window (unless hidden) or otherwise the window gets removed
Ivan Mahonin b53a5c
/// nk_begin_titled                     | Extended window start with separated title and identifier to allow multiple windows with same name but not title
Ivan Mahonin b53a5c
/// nk_end                              | Needs to be called at the end of the window building process to process scaling, scrollbars and general cleanup
Ivan Mahonin b53a5c
//
Ivan Mahonin b53a5c
/// nk_window_find                      | Finds and returns the window with give name
Ivan Mahonin b53a5c
/// nk_window_get_bounds                | Returns a rectangle with screen position and size of the currently processed window.
Ivan Mahonin b53a5c
/// nk_window_get_position              | Returns the position of the currently processed window
Ivan Mahonin b53a5c
/// nk_window_get_size                  | Returns the size with width and height of the currently processed window
Ivan Mahonin b53a5c
/// nk_window_get_width                 | Returns the width of the currently processed window
Ivan Mahonin b53a5c
/// nk_window_get_height                | Returns the height of the currently processed window
Ivan Mahonin b53a5c
/// nk_window_get_panel                 | Returns the underlying panel which contains all processing state of the current window
Ivan Mahonin b53a5c
/// nk_window_get_content_region        | Returns the position and size of the currently visible and non-clipped space inside the currently processed window
Ivan Mahonin b53a5c
/// nk_window_get_content_region_min    | Returns the upper rectangle position of the currently visible and non-clipped space inside the currently processed window
Ivan Mahonin b53a5c
/// nk_window_get_content_region_max    | Returns the upper rectangle position of the currently visible and non-clipped space inside the currently processed window
Ivan Mahonin b53a5c
/// nk_window_get_content_region_size   | Returns the size of the currently visible and non-clipped space inside the currently processed window
Ivan Mahonin b53a5c
/// nk_window_get_canvas                | Returns the draw command buffer. Can be used to draw custom widgets
Ivan Mahonin b53a5c
/// nk_window_get_scroll                | Gets the scroll offset of the current window
Ivan Mahonin b53a5c
/// nk_window_has_focus                 | Returns if the currently processed window is currently active
Ivan Mahonin b53a5c
/// nk_window_is_collapsed              | Returns if the window with given name is currently minimized/collapsed
Ivan Mahonin b53a5c
/// nk_window_is_closed                 | Returns if the currently processed window was closed
Ivan Mahonin b53a5c
/// nk_window_is_hidden                 | Returns if the currently processed window was hidden
Ivan Mahonin b53a5c
/// nk_window_is_active                 | Same as nk_window_has_focus for some reason
Ivan Mahonin b53a5c
/// nk_window_is_hovered                | Returns if the currently processed window is currently being hovered by mouse
Ivan Mahonin b53a5c
/// nk_window_is_any_hovered            | Return if any window currently hovered
Ivan Mahonin b53a5c
/// nk_item_is_any_active               | Returns if any window or widgets is currently hovered or active
Ivan Mahonin b53a5c
//
Ivan Mahonin b53a5c
/// nk_window_set_bounds                | Updates position and size of the currently processed window
Ivan Mahonin b53a5c
/// nk_window_set_position              | Updates position of the currently process window
Ivan Mahonin b53a5c
/// nk_window_set_size                  | Updates the size of the currently processed window
Ivan Mahonin b53a5c
/// nk_window_set_focus                 | Set the currently processed window as active window
Ivan Mahonin b53a5c
/// nk_window_set_scroll                | Sets the scroll offset of the current window
Ivan Mahonin b53a5c
//
Ivan Mahonin b53a5c
/// nk_window_close                     | Closes the window with given window name which deletes the window at the end of the frame
Ivan Mahonin b53a5c
/// nk_window_collapse                  | Collapses the window with given window name
Ivan Mahonin b53a5c
/// nk_window_collapse_if               | Collapses the window with given window name if the given condition was met
Ivan Mahonin b53a5c
/// nk_window_show                      | Hides a visible or reshows a hidden window
Ivan Mahonin b53a5c
/// nk_window_show_if                   | Hides/shows a window depending on condition
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
/*
Ivan Mahonin b53a5c
/// #### nk_panel_flags
Ivan Mahonin b53a5c
/// Flag                        | Description
Ivan Mahonin b53a5c
/// ----------------------------|----------------------------------------
Ivan Mahonin b53a5c
/// NK_WINDOW_BORDER            | Draws a border around the window to visually separate window from the background
Ivan Mahonin b53a5c
/// NK_WINDOW_MOVABLE           | The movable flag indicates that a window can be moved by user input or by dragging the window header
Ivan Mahonin b53a5c
/// NK_WINDOW_SCALABLE          | The scalable flag indicates that a window can be scaled by user input by dragging a scaler icon at the button of the window
Ivan Mahonin b53a5c
/// NK_WINDOW_CLOSABLE          | Adds a closable icon into the header
Ivan Mahonin b53a5c
/// NK_WINDOW_MINIMIZABLE       | Adds a minimize icon into the header
Ivan Mahonin b53a5c
/// NK_WINDOW_NO_SCROLLBAR      | Removes the scrollbar from the window
Ivan Mahonin b53a5c
/// NK_WINDOW_TITLE             | Forces a header at the top at the window showing the title
Ivan Mahonin b53a5c
/// NK_WINDOW_SCROLL_AUTO_HIDE  | Automatically hides the window scrollbar if no user interaction: also requires delta time in `nk_context` to be set each frame
Ivan Mahonin b53a5c
/// NK_WINDOW_BACKGROUND        | Always keep window in the background
Ivan Mahonin b53a5c
/// NK_WINDOW_SCALE_LEFT        | Puts window scaler in the left-bottom corner instead right-bottom
Ivan Mahonin b53a5c
/// NK_WINDOW_NO_INPUT          | Prevents window of scaling, moving or getting focus
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### nk_collapse_states
Ivan Mahonin b53a5c
/// State           | Description
Ivan Mahonin b53a5c
/// ----------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __NK_MINIMIZED__| UI section is collased and not visible until maximized
Ivan Mahonin b53a5c
/// __NK_MAXIMIZED__| UI section is extended and visible until minimized
Ivan Mahonin b53a5c
/// 

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

Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// All layouting methods in this library are based around the concept of a row.
Ivan Mahonin b53a5c
/// A row has a height the window content grows by and a number of columns and each
Ivan Mahonin b53a5c
/// layouting method specifies how each widget is placed inside the row.
Ivan Mahonin b53a5c
/// After a row has been allocated by calling a layouting functions and then
Ivan Mahonin b53a5c
/// filled with widgets will advance an internal pointer over the allocated row. 

Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// To actually define a layout you just call the appropriate layouting function
Ivan Mahonin b53a5c
/// and each subsequent widget call will place the widget as specified. Important
Ivan Mahonin b53a5c
/// here is that if you define more widgets then columns defined inside the layout
Ivan Mahonin b53a5c
/// functions it will allocate the next row without you having to make another layouting 

Ivan Mahonin b53a5c
/// call.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Biggest limitation with using all these APIs outside the `nk_layout_space_xxx` API
Ivan Mahonin b53a5c
/// is that you have to define the row height for each. However the row height
Ivan Mahonin b53a5c
/// often depends on the height of the font. 

Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// To fix that internally nuklear uses a minimum row height that is set to the
Ivan Mahonin b53a5c
/// height plus padding of currently active font and overwrites the row height
Ivan Mahonin b53a5c
/// value if zero. 

Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// If you manually want to change the minimum row height then
Ivan Mahonin b53a5c
/// use nk_layout_set_min_row_height, and use nk_layout_reset_min_row_height to
Ivan Mahonin b53a5c
/// reset it back to be derived from font height. 

Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Also if you change the font in nuklear it will automatically change the minimum
Ivan Mahonin b53a5c
/// row height for you and. This means if you change the font but still want
Ivan Mahonin b53a5c
/// a minimum row height smaller than the font you have to repush your value. 

Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// For actually more advanced UI I would even recommend using the `nk_layout_space_xxx`
Ivan Mahonin b53a5c
/// layouting method in combination with a cassowary constraint solver (there are
Ivan Mahonin b53a5c
/// some versions on github with permissive license model) to take over all control over widget
Ivan Mahonin b53a5c
/// layouting yourself. However for quick and dirty layouting using all the other layouting
Ivan Mahonin b53a5c
/// functions should be fine.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### Usage
Ivan Mahonin b53a5c
/// 1.  __nk_layout_row_dynamic__

Ivan Mahonin b53a5c
///     The easiest layouting function is `nk_layout_row_dynamic`. It provides each
Ivan Mahonin b53a5c
///     widgets with same horizontal space inside the row and dynamically grows
Ivan Mahonin b53a5c
///     if the owning window grows in width. So the number of columns dictates
Ivan Mahonin b53a5c
///     the size of each widget dynamically by formula:
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
///     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
///     widget_width = (window_width - padding - spacing) * (1/colum_count)
Ivan Mahonin b53a5c
///     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
///     Just like all other layouting APIs if you define more widget than columns this
Ivan Mahonin b53a5c
///     library will allocate a new row and keep all layouting parameters previously
Ivan Mahonin b53a5c
///     defined.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
///     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
///     if (nk_begin_xxx(...) {
Ivan Mahonin b53a5c
///         // first row with height: 30 composed of two widgets
Ivan Mahonin b53a5c
///         nk_layout_row_dynamic(&ctx, 30, 2);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         //
Ivan Mahonin b53a5c
///         // second row with same parameter as defined above
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         //
Ivan Mahonin b53a5c
///         // third row uses 0 for height which will use auto layouting
Ivan Mahonin b53a5c
///         nk_layout_row_dynamic(&ctx, 0, 2);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_end(...);
Ivan Mahonin b53a5c
///     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// 2.  __nk_layout_row_static__

Ivan Mahonin b53a5c
///     Another easy layouting function is `nk_layout_row_static`. It provides each
Ivan Mahonin b53a5c
///     widget with same horizontal pixel width inside the row and does not grow
Ivan Mahonin b53a5c
///     if the owning window scales smaller or bigger.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
///     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
///     if (nk_begin_xxx(...) {
Ivan Mahonin b53a5c
///         // first row with height: 30 composed of two widgets with width: 80
Ivan Mahonin b53a5c
///         nk_layout_row_static(&ctx, 30, 80, 2);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         //
Ivan Mahonin b53a5c
///         // second row with same parameter as defined above
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         //
Ivan Mahonin b53a5c
///         // third row uses 0 for height which will use auto layouting
Ivan Mahonin b53a5c
///         nk_layout_row_static(&ctx, 0, 80, 2);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_end(...);
Ivan Mahonin b53a5c
///     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// 3.  __nk_layout_row_xxx__

Ivan Mahonin b53a5c
///     A little bit more advanced layouting API are functions `nk_layout_row_begin`,
Ivan Mahonin b53a5c
///     `nk_layout_row_push` and `nk_layout_row_end`. They allow to directly
Ivan Mahonin b53a5c
///     specify each column pixel or window ratio in a row. It supports either
Ivan Mahonin b53a5c
///     directly setting per column pixel width or widget window ratio but not
Ivan Mahonin b53a5c
///     both. Furthermore it is a immediate mode API so each value is directly
Ivan Mahonin b53a5c
///     pushed before calling a widget. Therefore the layout is not automatically
Ivan Mahonin b53a5c
///     repeating like the last two layouting functions.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
///     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
///     if (nk_begin_xxx(...) {
Ivan Mahonin b53a5c
///         // first row with height: 25 composed of two widgets with width 60 and 40
Ivan Mahonin b53a5c
///         nk_layout_row_begin(ctx, NK_STATIC, 25, 2);
Ivan Mahonin b53a5c
///         nk_layout_row_push(ctx, 60);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_layout_row_push(ctx, 40);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_layout_row_end(ctx);
Ivan Mahonin b53a5c
///         //
Ivan Mahonin b53a5c
///         // second row with height: 25 composed of two widgets with window ratio 0.25 and 0.75
Ivan Mahonin b53a5c
///         nk_layout_row_begin(ctx, NK_DYNAMIC, 25, 2);
Ivan Mahonin b53a5c
///         nk_layout_row_push(ctx, 0.25f);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_layout_row_push(ctx, 0.75f);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_layout_row_end(ctx);
Ivan Mahonin b53a5c
///         //
Ivan Mahonin b53a5c
///         // third row with auto generated height: composed of two widgets with window ratio 0.25 and 0.75
Ivan Mahonin b53a5c
///         nk_layout_row_begin(ctx, NK_DYNAMIC, 0, 2);
Ivan Mahonin b53a5c
///         nk_layout_row_push(ctx, 0.25f);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_layout_row_push(ctx, 0.75f);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_layout_row_end(ctx);
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_end(...);
Ivan Mahonin b53a5c
///     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// 4.  __nk_layout_row__

Ivan Mahonin b53a5c
///     The array counterpart to API nk_layout_row_xxx is the single nk_layout_row
Ivan Mahonin b53a5c
///     functions. Instead of pushing either pixel or window ratio for every widget
Ivan Mahonin b53a5c
///     it allows to define it by array. The trade of for less control is that
Ivan Mahonin b53a5c
///     `nk_layout_row` is automatically repeating. Otherwise the behavior is the
Ivan Mahonin b53a5c
///     same.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
///     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
///     if (nk_begin_xxx(...) {
Ivan Mahonin b53a5c
///         // two rows with height: 30 composed of two widgets with width 60 and 40
Ivan Mahonin b53a5c
///         const float ratio[] = {60,40};
Ivan Mahonin b53a5c
///         nk_layout_row(ctx, NK_STATIC, 30, 2, ratio);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         //
Ivan Mahonin b53a5c
///         // two rows with height: 30 composed of two widgets with window ratio 0.25 and 0.75
Ivan Mahonin b53a5c
///         const float ratio[] = {0.25, 0.75};
Ivan Mahonin b53a5c
///         nk_layout_row(ctx, NK_DYNAMIC, 30, 2, ratio);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         //
Ivan Mahonin b53a5c
///         // two rows with auto generated height composed of two widgets with window ratio 0.25 and 0.75
Ivan Mahonin b53a5c
///         const float ratio[] = {0.25, 0.75};
Ivan Mahonin b53a5c
///         nk_layout_row(ctx, NK_DYNAMIC, 30, 2, ratio);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_end(...);
Ivan Mahonin b53a5c
///     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// 5.  __nk_layout_row_template_xxx__

Ivan Mahonin b53a5c
///     The most complex and second most flexible API is a simplified flexbox version without
Ivan Mahonin b53a5c
///     line wrapping and weights for dynamic widgets. It is an immediate mode API but
Ivan Mahonin b53a5c
///     unlike `nk_layout_row_xxx` it has auto repeat behavior and needs to be called
Ivan Mahonin b53a5c
///     before calling the templated widgets.
Ivan Mahonin b53a5c
///     The row template layout has three different per widget size specifier. The first
Ivan Mahonin b53a5c
///     one is the `nk_layout_row_template_push_static`  with fixed widget pixel width.
Ivan Mahonin b53a5c
///     They do not grow if the row grows and will always stay the same.
Ivan Mahonin b53a5c
///     The second size specifier is `nk_layout_row_template_push_variable`
Ivan Mahonin b53a5c
///     which defines a minimum widget size but it also can grow if more space is available
Ivan Mahonin b53a5c
///     not taken by other widgets.
Ivan Mahonin b53a5c
///     Finally there are dynamic widgets with `nk_layout_row_template_push_dynamic`
Ivan Mahonin b53a5c
///     which are completely flexible and unlike variable widgets can even shrink
Ivan Mahonin b53a5c
///     to zero if not enough space is provided.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
///     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
///     if (nk_begin_xxx(...) {
Ivan Mahonin b53a5c
///         // two rows with height: 30 composed of three widgets
Ivan Mahonin b53a5c
///         nk_layout_row_template_begin(ctx, 30);
Ivan Mahonin b53a5c
///         nk_layout_row_template_push_dynamic(ctx);
Ivan Mahonin b53a5c
///         nk_layout_row_template_push_variable(ctx, 80);
Ivan Mahonin b53a5c
///         nk_layout_row_template_push_static(ctx, 80);
Ivan Mahonin b53a5c
///         nk_layout_row_template_end(ctx);
Ivan Mahonin b53a5c
///         //
Ivan Mahonin b53a5c
///         // first row
Ivan Mahonin b53a5c
///         nk_widget(...); // dynamic widget can go to zero if not enough space
Ivan Mahonin b53a5c
///         nk_widget(...); // variable widget with min 80 pixel but can grow bigger if enough space
Ivan Mahonin b53a5c
///         nk_widget(...); // static widget with fixed 80 pixel width
Ivan Mahonin b53a5c
///         //
Ivan Mahonin b53a5c
///         // second row same layout
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_end(...);
Ivan Mahonin b53a5c
///     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// 6.  __nk_layout_space_xxx__

Ivan Mahonin b53a5c
///     Finally the most flexible API directly allows you to place widgets inside the
Ivan Mahonin b53a5c
///     window. The space layout API is an immediate mode API which does not support
Ivan Mahonin b53a5c
///     row auto repeat and directly sets position and size of a widget. Position
Ivan Mahonin b53a5c
///     and size hereby can be either specified as ratio of allocated space or
Ivan Mahonin b53a5c
///     allocated space local position and pixel size. Since this API is quite
Ivan Mahonin b53a5c
///     powerful there are a number of utility functions to get the available space
Ivan Mahonin b53a5c
///     and convert between local allocated space and screen space.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
///     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
///     if (nk_begin_xxx(...) {
Ivan Mahonin b53a5c
///         // static row with height: 500 (you can set column count to INT_MAX if you don't want to be bothered)
Ivan Mahonin b53a5c
///         nk_layout_space_begin(ctx, NK_STATIC, 500, INT_MAX);
Ivan Mahonin b53a5c
///         nk_layout_space_push(ctx, nk_rect(0,0,150,200));
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_layout_space_push(ctx, nk_rect(200,200,100,200));
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_layout_space_end(ctx);
Ivan Mahonin b53a5c
///         //
Ivan Mahonin b53a5c
///         // dynamic row with height: 500 (you can set column count to INT_MAX if you don't want to be bothered)
Ivan Mahonin b53a5c
///         nk_layout_space_begin(ctx, NK_DYNAMIC, 500, INT_MAX);
Ivan Mahonin b53a5c
///         nk_layout_space_push(ctx, nk_rect(0.5,0.5,0.1,0.1));
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///         nk_layout_space_push(ctx, nk_rect(0.7,0.6,0.1,0.1));
Ivan Mahonin b53a5c
///         nk_widget(...);
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_end(...);
Ivan Mahonin b53a5c
///     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### Reference
Ivan Mahonin b53a5c
/// Function                                | Description
Ivan Mahonin b53a5c
/// ----------------------------------------|------------------------------------
Ivan Mahonin b53a5c
/// nk_layout_set_min_row_height            | Set the currently used minimum row height to a specified value
Ivan Mahonin b53a5c
/// nk_layout_reset_min_row_height          | Resets the currently used minimum row height to font height
Ivan Mahonin b53a5c
/// nk_layout_widget_bounds                 | Calculates current width a static layout row can fit inside a window
Ivan Mahonin b53a5c
/// nk_layout_ratio_from_pixel              | Utility functions to calculate window ratio from pixel size
Ivan Mahonin b53a5c
//
Ivan Mahonin b53a5c
/// nk_layout_row_dynamic                   | Current layout is divided into n same sized growing columns
Ivan Mahonin b53a5c
/// nk_layout_row_static                    | Current layout is divided into n same fixed sized columns
Ivan Mahonin b53a5c
/// nk_layout_row_begin                     | Starts a new row with given height and number of columns
Ivan Mahonin b53a5c
/// nk_layout_row_push                      | Pushes another column with given size or window ratio
Ivan Mahonin b53a5c
/// nk_layout_row_end                       | Finished previously started row
Ivan Mahonin b53a5c
/// nk_layout_row                           | Specifies row columns in array as either window ratio or size
Ivan Mahonin b53a5c
//
Ivan Mahonin b53a5c
/// nk_layout_row_template_begin            | Begins the row template declaration
Ivan Mahonin b53a5c
/// nk_layout_row_template_push_dynamic     | Adds a dynamic column that dynamically grows and can go to zero if not enough space
Ivan Mahonin b53a5c
/// nk_layout_row_template_push_variable    | Adds a variable column that dynamically grows but does not shrink below specified pixel width
Ivan Mahonin b53a5c
/// nk_layout_row_template_push_static      | Adds a static column that does not grow and will always have the same size
Ivan Mahonin b53a5c
/// nk_layout_row_template_end              | Marks the end of the row template
Ivan Mahonin b53a5c
//
Ivan Mahonin b53a5c
/// nk_layout_space_begin                   | Begins a new layouting space that allows to specify each widgets position and size
Ivan Mahonin b53a5c
/// nk_layout_space_push                    | Pushes position and size of the next widget in own coordinate space either as pixel or ratio
Ivan Mahonin b53a5c
/// nk_layout_space_end                     | Marks the end of the layouting space
Ivan Mahonin b53a5c
//
Ivan Mahonin b53a5c
/// nk_layout_space_bounds                  | Callable after nk_layout_space_begin and returns total space allocated
Ivan Mahonin b53a5c
/// nk_layout_space_to_screen               | Converts vector from nk_layout_space coordinate space into screen space
Ivan Mahonin b53a5c
/// nk_layout_space_to_local                | Converts vector from screen space into nk_layout_space coordinates
Ivan Mahonin b53a5c
/// nk_layout_space_rect_to_screen          | Converts rectangle from nk_layout_space coordinate space into screen space
Ivan Mahonin b53a5c
/// nk_layout_space_rect_to_local           | Converts rectangle from screen space into nk_layout_space coordinates
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
/*/// #### nk_layout_set_min_row_height
Ivan Mahonin b53a5c
/// Sets the currently used minimum row height.
Ivan Mahonin b53a5c
/// !!! WARNING
Ivan Mahonin b53a5c
///     The passed height needs to include both your preferred row height
Ivan Mahonin b53a5c
///     as well as padding. No internal padding is added.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_layout_set_min_row_height(struct nk_context*, float height);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
Ivan Mahonin b53a5c
/// __height__  | New minimum row height to be used for auto generating the row height
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_layout_set_min_row_height(struct nk_context*, float height);
Ivan Mahonin b53a5c
/*/// #### nk_layout_reset_min_row_height
Ivan Mahonin b53a5c
/// Reset the currently used minimum row height back to `font_height + text_padding + padding`
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_layout_reset_min_row_height(struct nk_context*);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_layout_reset_min_row_height(struct nk_context*);
Ivan Mahonin b53a5c
/*/// #### nk_layout_widget_bounds
Ivan Mahonin b53a5c
/// Returns the width of the next row allocate by one of the layouting functions
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// struct nk_rect nk_layout_widget_bounds(struct nk_context*);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Return `nk_rect` with both position and size of the next row
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API struct nk_rect nk_layout_widget_bounds(struct nk_context*);
Ivan Mahonin b53a5c
/*/// #### nk_layout_ratio_from_pixel
Ivan Mahonin b53a5c
/// Utility functions to calculate window ratio from pixel size
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// float nk_layout_ratio_from_pixel(struct nk_context*, float pixel_width);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
Ivan Mahonin b53a5c
/// __pixel__   | Pixel_width to convert to window ratio
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns `nk_rect` with both position and size of the next row
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API float nk_layout_ratio_from_pixel(struct nk_context*, float pixel_width);
Ivan Mahonin b53a5c
/*/// #### nk_layout_row_dynamic
Ivan Mahonin b53a5c
/// Sets current row layout to share horizontal space
Ivan Mahonin b53a5c
/// between @cols number of widgets evenly. Once called all subsequent widget
Ivan Mahonin b53a5c
/// calls greater than @cols will allocate a new row with same layout.
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_layout_row_dynamic(struct nk_context *ctx, float height, int cols);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
Ivan Mahonin b53a5c
/// __height__  | Holds height of each widget in row or zero for auto layouting
Ivan Mahonin b53a5c
/// __columns__ | Number of widget inside row
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_layout_row_dynamic(struct nk_context *ctx, float height, int cols);
Ivan Mahonin b53a5c
/*/// #### nk_layout_row_static
Ivan Mahonin b53a5c
/// Sets current row layout to fill @cols number of widgets
Ivan Mahonin b53a5c
/// in row with same @item_width horizontal size. Once called all subsequent widget
Ivan Mahonin b53a5c
/// calls greater than @cols will allocate a new row with same layout.
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_layout_row_static(struct nk_context *ctx, float height, int item_width, int cols);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
Ivan Mahonin b53a5c
/// __height__  | Holds height of each widget in row or zero for auto layouting
Ivan Mahonin b53a5c
/// __width__   | Holds pixel width of each widget in the row
Ivan Mahonin b53a5c
/// __columns__ | Number of widget inside row
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_layout_row_static(struct nk_context *ctx, float height, int item_width, int cols);
Ivan Mahonin b53a5c
/*/// #### nk_layout_row_begin
Ivan Mahonin b53a5c
/// Starts a new dynamic or fixed row with given height and columns.
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_layout_row_begin(struct nk_context *ctx, enum nk_layout_format fmt, float row_height, int cols);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
Ivan Mahonin b53a5c
/// __fmt__     | either `NK_DYNAMIC` for window ratio or `NK_STATIC` for fixed size columns
Ivan Mahonin b53a5c
/// __height__  | holds height of each widget in row or zero for auto layouting
Ivan Mahonin b53a5c
/// __columns__ | Number of widget inside row
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_layout_row_begin(struct nk_context *ctx, enum nk_layout_format fmt, float row_height, int cols);
Ivan Mahonin b53a5c
/*/// #### nk_layout_row_push
Ivan Mahonin b53a5c
/// Specifies either window ratio or width of a single column
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_layout_row_push(struct nk_context*, float value);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
Ivan Mahonin b53a5c
/// __value__   | either a window ratio or fixed width depending on @fmt in previous `nk_layout_row_begin` call
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_layout_row_push(struct nk_context*, float value);
Ivan Mahonin b53a5c
/*/// #### nk_layout_row_end
Ivan Mahonin b53a5c
/// Finished previously started row
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_layout_row_end(struct nk_context*);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_layout_row_end(struct nk_context*);
Ivan Mahonin b53a5c
/*/// #### nk_layout_row
Ivan Mahonin b53a5c
/// Specifies row columns in array as either window ratio or size
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_layout_row(struct nk_context*, enum nk_layout_format, float height, int cols, const float *ratio);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
Ivan Mahonin b53a5c
/// __fmt__     | Either `NK_DYNAMIC` for window ratio or `NK_STATIC` for fixed size columns
Ivan Mahonin b53a5c
/// __height__  | Holds height of each widget in row or zero for auto layouting
Ivan Mahonin b53a5c
/// __columns__ | Number of widget inside row
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_layout_row(struct nk_context*, enum nk_layout_format, float height, int cols, const float *ratio);
Ivan Mahonin b53a5c
/*/// #### nk_layout_row_template_begin
Ivan Mahonin b53a5c
/// Begins the row template declaration
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_layout_row_template_begin(struct nk_context*, float row_height);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
Ivan Mahonin b53a5c
/// __height__  | Holds height of each widget in row or zero for auto layouting
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_layout_row_template_begin(struct nk_context*, float row_height);
Ivan Mahonin b53a5c
/*/// #### nk_layout_row_template_push_dynamic
Ivan Mahonin b53a5c
/// Adds a dynamic column that dynamically grows and can go to zero if not enough space
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_layout_row_template_push_dynamic(struct nk_context*);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
Ivan Mahonin b53a5c
/// __height__  | Holds height of each widget in row or zero for auto layouting
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_layout_row_template_push_dynamic(struct nk_context*);
Ivan Mahonin b53a5c
/*/// #### nk_layout_row_template_push_variable
Ivan Mahonin b53a5c
/// Adds a variable column that dynamically grows but does not shrink below specified pixel width
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_layout_row_template_push_variable(struct nk_context*, float min_width);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
Ivan Mahonin b53a5c
/// __width__   | Holds the minimum pixel width the next column must always be
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_layout_row_template_push_variable(struct nk_context*, float min_width);
Ivan Mahonin b53a5c
/*/// #### nk_layout_row_template_push_static
Ivan Mahonin b53a5c
/// Adds a static column that does not grow and will always have the same size
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_layout_row_template_push_static(struct nk_context*, float width);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
Ivan Mahonin b53a5c
/// __width__   | Holds the absolute pixel width value the next column must be
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_layout_row_template_push_static(struct nk_context*, float width);
Ivan Mahonin b53a5c
/*/// #### nk_layout_row_template_end
Ivan Mahonin b53a5c
/// Marks the end of the row template
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_layout_row_template_end(struct nk_context*);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_layout_row_template_end(struct nk_context*);
Ivan Mahonin b53a5c
/*/// #### nk_layout_space_begin
Ivan Mahonin b53a5c
/// Begins a new layouting space that allows to specify each widgets position and size.
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_layout_space_begin(struct nk_context*, enum nk_layout_format, float height, int widget_count);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_begin_xxx`
Ivan Mahonin b53a5c
/// __fmt__     | Either `NK_DYNAMIC` for window ratio or `NK_STATIC` for fixed size columns
Ivan Mahonin b53a5c
/// __height__  | Holds height of each widget in row or zero for auto layouting
Ivan Mahonin b53a5c
/// __columns__ | Number of widgets inside row
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_layout_space_begin(struct nk_context*, enum nk_layout_format, float height, int widget_count);
Ivan Mahonin b53a5c
/*/// #### nk_layout_space_push
Ivan Mahonin b53a5c
/// Pushes position and size of the next widget in own coordinate space either as pixel or ratio
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_layout_space_push(struct nk_context *ctx, struct nk_rect bounds);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin`
Ivan Mahonin b53a5c
/// __bounds__  | Position and size in laoyut space local coordinates
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_layout_space_push(struct nk_context*, struct nk_rect bounds);
Ivan Mahonin b53a5c
/*/// #### nk_layout_space_end
Ivan Mahonin b53a5c
/// Marks the end of the layout space
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_layout_space_end(struct nk_context*);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin`
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_layout_space_end(struct nk_context*);
Ivan Mahonin b53a5c
/*/// #### nk_layout_space_bounds
Ivan Mahonin b53a5c
/// Utility function to calculate total space allocated for `nk_layout_space`
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// struct nk_rect nk_layout_space_bounds(struct nk_context*);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin`
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns `nk_rect` holding the total space allocated
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API struct nk_rect nk_layout_space_bounds(struct nk_context*);
Ivan Mahonin b53a5c
/*/// #### nk_layout_space_to_screen
Ivan Mahonin b53a5c
/// Converts vector from nk_layout_space coordinate space into screen space
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// struct nk_vec2 nk_layout_space_to_screen(struct nk_context*, struct nk_vec2);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin`
Ivan Mahonin b53a5c
/// __vec__     | Position to convert from layout space into screen coordinate space
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns transformed `nk_vec2` in screen space coordinates
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API struct nk_vec2 nk_layout_space_to_screen(struct nk_context*, struct nk_vec2);
Ivan Mahonin b53a5c
/*/// #### nk_layout_space_to_local
Ivan Mahonin b53a5c
/// Converts vector from layout space into screen space
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// struct nk_vec2 nk_layout_space_to_local(struct nk_context*, struct nk_vec2);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin`
Ivan Mahonin b53a5c
/// __vec__     | Position to convert from screen space into layout coordinate space
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns transformed `nk_vec2` in layout space coordinates
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API struct nk_vec2 nk_layout_space_to_local(struct nk_context*, struct nk_vec2);
Ivan Mahonin b53a5c
/*/// #### nk_layout_space_rect_to_screen
Ivan Mahonin b53a5c
/// Converts rectangle from screen space into layout space
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// struct nk_rect nk_layout_space_rect_to_screen(struct nk_context*, struct nk_rect);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin`
Ivan Mahonin b53a5c
/// __bounds__  | Rectangle to convert from layout space into screen space
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns transformed `nk_rect` in screen space coordinates
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API struct nk_rect nk_layout_space_rect_to_screen(struct nk_context*, struct nk_rect);
Ivan Mahonin b53a5c
/*/// #### nk_layout_space_rect_to_local
Ivan Mahonin b53a5c
/// Converts rectangle from layout space into screen space
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// struct nk_rect nk_layout_space_rect_to_local(struct nk_context*, struct nk_rect);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin`
Ivan Mahonin b53a5c
/// __bounds__  | Rectangle to convert from layout space into screen space
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns transformed `nk_rect` in layout space coordinates
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API struct nk_rect nk_layout_space_rect_to_local(struct nk_context*, struct nk_rect);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/*/// #### nk_spacer
Ivan Mahonin b53a5c
/// Spacer is a dummy widget that consumes space as usual but doesn't draw anything
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_spacer(struct nk_context* );
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after call `nk_layout_space_begin`
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_spacer(struct nk_context* );
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  GROUP
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * =============================================================================
Ivan Mahonin b53a5c
/// ### Groups
Ivan Mahonin b53a5c
/// Groups are basically windows inside windows. They allow to subdivide space
Ivan Mahonin b53a5c
/// in a window to layout widgets as a group. Almost all more complex widget
Ivan Mahonin b53a5c
/// layouting requirements can be solved using groups and basic layouting
Ivan Mahonin b53a5c
/// fuctionality. Groups just like windows are identified by an unique name and
Ivan Mahonin b53a5c
/// internally keep track of scrollbar offsets by default. However additional
Ivan Mahonin b53a5c
/// versions are provided to directly manage the scrollbar.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### Usage
Ivan Mahonin b53a5c
/// To create a group you have to call one of the three `nk_group_begin_xxx`
Ivan Mahonin b53a5c
/// functions to start group declarations and `nk_group_end` at the end. Furthermore it
Ivan Mahonin b53a5c
/// is required to check the return value of `nk_group_begin_xxx` and only process
Ivan Mahonin b53a5c
/// widgets inside the window if the value is not 0.
Ivan Mahonin b53a5c
/// Nesting groups is possible and even encouraged since many layouting schemes
Ivan Mahonin b53a5c
/// can only be achieved by nesting. Groups, unlike windows, need `nk_group_end`
Ivan Mahonin b53a5c
/// to be only called if the corresponding `nk_group_begin_xxx` call does not return 0:
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// if (nk_group_begin_xxx(ctx, ...) {
Ivan Mahonin b53a5c
///     // [... widgets ...]
Ivan Mahonin b53a5c
///     nk_group_end(ctx);
Ivan Mahonin b53a5c
/// }
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// In the grand concept groups can be called after starting a window
Ivan Mahonin b53a5c
/// with `nk_begin_xxx` and before calling `nk_end`:
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// struct nk_context ctx;
Ivan Mahonin b53a5c
/// nk_init_xxx(&ctx, ...);
Ivan Mahonin b53a5c
/// while (1) {
Ivan Mahonin b53a5c
///     // Input
Ivan Mahonin b53a5c
///     Event evt;
Ivan Mahonin b53a5c
///     nk_input_begin(&ctx);
Ivan Mahonin b53a5c
///     while (GetEvent(&evt)) {
Ivan Mahonin b53a5c
///         if (evt.type == MOUSE_MOVE)
Ivan Mahonin b53a5c
///             nk_input_motion(&ctx, evt.motion.x, evt.motion.y);
Ivan Mahonin b53a5c
///         else if (evt.type == [...]) {
Ivan Mahonin b53a5c
///             nk_input_xxx(...);
Ivan Mahonin b53a5c
///         }
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_input_end(&ctx);
Ivan Mahonin b53a5c
///     //
Ivan Mahonin b53a5c
///     // Window
Ivan Mahonin b53a5c
///     if (nk_begin_xxx(...) {
Ivan Mahonin b53a5c
///         // [...widgets...]
Ivan Mahonin b53a5c
///         nk_layout_row_dynamic(...);
Ivan Mahonin b53a5c
///         if (nk_group_begin_xxx(ctx, ...) {
Ivan Mahonin b53a5c
///             //[... widgets ...]
Ivan Mahonin b53a5c
///             nk_group_end(ctx);
Ivan Mahonin b53a5c
///         }
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_end(ctx);
Ivan Mahonin b53a5c
///     //
Ivan Mahonin b53a5c
///     // Draw
Ivan Mahonin b53a5c
///     const struct nk_command *cmd = 0;
Ivan Mahonin b53a5c
///     nk_foreach(cmd, &ctx) {
Ivan Mahonin b53a5c
///     switch (cmd->type) {
Ivan Mahonin b53a5c
///     case NK_COMMAND_LINE:
Ivan Mahonin b53a5c
///         your_draw_line_function(...)
Ivan Mahonin b53a5c
///         break;
Ivan Mahonin b53a5c
///     case NK_COMMAND_RECT
Ivan Mahonin b53a5c
///         your_draw_rect_function(...)
Ivan Mahonin b53a5c
///         break;
Ivan Mahonin b53a5c
///     case ...:
Ivan Mahonin b53a5c
///         // [...]
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_clear(&ctx);
Ivan Mahonin b53a5c
/// }
Ivan Mahonin b53a5c
/// nk_free(&ctx);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
/// #### Reference
Ivan Mahonin b53a5c
/// Function                        | Description
Ivan Mahonin b53a5c
/// --------------------------------|-------------------------------------------
Ivan Mahonin b53a5c
/// nk_group_begin                  | Start a new group with internal scrollbar handling
Ivan Mahonin b53a5c
/// nk_group_begin_titled           | Start a new group with separated name and title and internal scrollbar handling
Ivan Mahonin b53a5c
/// nk_group_end                    | Ends a group. Should only be called if nk_group_begin returned non-zero
Ivan Mahonin b53a5c
/// nk_group_scrolled_offset_begin  | Start a new group with manual separated handling of scrollbar x- and y-offset
Ivan Mahonin b53a5c
/// nk_group_scrolled_begin         | Start a new group with manual scrollbar handling
Ivan Mahonin b53a5c
/// nk_group_scrolled_end           | Ends a group with manual scrollbar handling. Should only be called if nk_group_begin returned non-zero
Ivan Mahonin b53a5c
/// nk_group_get_scroll             | Gets the scroll offset for the given group
Ivan Mahonin b53a5c
/// nk_group_set_scroll             | Sets the scroll offset for the given group
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
/*/// #### nk_group_begin
Ivan Mahonin b53a5c
/// Starts a new widget group. Requires a previous layouting function to specify a pos/size.
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// nk_bool nk_group_begin(struct nk_context*, const char *title, nk_flags);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __title__   | Must be an unique identifier for this group that is also used for the group header
Ivan Mahonin b53a5c
/// __flags__   | Window flags defined in the nk_panel_flags section with a number of different group behaviors
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API nk_bool nk_group_begin(struct nk_context*, const char *title, nk_flags);
Ivan Mahonin b53a5c
/*/// #### nk_group_begin_titled
Ivan Mahonin b53a5c
/// Starts a new widget group. Requires a previous layouting function to specify a pos/size.
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// nk_bool nk_group_begin_titled(struct nk_context*, const char *name, const char *title, nk_flags);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __id__      | Must be an unique identifier for this group
Ivan Mahonin b53a5c
/// __title__   | Group header title
Ivan Mahonin b53a5c
/// __flags__   | Window flags defined in the nk_panel_flags section with a number of different group behaviors
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API nk_bool nk_group_begin_titled(struct nk_context*, const char *name, const char *title, nk_flags);
Ivan Mahonin b53a5c
/*/// #### nk_group_end
Ivan Mahonin b53a5c
/// Ends a widget group
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_group_end(struct nk_context*);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_group_end(struct nk_context*);
Ivan Mahonin b53a5c
/*/// #### nk_group_scrolled_offset_begin
Ivan Mahonin b53a5c
/// starts a new widget group. requires a previous layouting function to specify
Ivan Mahonin b53a5c
/// a size. Does not keep track of scrollbar.
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// nk_bool nk_group_scrolled_offset_begin(struct nk_context*, nk_uint *x_offset, nk_uint *y_offset, const char *title, nk_flags flags);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __x_offset__| Scrollbar x-offset to offset all widgets inside the group horizontally.
Ivan Mahonin b53a5c
/// __y_offset__| Scrollbar y-offset to offset all widgets inside the group vertically
Ivan Mahonin b53a5c
/// __title__   | Window unique group title used to both identify and display in the group header
Ivan Mahonin b53a5c
/// __flags__   | Window flags from the nk_panel_flags section
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
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);
Ivan Mahonin b53a5c
/*/// #### nk_group_scrolled_begin
Ivan Mahonin b53a5c
/// Starts a new widget group. requires a previous
Ivan Mahonin b53a5c
/// layouting function to specify a size. Does not keep track of scrollbar.
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// nk_bool nk_group_scrolled_begin(struct nk_context*, struct nk_scroll *off, const char *title, nk_flags);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __off__     | Both x- and y- scroll offset. Allows for manual scrollbar control
Ivan Mahonin b53a5c
/// __title__   | Window unique group title used to both identify and display in the group header
Ivan Mahonin b53a5c
/// __flags__   | Window flags from nk_panel_flags section
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API nk_bool nk_group_scrolled_begin(struct nk_context*, struct nk_scroll *off, const char *title, nk_flags);
Ivan Mahonin b53a5c
/*/// #### nk_group_scrolled_end
Ivan Mahonin b53a5c
/// Ends a widget group after calling nk_group_scrolled_offset_begin or nk_group_scrolled_begin.
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_group_scrolled_end(struct nk_context*);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_group_scrolled_end(struct nk_context*);
Ivan Mahonin b53a5c
/*/// #### nk_group_get_scroll
Ivan Mahonin b53a5c
/// Gets the scroll position of the given group.
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_group_get_scroll(struct nk_context*, const char *id, nk_uint *x_offset, nk_uint *y_offset);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter    | Description
Ivan Mahonin b53a5c
/// -------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__      | Must point to an previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __id__       | The id of the group to get the scroll position of
Ivan Mahonin b53a5c
/// __x_offset__ | A pointer to the x offset output (or NULL to ignore)
Ivan Mahonin b53a5c
/// __y_offset__ | A pointer to the y offset output (or NULL to ignore)
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_group_get_scroll(struct nk_context*, const char *id, nk_uint *x_offset, nk_uint *y_offset);
Ivan Mahonin b53a5c
/*/// #### nk_group_set_scroll
Ivan Mahonin b53a5c
/// Sets the scroll position of the given group.
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_group_set_scroll(struct nk_context*, const char *id, nk_uint x_offset, nk_uint y_offset);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter    | Description
Ivan Mahonin b53a5c
/// -------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__      | Must point to an previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __id__       | The id of the group to scroll
Ivan Mahonin b53a5c
/// __x_offset__ | The x offset to scroll to
Ivan Mahonin b53a5c
/// __y_offset__ | The y offset to scroll to
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_group_set_scroll(struct nk_context*, const char *id, nk_uint x_offset, nk_uint y_offset);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  TREE
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * =============================================================================
Ivan Mahonin b53a5c
/// ### Tree
Ivan Mahonin b53a5c
/// Trees represent two different concept. First the concept of a collapsible
Ivan Mahonin b53a5c
/// UI section that can be either in a hidden or visible state. They allow the UI
Ivan Mahonin b53a5c
/// user to selectively minimize the current set of visible UI to comprehend.
Ivan Mahonin b53a5c
/// The second concept are tree widgets for visual UI representation of trees.

Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Trees thereby can be nested for tree representations and multiple nested
Ivan Mahonin b53a5c
/// collapsible UI sections. All trees are started by calling of the
Ivan Mahonin b53a5c
/// `nk_tree_xxx_push_tree` functions and ended by calling one of the
Ivan Mahonin b53a5c
/// `nk_tree_xxx_pop_xxx()` functions. Each starting functions takes a title label
Ivan Mahonin b53a5c
/// and optionally an image to be displayed and the initial collapse state from
Ivan Mahonin b53a5c
/// the nk_collapse_states section.

Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// The runtime state of the tree is either stored outside the library by the caller
Ivan Mahonin b53a5c
/// or inside which requires a unique ID. The unique ID can either be generated
Ivan Mahonin b53a5c
/// automatically from `__FILE__` and `__LINE__` with function `nk_tree_push`,
Ivan Mahonin b53a5c
/// by `__FILE__` and a user provided ID generated for example by loop index with
Ivan Mahonin b53a5c
/// function `nk_tree_push_id` or completely provided from outside by user with
Ivan Mahonin b53a5c
/// function `nk_tree_push_hashed`.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### Usage
Ivan Mahonin b53a5c
/// To create a tree you have to call one of the seven `nk_tree_xxx_push_xxx`
Ivan Mahonin b53a5c
/// functions to start a collapsible UI section and `nk_tree_xxx_pop` to mark the
Ivan Mahonin b53a5c
/// end.
Ivan Mahonin b53a5c
/// Each starting function will either return `false(0)` if the tree is collapsed
Ivan Mahonin b53a5c
/// or hidden and therefore does not need to be filled with content or `true(1)`
Ivan Mahonin b53a5c
/// if visible and required to be filled.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// !!! Note
Ivan Mahonin b53a5c
///     The tree header does not require and layouting function and instead
Ivan Mahonin b53a5c
///     calculates a auto height based on the currently used font size
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// The tree ending functions only need to be called if the tree content is
Ivan Mahonin b53a5c
/// actually visible. So make sure the tree push function is guarded by `if`
Ivan Mahonin b53a5c
/// and the pop call is only taken if the tree is visible.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// if (nk_tree_push(ctx, NK_TREE_TAB, "Tree", NK_MINIMIZED)) {
Ivan Mahonin b53a5c
///     nk_layout_row_dynamic(...);
Ivan Mahonin b53a5c
///     nk_widget(...);
Ivan Mahonin b53a5c
///     nk_tree_pop(ctx);
Ivan Mahonin b53a5c
/// }
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### Reference
Ivan Mahonin b53a5c
/// Function                    | Description
Ivan Mahonin b53a5c
/// ----------------------------|-------------------------------------------
Ivan Mahonin b53a5c
/// nk_tree_push                | Start a collapsible UI section with internal state management
Ivan Mahonin b53a5c
/// nk_tree_push_id             | Start a collapsible UI section with internal state management callable in a look
Ivan Mahonin b53a5c
/// nk_tree_push_hashed         | Start a collapsible UI section with internal state management with full control over internal unique ID use to store state
Ivan Mahonin b53a5c
/// nk_tree_image_push          | Start a collapsible UI section with image and label header
Ivan Mahonin b53a5c
/// nk_tree_image_push_id       | Start a collapsible UI section with image and label header and internal state management callable in a look
Ivan Mahonin b53a5c
/// nk_tree_image_push_hashed   | Start a collapsible UI section with image and label header and internal state management with full control over internal unique ID use to store state
Ivan Mahonin b53a5c
/// nk_tree_pop                 | Ends a collapsible UI section
Ivan Mahonin b53a5c
//
Ivan Mahonin b53a5c
/// nk_tree_state_push          | Start a collapsible UI section with external state management
Ivan Mahonin b53a5c
/// nk_tree_state_image_push    | Start a collapsible UI section with image and label header and external state management
Ivan Mahonin b53a5c
/// nk_tree_state_pop           | Ends a collapsabale UI section
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### nk_tree_type
Ivan Mahonin b53a5c
/// Flag            | Description
Ivan Mahonin b53a5c
/// ----------------|----------------------------------------
Ivan Mahonin b53a5c
/// NK_TREE_NODE    | Highlighted tree header to mark a collapsible UI section
Ivan Mahonin b53a5c
/// NK_TREE_TAB     | Non-highlighted tree header closer to tree representations
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
/*/// #### nk_tree_push
Ivan Mahonin b53a5c
/// Starts a collapsible UI section with internal state management
Ivan Mahonin b53a5c
/// !!! WARNING
Ivan Mahonin b53a5c
///     To keep track of the runtime tree collapsible state this function uses
Ivan Mahonin b53a5c
///     defines `__FILE__` and `__LINE__` to generate a unique ID. If you want
Ivan Mahonin b53a5c
///     to call this function in a loop please use `nk_tree_push_id` or
Ivan Mahonin b53a5c
///     `nk_tree_push_hashed` instead.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// #define nk_tree_push(ctx, type, title, state)
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __type__    | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node
Ivan Mahonin b53a5c
/// __title__   | Label printed in the tree header
Ivan Mahonin b53a5c
/// __state__   | Initial tree state value out of nk_collapse_states
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
#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__)
Ivan Mahonin b53a5c
/*/// #### nk_tree_push_id
Ivan Mahonin b53a5c
/// Starts a collapsible UI section with internal state management callable in a look
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// #define nk_tree_push_id(ctx, type, title, state, id)
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __type__    | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node
Ivan Mahonin b53a5c
/// __title__   | Label printed in the tree header
Ivan Mahonin b53a5c
/// __state__   | Initial tree state value out of nk_collapse_states
Ivan Mahonin b53a5c
/// __id__      | Loop counter index if this function is called in a loop
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
#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)
Ivan Mahonin b53a5c
/*/// #### nk_tree_push_hashed
Ivan Mahonin b53a5c
/// Start a collapsible UI section with internal state management with full
Ivan Mahonin b53a5c
/// control over internal unique ID used to store state
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// 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);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __type__    | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node
Ivan Mahonin b53a5c
/// __title__   | Label printed in the tree header
Ivan Mahonin b53a5c
/// __state__   | Initial tree state value out of nk_collapse_states
Ivan Mahonin b53a5c
/// __hash__    | Memory block or string to generate the ID from
Ivan Mahonin b53a5c
/// __len__     | Size of passed memory block or string in __hash__
Ivan Mahonin b53a5c
/// __seed__    | Seeding value if this function is called in a loop or default to `0`
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
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);
Ivan Mahonin b53a5c
/*/// #### nk_tree_image_push
Ivan Mahonin b53a5c
/// Start a collapsible UI section with image and label header
Ivan Mahonin b53a5c
/// !!! WARNING
Ivan Mahonin b53a5c
///     To keep track of the runtime tree collapsible state this function uses
Ivan Mahonin b53a5c
///     defines `__FILE__` and `__LINE__` to generate a unique ID. If you want
Ivan Mahonin b53a5c
///     to call this function in a loop please use `nk_tree_image_push_id` or
Ivan Mahonin b53a5c
///     `nk_tree_image_push_hashed` instead.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// #define nk_tree_image_push(ctx, type, img, title, state)
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
//
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __type__    | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node
Ivan Mahonin b53a5c
/// __img__     | Image to display inside the header on the left of the label
Ivan Mahonin b53a5c
/// __title__   | Label printed in the tree header
Ivan Mahonin b53a5c
/// __state__   | Initial tree state value out of nk_collapse_states
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
#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__)
Ivan Mahonin b53a5c
/*/// #### nk_tree_image_push_id
Ivan Mahonin b53a5c
/// Start a collapsible UI section with image and label header and internal state
Ivan Mahonin b53a5c
/// management callable in a look
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// #define nk_tree_image_push_id(ctx, type, img, title, state, id)
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __type__    | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node
Ivan Mahonin b53a5c
/// __img__     | Image to display inside the header on the left of the label
Ivan Mahonin b53a5c
/// __title__   | Label printed in the tree header
Ivan Mahonin b53a5c
/// __state__   | Initial tree state value out of nk_collapse_states
Ivan Mahonin b53a5c
/// __id__      | Loop counter index if this function is called in a loop
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
#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)
Ivan Mahonin b53a5c
/*/// #### nk_tree_image_push_hashed
Ivan Mahonin b53a5c
/// Start a collapsible UI section with internal state management with full
Ivan Mahonin b53a5c
/// control over internal unique ID used to store state
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// 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);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct
Ivan Mahonin b53a5c
/// __type__    | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node
Ivan Mahonin b53a5c
/// __img__     | Image to display inside the header on the left of the label
Ivan Mahonin b53a5c
/// __title__   | Label printed in the tree header
Ivan Mahonin b53a5c
/// __state__   | Initial tree state value out of nk_collapse_states
Ivan Mahonin b53a5c
/// __hash__    | Memory block or string to generate the ID from
Ivan Mahonin b53a5c
/// __len__     | Size of passed memory block or string in __hash__
Ivan Mahonin b53a5c
/// __seed__    | Seeding value if this function is called in a loop or default to `0`
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
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);
Ivan Mahonin b53a5c
/*/// #### nk_tree_pop
Ivan Mahonin b53a5c
/// Ends a collapsabale UI section
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_tree_pop(struct nk_context*);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after calling `nk_tree_xxx_push_xxx`
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_tree_pop(struct nk_context*);
Ivan Mahonin b53a5c
/*/// #### nk_tree_state_push
Ivan Mahonin b53a5c
/// Start a collapsible UI section with external state management
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// nk_bool nk_tree_state_push(struct nk_context*, enum nk_tree_type, const char *title, enum nk_collapse_states *state);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after calling `nk_tree_xxx_push_xxx`
Ivan Mahonin b53a5c
/// __type__    | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node
Ivan Mahonin b53a5c
/// __title__   | Label printed in the tree header
Ivan Mahonin b53a5c
/// __state__   | Persistent state to update
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API nk_bool nk_tree_state_push(struct nk_context*, enum nk_tree_type, const char *title, enum nk_collapse_states *state);
Ivan Mahonin b53a5c
/*/// #### nk_tree_state_image_push
Ivan Mahonin b53a5c
/// Start a collapsible UI section with image and label header and external state management
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// 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);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after calling `nk_tree_xxx_push_xxx`
Ivan Mahonin b53a5c
/// __img__     | Image to display inside the header on the left of the label
Ivan Mahonin b53a5c
/// __type__    | Value from the nk_tree_type section to visually mark a tree node header as either a collapseable UI section or tree node
Ivan Mahonin b53a5c
/// __title__   | Label printed in the tree header
Ivan Mahonin b53a5c
/// __state__   | Persistent state to update
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns `true(1)` if visible and fillable with widgets or `false(0)` otherwise
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
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);
Ivan Mahonin b53a5c
/*/// #### nk_tree_state_pop
Ivan Mahonin b53a5c
/// Ends a collapsabale UI section
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_tree_state_pop(struct nk_context*);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter   | Description
Ivan Mahonin b53a5c
/// ------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__     | Must point to an previously initialized `nk_context` struct after calling `nk_tree_xxx_push_xxx`
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_tree_state_pop(struct nk_context*);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#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__)
Ivan Mahonin b53a5c
#define nk_tree_element_push_id(ctx, type, title, state, sel, id) nk_tree_element_push_hashed(ctx, type, title, state, sel, NK_FILE_LINE,nk_strlen(NK_FILE_LINE),id)
Ivan Mahonin b53a5c
NK_API nk_bool nk_tree_element_push_hashed(struct nk_context*, enum nk_tree_type, const char *title, enum nk_collapse_states initial_state, nk_bool *selected, const char *hash, int len, int seed);
Ivan Mahonin b53a5c
NK_API nk_bool nk_tree_element_image_push_hashed(struct nk_context*, enum nk_tree_type, struct nk_image, const char *title, enum nk_collapse_states initial_state, nk_bool *selected, const char *hash, int len,int seed);
Ivan Mahonin b53a5c
NK_API void nk_tree_element_pop(struct nk_context*);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  LIST VIEW
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
struct nk_list_view {
Ivan Mahonin b53a5c
/* public: */
Ivan Mahonin b53a5c
    int begin, end, count;
Ivan Mahonin b53a5c
/* private: */
Ivan Mahonin b53a5c
    int total_height;
Ivan Mahonin b53a5c
    struct nk_context *ctx;
Ivan Mahonin b53a5c
    nk_uint *scroll_pointer;
Ivan Mahonin b53a5c
    nk_uint scroll_value;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
NK_API nk_bool nk_list_view_begin(struct nk_context*, struct nk_list_view *out, const char *id, nk_flags, int row_height, int row_count);
Ivan Mahonin b53a5c
NK_API void nk_list_view_end(struct nk_list_view*);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  WIDGET
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
enum nk_widget_layout_states {
Ivan Mahonin b53a5c
    NK_WIDGET_INVALID, /* The widget cannot be seen and is completely out of view */
Ivan Mahonin b53a5c
    NK_WIDGET_VALID, /* The widget is completely inside the window and can be updated and drawn */
Ivan Mahonin b53a5c
    NK_WIDGET_ROM /* The widget is partially visible and cannot be updated */
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
enum nk_widget_states {
Ivan Mahonin b53a5c
    NK_WIDGET_STATE_MODIFIED    = NK_FLAG(1),
Ivan Mahonin b53a5c
    NK_WIDGET_STATE_INACTIVE    = NK_FLAG(2), /* widget is neither active nor hovered */
Ivan Mahonin b53a5c
    NK_WIDGET_STATE_ENTERED     = NK_FLAG(3), /* widget has been hovered on the current frame */
Ivan Mahonin b53a5c
    NK_WIDGET_STATE_HOVER       = NK_FLAG(4), /* widget is being hovered */
Ivan Mahonin b53a5c
    NK_WIDGET_STATE_ACTIVED     = NK_FLAG(5),/* widget is currently activated */
Ivan Mahonin b53a5c
    NK_WIDGET_STATE_LEFT        = NK_FLAG(6), /* widget is from this frame on not hovered anymore */
Ivan Mahonin b53a5c
    NK_WIDGET_STATE_HOVERED     = NK_WIDGET_STATE_HOVER|NK_WIDGET_STATE_MODIFIED, /* widget is being hovered */
Ivan Mahonin b53a5c
    NK_WIDGET_STATE_ACTIVE      = NK_WIDGET_STATE_ACTIVED|NK_WIDGET_STATE_MODIFIED /* widget is currently activated */
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
NK_API enum nk_widget_layout_states nk_widget(struct nk_rect*, const struct nk_context*);
Ivan Mahonin b53a5c
NK_API enum nk_widget_layout_states nk_widget_fitting(struct nk_rect*, struct nk_context*, struct nk_vec2);
Ivan Mahonin b53a5c
NK_API struct nk_rect nk_widget_bounds(struct nk_context*);
Ivan Mahonin b53a5c
NK_API struct nk_vec2 nk_widget_position(struct nk_context*);
Ivan Mahonin b53a5c
NK_API struct nk_vec2 nk_widget_size(struct nk_context*);
Ivan Mahonin b53a5c
NK_API float nk_widget_width(struct nk_context*);
Ivan Mahonin b53a5c
NK_API float nk_widget_height(struct nk_context*);
Ivan Mahonin b53a5c
NK_API nk_bool nk_widget_is_hovered(struct nk_context*);
Ivan Mahonin b53a5c
NK_API nk_bool nk_widget_is_mouse_clicked(struct nk_context*, enum nk_buttons);
Ivan Mahonin b53a5c
NK_API nk_bool nk_widget_has_mouse_click_down(struct nk_context*, enum nk_buttons, nk_bool down);
Ivan Mahonin b53a5c
NK_API void nk_spacing(struct nk_context*, int cols);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  TEXT
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
enum nk_text_align {
Ivan Mahonin b53a5c
    NK_TEXT_ALIGN_LEFT        = 0x01,
Ivan Mahonin b53a5c
    NK_TEXT_ALIGN_CENTERED    = 0x02,
Ivan Mahonin b53a5c
    NK_TEXT_ALIGN_RIGHT       = 0x04,
Ivan Mahonin b53a5c
    NK_TEXT_ALIGN_TOP         = 0x08,
Ivan Mahonin b53a5c
    NK_TEXT_ALIGN_MIDDLE      = 0x10,
Ivan Mahonin b53a5c
    NK_TEXT_ALIGN_BOTTOM      = 0x20
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
enum nk_text_alignment {
Ivan Mahonin b53a5c
    NK_TEXT_LEFT        = NK_TEXT_ALIGN_MIDDLE|NK_TEXT_ALIGN_LEFT,
Ivan Mahonin b53a5c
    NK_TEXT_CENTERED    = NK_TEXT_ALIGN_MIDDLE|NK_TEXT_ALIGN_CENTERED,
Ivan Mahonin b53a5c
    NK_TEXT_RIGHT       = NK_TEXT_ALIGN_MIDDLE|NK_TEXT_ALIGN_RIGHT
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
NK_API void nk_text(struct nk_context*, const char*, int, nk_flags);
Ivan Mahonin b53a5c
NK_API void nk_text_colored(struct nk_context*, const char*, int, nk_flags, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_text_wrap(struct nk_context*, const char*, int);
Ivan Mahonin b53a5c
NK_API void nk_text_wrap_colored(struct nk_context*, const char*, int, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_label(struct nk_context*, const char*, nk_flags align);
Ivan Mahonin b53a5c
NK_API void nk_label_colored(struct nk_context*, const char*, nk_flags align, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_label_wrap(struct nk_context*, const char*);
Ivan Mahonin b53a5c
NK_API void nk_label_colored_wrap(struct nk_context*, const char*, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_image(struct nk_context*, struct nk_image);
Ivan Mahonin b53a5c
NK_API void nk_image_color(struct nk_context*, struct nk_image, struct nk_color);
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_STANDARD_VARARGS
Ivan Mahonin b53a5c
NK_API void nk_labelf(struct nk_context*, nk_flags, NK_PRINTF_FORMAT_STRING const char*, ...) NK_PRINTF_VARARG_FUNC(3);
Ivan Mahonin b53a5c
NK_API void nk_labelf_colored(struct nk_context*, nk_flags, struct nk_color, NK_PRINTF_FORMAT_STRING const char*,...) NK_PRINTF_VARARG_FUNC(4);
Ivan Mahonin b53a5c
NK_API void nk_labelf_wrap(struct nk_context*, NK_PRINTF_FORMAT_STRING const char*,...) NK_PRINTF_VARARG_FUNC(2);
Ivan Mahonin b53a5c
NK_API void nk_labelf_colored_wrap(struct nk_context*, struct nk_color, NK_PRINTF_FORMAT_STRING const char*,...) NK_PRINTF_VARARG_FUNC(3);
Ivan Mahonin b53a5c
NK_API void nk_labelfv(struct nk_context*, nk_flags, NK_PRINTF_FORMAT_STRING const char*, va_list) NK_PRINTF_VALIST_FUNC(3);
Ivan Mahonin b53a5c
NK_API void nk_labelfv_colored(struct nk_context*, nk_flags, struct nk_color, NK_PRINTF_FORMAT_STRING const char*, va_list) NK_PRINTF_VALIST_FUNC(4);
Ivan Mahonin b53a5c
NK_API void nk_labelfv_wrap(struct nk_context*, NK_PRINTF_FORMAT_STRING const char*, va_list) NK_PRINTF_VALIST_FUNC(2);
Ivan Mahonin b53a5c
NK_API void nk_labelfv_colored_wrap(struct nk_context*, struct nk_color, NK_PRINTF_FORMAT_STRING const char*, va_list) NK_PRINTF_VALIST_FUNC(3);
Ivan Mahonin b53a5c
NK_API void nk_value_bool(struct nk_context*, const char *prefix, int);
Ivan Mahonin b53a5c
NK_API void nk_value_int(struct nk_context*, const char *prefix, int);
Ivan Mahonin b53a5c
NK_API void nk_value_uint(struct nk_context*, const char *prefix, unsigned int);
Ivan Mahonin b53a5c
NK_API void nk_value_float(struct nk_context*, const char *prefix, float);
Ivan Mahonin b53a5c
NK_API void nk_value_color_byte(struct nk_context*, const char *prefix, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_value_color_float(struct nk_context*, const char *prefix, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_value_color_hex(struct nk_context*, const char *prefix, struct nk_color);
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  BUTTON
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_text(struct nk_context*, const char *title, int len);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_label(struct nk_context*, const char *title);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_color(struct nk_context*, struct nk_color);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_symbol(struct nk_context*, enum nk_symbol_type);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_image(struct nk_context*, struct nk_image img);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_symbol_label(struct nk_context*, enum nk_symbol_type, const char*, nk_flags text_alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_symbol_text(struct nk_context*, enum nk_symbol_type, const char*, int, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_image_label(struct nk_context*, struct nk_image img, const char*, nk_flags text_alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_image_text(struct nk_context*, struct nk_image img, const char*, int, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_text_styled(struct nk_context*, const struct nk_style_button*, const char *title, int len);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_label_styled(struct nk_context*, const struct nk_style_button*, const char *title);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_symbol_styled(struct nk_context*, const struct nk_style_button*, enum nk_symbol_type);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_image_styled(struct nk_context*, const struct nk_style_button*, struct nk_image img);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_symbol_text_styled(struct nk_context*,const struct nk_style_button*, enum nk_symbol_type, const char*, int, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_symbol_label_styled(struct nk_context *ctx, const struct nk_style_button *style, enum nk_symbol_type symbol, const char *title, nk_flags align);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_image_label_styled(struct nk_context*,const struct nk_style_button*, struct nk_image img, const char*, nk_flags text_alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_image_text_styled(struct nk_context*,const struct nk_style_button*, struct nk_image img, const char*, int, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API void nk_button_set_behavior(struct nk_context*, enum nk_button_behavior);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_push_behavior(struct nk_context*, enum nk_button_behavior);
Ivan Mahonin b53a5c
NK_API nk_bool nk_button_pop_behavior(struct nk_context*);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  CHECKBOX
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API nk_bool nk_check_label(struct nk_context*, const char*, nk_bool active);
Ivan Mahonin b53a5c
NK_API nk_bool nk_check_text(struct nk_context*, const char*, int, nk_bool active);
Ivan Mahonin b53a5c
NK_API unsigned nk_check_flags_label(struct nk_context*, const char*, unsigned int flags, unsigned int value);
Ivan Mahonin b53a5c
NK_API unsigned nk_check_flags_text(struct nk_context*, const char*, int, unsigned int flags, unsigned int value);
Ivan Mahonin b53a5c
NK_API nk_bool nk_checkbox_label(struct nk_context*, const char*, nk_bool *active);
Ivan Mahonin b53a5c
NK_API nk_bool nk_checkbox_text(struct nk_context*, const char*, int, nk_bool *active);
Ivan Mahonin b53a5c
NK_API nk_bool nk_checkbox_flags_label(struct nk_context*, const char*, unsigned int *flags, unsigned int value);
Ivan Mahonin b53a5c
NK_API nk_bool nk_checkbox_flags_text(struct nk_context*, const char*, int, unsigned int *flags, unsigned int value);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  RADIO BUTTON
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API nk_bool nk_radio_label(struct nk_context*, const char*, nk_bool *active);
Ivan Mahonin b53a5c
NK_API nk_bool nk_radio_text(struct nk_context*, const char*, int, nk_bool *active);
Ivan Mahonin b53a5c
NK_API nk_bool nk_option_label(struct nk_context*, const char*, nk_bool active);
Ivan Mahonin b53a5c
NK_API nk_bool nk_option_text(struct nk_context*, const char*, int, nk_bool active);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  SELECTABLE
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API nk_bool nk_selectable_label(struct nk_context*, const char*, nk_flags align, nk_bool *value);
Ivan Mahonin b53a5c
NK_API nk_bool nk_selectable_text(struct nk_context*, const char*, int, nk_flags align, nk_bool *value);
Ivan Mahonin b53a5c
NK_API nk_bool nk_selectable_image_label(struct nk_context*,struct nk_image,  const char*, nk_flags align, nk_bool *value);
Ivan Mahonin b53a5c
NK_API nk_bool nk_selectable_image_text(struct nk_context*,struct nk_image, const char*, int, nk_flags align, nk_bool *value);
Ivan Mahonin b53a5c
NK_API nk_bool nk_selectable_symbol_label(struct nk_context*,enum nk_symbol_type,  const char*, nk_flags align, nk_bool *value);
Ivan Mahonin b53a5c
NK_API nk_bool nk_selectable_symbol_text(struct nk_context*,enum nk_symbol_type, const char*, int, nk_flags align, nk_bool *value);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API nk_bool nk_select_label(struct nk_context*, const char*, nk_flags align, nk_bool value);
Ivan Mahonin b53a5c
NK_API nk_bool nk_select_text(struct nk_context*, const char*, int, nk_flags align, nk_bool value);
Ivan Mahonin b53a5c
NK_API nk_bool nk_select_image_label(struct nk_context*, struct nk_image,const char*, nk_flags align, nk_bool value);
Ivan Mahonin b53a5c
NK_API nk_bool nk_select_image_text(struct nk_context*, struct nk_image,const char*, int, nk_flags align, nk_bool value);
Ivan Mahonin b53a5c
NK_API nk_bool nk_select_symbol_label(struct nk_context*,enum nk_symbol_type,  const char*, nk_flags align, nk_bool value);
Ivan Mahonin b53a5c
NK_API nk_bool nk_select_symbol_text(struct nk_context*,enum nk_symbol_type, const char*, int, nk_flags align, nk_bool value);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  SLIDER
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API float nk_slide_float(struct nk_context*, float min, float val, float max, float step);
Ivan Mahonin b53a5c
NK_API int nk_slide_int(struct nk_context*, int min, int val, int max, int step);
Ivan Mahonin b53a5c
NK_API nk_bool nk_slider_float(struct nk_context*, float min, float *val, float max, float step);
Ivan Mahonin b53a5c
NK_API nk_bool nk_slider_int(struct nk_context*, int min, int *val, int max, int step);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  PROGRESSBAR
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API nk_bool nk_progress(struct nk_context*, nk_size *cur, nk_size max, nk_bool modifyable);
Ivan Mahonin b53a5c
NK_API nk_size nk_prog(struct nk_context*, nk_size cur, nk_size max, nk_bool modifyable);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  COLOR PICKER
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API struct nk_colorf nk_color_picker(struct nk_context*, struct nk_colorf, enum nk_color_format);
Ivan Mahonin b53a5c
NK_API nk_bool nk_color_pick(struct nk_context*, struct nk_colorf*, enum nk_color_format);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  PROPERTIES
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * =============================================================================
Ivan Mahonin b53a5c
/// ### Properties
Ivan Mahonin b53a5c
/// Properties are the main value modification widgets in Nuklear. Changing a value
Ivan Mahonin b53a5c
/// can be achieved by dragging, adding/removing incremental steps on button click
Ivan Mahonin b53a5c
/// or by directly typing a number.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### Usage
Ivan Mahonin b53a5c
/// Each property requires a unique name for identification that is also used for
Ivan Mahonin b53a5c
/// displaying a label. If you want to use the same name multiple times make sure
Ivan Mahonin b53a5c
/// add a '#' before your name. The '#' will not be shown but will generate a
Ivan Mahonin b53a5c
/// unique ID. Each property also takes in a minimum and maximum value. If you want
Ivan Mahonin b53a5c
/// to make use of the complete number range of a type just use the provided
Ivan Mahonin b53a5c
/// type limits from `limits.h`. For example `INT_MIN` and `INT_MAX` for
Ivan Mahonin b53a5c
/// `nk_property_int` and `nk_propertyi`. In additional each property takes in
Ivan Mahonin b53a5c
/// a increment value that will be added or subtracted if either the increment
Ivan Mahonin b53a5c
/// decrement button is clicked. Finally there is a value for increment per pixel
Ivan Mahonin b53a5c
/// dragged that is added or subtracted from the value.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// int value = 0;
Ivan Mahonin b53a5c
/// struct nk_context ctx;
Ivan Mahonin b53a5c
/// nk_init_xxx(&ctx, ...);
Ivan Mahonin b53a5c
/// while (1) {
Ivan Mahonin b53a5c
///     // Input
Ivan Mahonin b53a5c
///     Event evt;
Ivan Mahonin b53a5c
///     nk_input_begin(&ctx);
Ivan Mahonin b53a5c
///     while (GetEvent(&evt)) {
Ivan Mahonin b53a5c
///         if (evt.type == MOUSE_MOVE)
Ivan Mahonin b53a5c
///             nk_input_motion(&ctx, evt.motion.x, evt.motion.y);
Ivan Mahonin b53a5c
///         else if (evt.type == [...]) {
Ivan Mahonin b53a5c
///             nk_input_xxx(...);
Ivan Mahonin b53a5c
///         }
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_input_end(&ctx);
Ivan Mahonin b53a5c
///     //
Ivan Mahonin b53a5c
///     // Window
Ivan Mahonin b53a5c
///     if (nk_begin_xxx(...) {
Ivan Mahonin b53a5c
///         // Property
Ivan Mahonin b53a5c
///         nk_layout_row_dynamic(...);
Ivan Mahonin b53a5c
///         nk_property_int(ctx, "ID", INT_MIN, &value, INT_MAX, 1, 1);
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_end(ctx);
Ivan Mahonin b53a5c
///     //
Ivan Mahonin b53a5c
///     // Draw
Ivan Mahonin b53a5c
///     const struct nk_command *cmd = 0;
Ivan Mahonin b53a5c
///     nk_foreach(cmd, &ctx) {
Ivan Mahonin b53a5c
///     switch (cmd->type) {
Ivan Mahonin b53a5c
///     case NK_COMMAND_LINE:
Ivan Mahonin b53a5c
///         your_draw_line_function(...)
Ivan Mahonin b53a5c
///         break;
Ivan Mahonin b53a5c
///     case NK_COMMAND_RECT
Ivan Mahonin b53a5c
///         your_draw_rect_function(...)
Ivan Mahonin b53a5c
///         break;
Ivan Mahonin b53a5c
///     case ...:
Ivan Mahonin b53a5c
///         // [...]
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_clear(&ctx);
Ivan Mahonin b53a5c
/// }
Ivan Mahonin b53a5c
/// nk_free(&ctx);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### Reference
Ivan Mahonin b53a5c
/// Function            | Description
Ivan Mahonin b53a5c
/// --------------------|-------------------------------------------
Ivan Mahonin b53a5c
/// nk_property_int     | Integer property directly modifying a passed in value
Ivan Mahonin b53a5c
/// nk_property_float   | Float property directly modifying a passed in value
Ivan Mahonin b53a5c
/// nk_property_double  | Double property directly modifying a passed in value
Ivan Mahonin b53a5c
/// nk_propertyi        | Integer property returning the modified int value
Ivan Mahonin b53a5c
/// nk_propertyf        | Float property returning the modified float value
Ivan Mahonin b53a5c
/// nk_propertyd        | Double property returning the modified double value
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
/*/// #### nk_property_int
Ivan Mahonin b53a5c
/// Integer property directly modifying a passed in value
Ivan Mahonin b53a5c
/// !!! WARNING
Ivan Mahonin b53a5c
///     To generate a unique property ID using the same label make sure to insert
Ivan Mahonin b53a5c
///     a `#` at the beginning. It will not be shown but guarantees correct behavior.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_property_int(struct nk_context *ctx, const char *name, int min, int *val, int max, int step, float inc_per_pixel);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter           | Description
Ivan Mahonin b53a5c
/// --------------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__             | Must point to an previously initialized `nk_context` struct after calling a layouting function
Ivan Mahonin b53a5c
/// __name__            | String used both as a label as well as a unique identifier
Ivan Mahonin b53a5c
/// __min__             | Minimum value not allowed to be underflown
Ivan Mahonin b53a5c
/// __val__             | Integer pointer to be modified
Ivan Mahonin b53a5c
/// __max__             | Maximum value not allowed to be overflown
Ivan Mahonin b53a5c
/// __step__            | Increment added and subtracted on increment and decrement button
Ivan Mahonin b53a5c
/// __inc_per_pixel__   | Value per pixel added or subtracted on dragging
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_property_int(struct nk_context*, const char *name, int min, int *val, int max, int step, float inc_per_pixel);
Ivan Mahonin b53a5c
/*/// #### nk_property_float
Ivan Mahonin b53a5c
/// Float property directly modifying a passed in value
Ivan Mahonin b53a5c
/// !!! WARNING
Ivan Mahonin b53a5c
///     To generate a unique property ID using the same label make sure to insert
Ivan Mahonin b53a5c
///     a `#` at the beginning. It will not be shown but guarantees correct behavior.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_property_float(struct nk_context *ctx, const char *name, float min, float *val, float max, float step, float inc_per_pixel);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter           | Description
Ivan Mahonin b53a5c
/// --------------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__             | Must point to an previously initialized `nk_context` struct after calling a layouting function
Ivan Mahonin b53a5c
/// __name__            | String used both as a label as well as a unique identifier
Ivan Mahonin b53a5c
/// __min__             | Minimum value not allowed to be underflown
Ivan Mahonin b53a5c
/// __val__             | Float pointer to be modified
Ivan Mahonin b53a5c
/// __max__             | Maximum value not allowed to be overflown
Ivan Mahonin b53a5c
/// __step__            | Increment added and subtracted on increment and decrement button
Ivan Mahonin b53a5c
/// __inc_per_pixel__   | Value per pixel added or subtracted on dragging
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_property_float(struct nk_context*, const char *name, float min, float *val, float max, float step, float inc_per_pixel);
Ivan Mahonin b53a5c
/*/// #### nk_property_double
Ivan Mahonin b53a5c
/// Double property directly modifying a passed in value
Ivan Mahonin b53a5c
/// !!! WARNING
Ivan Mahonin b53a5c
///     To generate a unique property ID using the same label make sure to insert
Ivan Mahonin b53a5c
///     a `#` at the beginning. It will not be shown but guarantees correct behavior.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// void nk_property_double(struct nk_context *ctx, const char *name, double min, double *val, double max, double step, double inc_per_pixel);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter           | Description
Ivan Mahonin b53a5c
/// --------------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__             | Must point to an previously initialized `nk_context` struct after calling a layouting function
Ivan Mahonin b53a5c
/// __name__            | String used both as a label as well as a unique identifier
Ivan Mahonin b53a5c
/// __min__             | Minimum value not allowed to be underflown
Ivan Mahonin b53a5c
/// __val__             | Double pointer to be modified
Ivan Mahonin b53a5c
/// __max__             | Maximum value not allowed to be overflown
Ivan Mahonin b53a5c
/// __step__            | Increment added and subtracted on increment and decrement button
Ivan Mahonin b53a5c
/// __inc_per_pixel__   | Value per pixel added or subtracted on dragging
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API void nk_property_double(struct nk_context*, const char *name, double min, double *val, double max, double step, float inc_per_pixel);
Ivan Mahonin b53a5c
/*/// #### nk_propertyi
Ivan Mahonin b53a5c
/// Integer property modifying a passed in value and returning the new value
Ivan Mahonin b53a5c
/// !!! WARNING
Ivan Mahonin b53a5c
///     To generate a unique property ID using the same label make sure to insert
Ivan Mahonin b53a5c
///     a `#` at the beginning. It will not be shown but guarantees correct behavior.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// int nk_propertyi(struct nk_context *ctx, const char *name, int min, int val, int max, int step, float inc_per_pixel);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter           | Description
Ivan Mahonin b53a5c
/// --------------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__             | Must point to an previously initialized `nk_context` struct after calling a layouting function
Ivan Mahonin b53a5c
/// __name__            | String used both as a label as well as a unique identifier
Ivan Mahonin b53a5c
/// __min__             | Minimum value not allowed to be underflown
Ivan Mahonin b53a5c
/// __val__             | Current integer value to be modified and returned
Ivan Mahonin b53a5c
/// __max__             | Maximum value not allowed to be overflown
Ivan Mahonin b53a5c
/// __step__            | Increment added and subtracted on increment and decrement button
Ivan Mahonin b53a5c
/// __inc_per_pixel__   | Value per pixel added or subtracted on dragging
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns the new modified integer value
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API int nk_propertyi(struct nk_context*, const char *name, int min, int val, int max, int step, float inc_per_pixel);
Ivan Mahonin b53a5c
/*/// #### nk_propertyf
Ivan Mahonin b53a5c
/// Float property modifying a passed in value and returning the new value
Ivan Mahonin b53a5c
/// !!! WARNING
Ivan Mahonin b53a5c
///     To generate a unique property ID using the same label make sure to insert
Ivan Mahonin b53a5c
///     a `#` at the beginning. It will not be shown but guarantees correct behavior.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// float nk_propertyf(struct nk_context *ctx, const char *name, float min, float val, float max, float step, float inc_per_pixel);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter           | Description
Ivan Mahonin b53a5c
/// --------------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__             | Must point to an previously initialized `nk_context` struct after calling a layouting function
Ivan Mahonin b53a5c
/// __name__            | String used both as a label as well as a unique identifier
Ivan Mahonin b53a5c
/// __min__             | Minimum value not allowed to be underflown
Ivan Mahonin b53a5c
/// __val__             | Current float value to be modified and returned
Ivan Mahonin b53a5c
/// __max__             | Maximum value not allowed to be overflown
Ivan Mahonin b53a5c
/// __step__            | Increment added and subtracted on increment and decrement button
Ivan Mahonin b53a5c
/// __inc_per_pixel__   | Value per pixel added or subtracted on dragging
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns the new modified float value
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API float nk_propertyf(struct nk_context*, const char *name, float min, float val, float max, float step, float inc_per_pixel);
Ivan Mahonin b53a5c
/*/// #### nk_propertyd
Ivan Mahonin b53a5c
/// Float property modifying a passed in value and returning the new value
Ivan Mahonin b53a5c
/// !!! WARNING
Ivan Mahonin b53a5c
///     To generate a unique property ID using the same label make sure to insert
Ivan Mahonin b53a5c
///     a `#` at the beginning. It will not be shown but guarantees correct behavior.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c
Ivan Mahonin b53a5c
/// float nk_propertyd(struct nk_context *ctx, const char *name, double min, double val, double max, double step, double inc_per_pixel);
Ivan Mahonin b53a5c
/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Parameter           | Description
Ivan Mahonin b53a5c
/// --------------------|-----------------------------------------------------------
Ivan Mahonin b53a5c
/// __ctx__             | Must point to an previously initialized `nk_context` struct after calling a layouting function
Ivan Mahonin b53a5c
/// __name__            | String used both as a label as well as a unique identifier
Ivan Mahonin b53a5c
/// __min__             | Minimum value not allowed to be underflown
Ivan Mahonin b53a5c
/// __val__             | Current double value to be modified and returned
Ivan Mahonin b53a5c
/// __max__             | Maximum value not allowed to be overflown
Ivan Mahonin b53a5c
/// __step__            | Increment added and subtracted on increment and decrement button
Ivan Mahonin b53a5c
/// __inc_per_pixel__   | Value per pixel added or subtracted on dragging
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// Returns the new modified double value
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
NK_API double nk_propertyd(struct nk_context*, const char *name, double min, double val, double max, double step, float inc_per_pixel);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  TEXT EDIT
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
enum nk_edit_flags {
Ivan Mahonin b53a5c
    NK_EDIT_DEFAULT                 = 0,
Ivan Mahonin b53a5c
    NK_EDIT_READ_ONLY               = NK_FLAG(0),
Ivan Mahonin b53a5c
    NK_EDIT_AUTO_SELECT             = NK_FLAG(1),
Ivan Mahonin b53a5c
    NK_EDIT_SIG_ENTER               = NK_FLAG(2),
Ivan Mahonin b53a5c
    NK_EDIT_ALLOW_TAB               = NK_FLAG(3),
Ivan Mahonin b53a5c
    NK_EDIT_NO_CURSOR               = NK_FLAG(4),
Ivan Mahonin b53a5c
    NK_EDIT_SELECTABLE              = NK_FLAG(5),
Ivan Mahonin b53a5c
    NK_EDIT_CLIPBOARD               = NK_FLAG(6),
Ivan Mahonin b53a5c
    NK_EDIT_CTRL_ENTER_NEWLINE      = NK_FLAG(7),
Ivan Mahonin b53a5c
    NK_EDIT_NO_HORIZONTAL_SCROLL    = NK_FLAG(8),
Ivan Mahonin b53a5c
    NK_EDIT_ALWAYS_INSERT_MODE      = NK_FLAG(9),
Ivan Mahonin b53a5c
    NK_EDIT_MULTILINE               = NK_FLAG(10),
Ivan Mahonin b53a5c
    NK_EDIT_GOTO_END_ON_ACTIVATE    = NK_FLAG(11)
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
enum nk_edit_types {
Ivan Mahonin b53a5c
    NK_EDIT_SIMPLE  = NK_EDIT_ALWAYS_INSERT_MODE,
Ivan Mahonin b53a5c
    NK_EDIT_FIELD   = NK_EDIT_SIMPLE|NK_EDIT_SELECTABLE|NK_EDIT_CLIPBOARD,
Ivan Mahonin b53a5c
    NK_EDIT_BOX     = NK_EDIT_ALWAYS_INSERT_MODE| NK_EDIT_SELECTABLE| NK_EDIT_MULTILINE|NK_EDIT_ALLOW_TAB|NK_EDIT_CLIPBOARD,
Ivan Mahonin b53a5c
    NK_EDIT_EDITOR  = NK_EDIT_SELECTABLE|NK_EDIT_MULTILINE|NK_EDIT_ALLOW_TAB| NK_EDIT_CLIPBOARD
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
enum nk_edit_events {
Ivan Mahonin b53a5c
    NK_EDIT_ACTIVE      = NK_FLAG(0), /* edit widget is currently being modified */
Ivan Mahonin b53a5c
    NK_EDIT_INACTIVE    = NK_FLAG(1), /* edit widget is not active and is not being modified */
Ivan Mahonin b53a5c
    NK_EDIT_ACTIVATED   = NK_FLAG(2), /* edit widget went from state inactive to state active */
Ivan Mahonin b53a5c
    NK_EDIT_DEACTIVATED = NK_FLAG(3), /* edit widget went from state active to state inactive */
Ivan Mahonin b53a5c
    NK_EDIT_COMMITED    = NK_FLAG(4) /* edit widget has received an enter and lost focus */
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
NK_API nk_flags nk_edit_string(struct nk_context*, nk_flags, char *buffer, int *len, int max, nk_plugin_filter);
Ivan Mahonin b53a5c
NK_API nk_flags nk_edit_string_zero_terminated(struct nk_context*, nk_flags, char *buffer, int max, nk_plugin_filter);
Ivan Mahonin b53a5c
NK_API nk_flags nk_edit_buffer(struct nk_context*, nk_flags, struct nk_text_edit*, nk_plugin_filter);
Ivan Mahonin b53a5c
NK_API void nk_edit_focus(struct nk_context*, nk_flags flags);
Ivan Mahonin b53a5c
NK_API void nk_edit_unfocus(struct nk_context*);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  CHART
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API nk_bool nk_chart_begin(struct nk_context*, enum nk_chart_type, int num, float min, float max);
Ivan Mahonin b53a5c
NK_API nk_bool nk_chart_begin_colored(struct nk_context*, enum nk_chart_type, struct nk_color, struct nk_color active, int num, float min, float max);
Ivan Mahonin b53a5c
NK_API void nk_chart_add_slot(struct nk_context *ctx, const enum nk_chart_type, int count, float min_value, float max_value);
Ivan Mahonin b53a5c
NK_API void nk_chart_add_slot_colored(struct nk_context *ctx, const enum nk_chart_type, struct nk_color, struct nk_color active, int count, float min_value, float max_value);
Ivan Mahonin b53a5c
NK_API nk_flags nk_chart_push(struct nk_context*, float);
Ivan Mahonin b53a5c
NK_API nk_flags nk_chart_push_slot(struct nk_context*, float, int);
Ivan Mahonin b53a5c
NK_API void nk_chart_end(struct nk_context*);
Ivan Mahonin b53a5c
NK_API void nk_plot(struct nk_context*, enum nk_chart_type, const float *values, int count, int offset);
Ivan Mahonin b53a5c
NK_API void nk_plot_function(struct nk_context*, enum nk_chart_type, void *userdata, float(*value_getter)(void* user, int index), int count, int offset);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  POPUP
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API nk_bool nk_popup_begin(struct nk_context*, enum nk_popup_type, const char*, nk_flags, struct nk_rect bounds);
Ivan Mahonin b53a5c
NK_API void nk_popup_close(struct nk_context*);
Ivan Mahonin b53a5c
NK_API void nk_popup_end(struct nk_context*);
Ivan Mahonin b53a5c
NK_API void nk_popup_get_scroll(struct nk_context*, nk_uint *offset_x, nk_uint *offset_y);
Ivan Mahonin b53a5c
NK_API void nk_popup_set_scroll(struct nk_context*, nk_uint offset_x, nk_uint offset_y);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  COMBOBOX
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API int nk_combo(struct nk_context*, const char **items, int count, int selected, int item_height, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API int nk_combo_separator(struct nk_context*, const char *items_separated_by_separator, int separator, int selected, int count, int item_height, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API int nk_combo_string(struct nk_context*, const char *items_separated_by_zeros, int selected, int count, int item_height, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API int nk_combo_callback(struct nk_context*, void(*item_getter)(void*, int, const char**), void *userdata, int selected, int count, int item_height, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API void nk_combobox(struct nk_context*, const char **items, int count, int *selected, int item_height, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API void nk_combobox_string(struct nk_context*, const char *items_separated_by_zeros, int *selected, int count, int item_height, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API void nk_combobox_separator(struct nk_context*, const char *items_separated_by_separator, int separator, int *selected, int count, int item_height, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API void nk_combobox_callback(struct nk_context*, void(*item_getter)(void*, int, const char**), void*, int *selected, int count, int item_height, struct nk_vec2 size);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  ABSTRACT COMBOBOX
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API nk_bool nk_combo_begin_text(struct nk_context*, const char *selected, int, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API nk_bool nk_combo_begin_label(struct nk_context*, const char *selected, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API nk_bool nk_combo_begin_color(struct nk_context*, struct nk_color color, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API nk_bool nk_combo_begin_symbol(struct nk_context*,  enum nk_symbol_type,  struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API nk_bool nk_combo_begin_symbol_label(struct nk_context*, const char *selected, enum nk_symbol_type, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API nk_bool nk_combo_begin_symbol_text(struct nk_context*, const char *selected, int, enum nk_symbol_type, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API nk_bool nk_combo_begin_image(struct nk_context*, struct nk_image img,  struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API nk_bool nk_combo_begin_image_label(struct nk_context*, const char *selected, struct nk_image, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API nk_bool nk_combo_begin_image_text(struct nk_context*,  const char *selected, int, struct nk_image, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API nk_bool nk_combo_item_label(struct nk_context*, const char*, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_combo_item_text(struct nk_context*, const char*,int, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_combo_item_image_label(struct nk_context*, struct nk_image, const char*, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_combo_item_image_text(struct nk_context*, struct nk_image, const char*, int,nk_flags alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_combo_item_symbol_label(struct nk_context*, enum nk_symbol_type, const char*, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_combo_item_symbol_text(struct nk_context*, enum nk_symbol_type, const char*, int, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API void nk_combo_close(struct nk_context*);
Ivan Mahonin b53a5c
NK_API void nk_combo_end(struct nk_context*);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  CONTEXTUAL
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API nk_bool nk_contextual_begin(struct nk_context*, nk_flags, struct nk_vec2, struct nk_rect trigger_bounds);
Ivan Mahonin b53a5c
NK_API nk_bool nk_contextual_item_text(struct nk_context*, const char*, int,nk_flags align);
Ivan Mahonin b53a5c
NK_API nk_bool nk_contextual_item_label(struct nk_context*, const char*, nk_flags align);
Ivan Mahonin b53a5c
NK_API nk_bool nk_contextual_item_image_label(struct nk_context*, struct nk_image, const char*, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_contextual_item_image_text(struct nk_context*, struct nk_image, const char*, int len, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_contextual_item_symbol_label(struct nk_context*, enum nk_symbol_type, const char*, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_contextual_item_symbol_text(struct nk_context*, enum nk_symbol_type, const char*, int, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API void nk_contextual_close(struct nk_context*);
Ivan Mahonin b53a5c
NK_API void nk_contextual_end(struct nk_context*);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  TOOLTIP
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API void nk_tooltip(struct nk_context*, const char*);
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_STANDARD_VARARGS
Ivan Mahonin b53a5c
NK_API void nk_tooltipf(struct nk_context*, NK_PRINTF_FORMAT_STRING const char*, ...) NK_PRINTF_VARARG_FUNC(2);
Ivan Mahonin b53a5c
NK_API void nk_tooltipfv(struct nk_context*, NK_PRINTF_FORMAT_STRING const char*, va_list) NK_PRINTF_VALIST_FUNC(2);
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
NK_API nk_bool nk_tooltip_begin(struct nk_context*, float width);
Ivan Mahonin b53a5c
NK_API void nk_tooltip_end(struct nk_context*);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  MENU
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API void nk_menubar_begin(struct nk_context*);
Ivan Mahonin b53a5c
NK_API void nk_menubar_end(struct nk_context*);
Ivan Mahonin b53a5c
NK_API nk_bool nk_menu_begin_text(struct nk_context*, const char* title, int title_len, nk_flags align, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API nk_bool nk_menu_begin_label(struct nk_context*, const char*, nk_flags align, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API nk_bool nk_menu_begin_image(struct nk_context*, const char*, struct nk_image, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API nk_bool nk_menu_begin_image_text(struct nk_context*, const char*, int,nk_flags align,struct nk_image, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API nk_bool nk_menu_begin_image_label(struct nk_context*, const char*, nk_flags align,struct nk_image, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API nk_bool nk_menu_begin_symbol(struct nk_context*, const char*, enum nk_symbol_type, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API nk_bool nk_menu_begin_symbol_text(struct nk_context*, const char*, int,nk_flags align,enum nk_symbol_type, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API nk_bool nk_menu_begin_symbol_label(struct nk_context*, const char*, nk_flags align,enum nk_symbol_type, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API nk_bool nk_menu_item_text(struct nk_context*, const char*, int,nk_flags align);
Ivan Mahonin b53a5c
NK_API nk_bool nk_menu_item_label(struct nk_context*, const char*, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_menu_item_image_label(struct nk_context*, struct nk_image, const char*, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_menu_item_image_text(struct nk_context*, struct nk_image, const char*, int len, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_menu_item_symbol_text(struct nk_context*, enum nk_symbol_type, const char*, int, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API nk_bool nk_menu_item_symbol_label(struct nk_context*, enum nk_symbol_type, const char*, nk_flags alignment);
Ivan Mahonin b53a5c
NK_API void nk_menu_close(struct nk_context*);
Ivan Mahonin b53a5c
NK_API void nk_menu_end(struct nk_context*);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  STYLE
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
enum nk_style_colors {
Ivan Mahonin b53a5c
    NK_COLOR_TEXT,
Ivan Mahonin b53a5c
    NK_COLOR_WINDOW,
Ivan Mahonin b53a5c
    NK_COLOR_HEADER,
Ivan Mahonin b53a5c
    NK_COLOR_BORDER,
Ivan Mahonin b53a5c
    NK_COLOR_BUTTON,
Ivan Mahonin b53a5c
    NK_COLOR_BUTTON_HOVER,
Ivan Mahonin b53a5c
    NK_COLOR_BUTTON_ACTIVE,
Ivan Mahonin b53a5c
    NK_COLOR_TOGGLE,
Ivan Mahonin b53a5c
    NK_COLOR_TOGGLE_HOVER,
Ivan Mahonin b53a5c
    NK_COLOR_TOGGLE_CURSOR,
Ivan Mahonin b53a5c
    NK_COLOR_SELECT,
Ivan Mahonin b53a5c
    NK_COLOR_SELECT_ACTIVE,
Ivan Mahonin b53a5c
    NK_COLOR_SLIDER,
Ivan Mahonin b53a5c
    NK_COLOR_SLIDER_CURSOR,
Ivan Mahonin b53a5c
    NK_COLOR_SLIDER_CURSOR_HOVER,
Ivan Mahonin b53a5c
    NK_COLOR_SLIDER_CURSOR_ACTIVE,
Ivan Mahonin b53a5c
    NK_COLOR_PROPERTY,
Ivan Mahonin b53a5c
    NK_COLOR_EDIT,
Ivan Mahonin b53a5c
    NK_COLOR_EDIT_CURSOR,
Ivan Mahonin b53a5c
    NK_COLOR_COMBO,
Ivan Mahonin b53a5c
    NK_COLOR_CHART,
Ivan Mahonin b53a5c
    NK_COLOR_CHART_COLOR,
Ivan Mahonin b53a5c
    NK_COLOR_CHART_COLOR_HIGHLIGHT,
Ivan Mahonin b53a5c
    NK_COLOR_SCROLLBAR,
Ivan Mahonin b53a5c
    NK_COLOR_SCROLLBAR_CURSOR,
Ivan Mahonin b53a5c
    NK_COLOR_SCROLLBAR_CURSOR_HOVER,
Ivan Mahonin b53a5c
    NK_COLOR_SCROLLBAR_CURSOR_ACTIVE,
Ivan Mahonin b53a5c
    NK_COLOR_TAB_HEADER,
Ivan Mahonin b53a5c
    NK_COLOR_COUNT
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
enum nk_style_cursor {
Ivan Mahonin b53a5c
    NK_CURSOR_ARROW,
Ivan Mahonin b53a5c
    NK_CURSOR_TEXT,
Ivan Mahonin b53a5c
    NK_CURSOR_MOVE,
Ivan Mahonin b53a5c
    NK_CURSOR_RESIZE_VERTICAL,
Ivan Mahonin b53a5c
    NK_CURSOR_RESIZE_HORIZONTAL,
Ivan Mahonin b53a5c
    NK_CURSOR_RESIZE_TOP_LEFT_DOWN_RIGHT,
Ivan Mahonin b53a5c
    NK_CURSOR_RESIZE_TOP_RIGHT_DOWN_LEFT,
Ivan Mahonin b53a5c
    NK_CURSOR_COUNT
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
NK_API void nk_style_default(struct nk_context*);
Ivan Mahonin b53a5c
NK_API void nk_style_from_table(struct nk_context*, const struct nk_color*);
Ivan Mahonin b53a5c
NK_API void nk_style_load_cursor(struct nk_context*, enum nk_style_cursor, const struct nk_cursor*);
Ivan Mahonin b53a5c
NK_API void nk_style_load_all_cursors(struct nk_context*, struct nk_cursor*);
Ivan Mahonin b53a5c
NK_API const char* nk_style_get_color_by_name(enum nk_style_colors);
Ivan Mahonin b53a5c
NK_API void nk_style_set_font(struct nk_context*, const struct nk_user_font*);
Ivan Mahonin b53a5c
NK_API nk_bool nk_style_set_cursor(struct nk_context*, enum nk_style_cursor);
Ivan Mahonin b53a5c
NK_API void nk_style_show_cursor(struct nk_context*);
Ivan Mahonin b53a5c
NK_API void nk_style_hide_cursor(struct nk_context*);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API nk_bool nk_style_push_font(struct nk_context*, const struct nk_user_font*);
Ivan Mahonin b53a5c
NK_API nk_bool nk_style_push_float(struct nk_context*, float*, float);
Ivan Mahonin b53a5c
NK_API nk_bool nk_style_push_vec2(struct nk_context*, struct nk_vec2*, struct nk_vec2);
Ivan Mahonin b53a5c
NK_API nk_bool nk_style_push_style_item(struct nk_context*, struct nk_style_item*, struct nk_style_item);
Ivan Mahonin b53a5c
NK_API nk_bool nk_style_push_flags(struct nk_context*, nk_flags*, nk_flags);
Ivan Mahonin b53a5c
NK_API nk_bool nk_style_push_color(struct nk_context*, struct nk_color*, struct nk_color);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API nk_bool nk_style_pop_font(struct nk_context*);
Ivan Mahonin b53a5c
NK_API nk_bool nk_style_pop_float(struct nk_context*);
Ivan Mahonin b53a5c
NK_API nk_bool nk_style_pop_vec2(struct nk_context*);
Ivan Mahonin b53a5c
NK_API nk_bool nk_style_pop_style_item(struct nk_context*);
Ivan Mahonin b53a5c
NK_API nk_bool nk_style_pop_flags(struct nk_context*);
Ivan Mahonin b53a5c
NK_API nk_bool nk_style_pop_color(struct nk_context*);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  COLOR
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API struct nk_color nk_rgb(int r, int g, int b);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_rgb_iv(const int *rgb);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_rgb_bv(const nk_byte* rgb);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_rgb_f(float r, float g, float b);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_rgb_fv(const float *rgb);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_rgb_cf(struct nk_colorf c);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_rgb_hex(const char *rgb);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API struct nk_color nk_rgba(int r, int g, int b, int a);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_rgba_u32(nk_uint);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_rgba_iv(const int *rgba);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_rgba_bv(const nk_byte *rgba);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_rgba_f(float r, float g, float b, float a);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_rgba_fv(const float *rgba);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_rgba_cf(struct nk_colorf c);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_rgba_hex(const char *rgb);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API struct nk_colorf nk_hsva_colorf(float h, float s, float v, float a);
Ivan Mahonin b53a5c
NK_API struct nk_colorf nk_hsva_colorfv(float *c);
Ivan Mahonin b53a5c
NK_API void nk_colorf_hsva_f(float *out_h, float *out_s, float *out_v, float *out_a, struct nk_colorf in);
Ivan Mahonin b53a5c
NK_API void nk_colorf_hsva_fv(float *hsva, struct nk_colorf in);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API struct nk_color nk_hsv(int h, int s, int v);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_hsv_iv(const int *hsv);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_hsv_bv(const nk_byte *hsv);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_hsv_f(float h, float s, float v);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_hsv_fv(const float *hsv);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API struct nk_color nk_hsva(int h, int s, int v, int a);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_hsva_iv(const int *hsva);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_hsva_bv(const nk_byte *hsva);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_hsva_f(float h, float s, float v, float a);
Ivan Mahonin b53a5c
NK_API struct nk_color nk_hsva_fv(const float *hsva);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* color (conversion nuklear --> user) */
Ivan Mahonin b53a5c
NK_API void nk_color_f(float *r, float *g, float *b, float *a, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_color_fv(float *rgba_out, struct nk_color);
Ivan Mahonin b53a5c
NK_API struct nk_colorf nk_color_cf(struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_color_d(double *r, double *g, double *b, double *a, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_color_dv(double *rgba_out, struct nk_color);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API nk_uint nk_color_u32(struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_color_hex_rgba(char *output, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_color_hex_rgb(char *output, struct nk_color);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API void nk_color_hsv_i(int *out_h, int *out_s, int *out_v, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_color_hsv_b(nk_byte *out_h, nk_byte *out_s, nk_byte *out_v, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_color_hsv_iv(int *hsv_out, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_color_hsv_bv(nk_byte *hsv_out, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_color_hsv_f(float *out_h, float *out_s, float *out_v, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_color_hsv_fv(float *hsv_out, struct nk_color);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API void nk_color_hsva_i(int *h, int *s, int *v, int *a, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_color_hsva_b(nk_byte *h, nk_byte *s, nk_byte *v, nk_byte *a, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_color_hsva_iv(int *hsva_out, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_color_hsva_bv(nk_byte *hsva_out, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_color_hsva_f(float *out_h, float *out_s, float *out_v, float *out_a, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_color_hsva_fv(float *hsva_out, struct nk_color);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  IMAGE
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API nk_handle nk_handle_ptr(void*);
Ivan Mahonin b53a5c
NK_API nk_handle nk_handle_id(int);
Ivan Mahonin b53a5c
NK_API struct nk_image nk_image_handle(nk_handle);
Ivan Mahonin b53a5c
NK_API struct nk_image nk_image_ptr(void*);
Ivan Mahonin b53a5c
NK_API struct nk_image nk_image_id(int);
Ivan Mahonin b53a5c
NK_API nk_bool nk_image_is_subimage(const struct nk_image* img);
Ivan Mahonin b53a5c
NK_API struct nk_image nk_subimage_ptr(void*, nk_ushort w, nk_ushort h, struct nk_rect sub_region);
Ivan Mahonin b53a5c
NK_API struct nk_image nk_subimage_id(int, nk_ushort w, nk_ushort h, struct nk_rect sub_region);
Ivan Mahonin b53a5c
NK_API struct nk_image nk_subimage_handle(nk_handle, nk_ushort w, nk_ushort h, struct nk_rect sub_region);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  9-SLICE
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API struct nk_nine_slice nk_nine_slice_handle(nk_handle, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b);
Ivan Mahonin b53a5c
NK_API struct nk_nine_slice nk_nine_slice_ptr(void*, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b);
Ivan Mahonin b53a5c
NK_API struct nk_nine_slice nk_nine_slice_id(int, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b);
Ivan Mahonin b53a5c
NK_API int nk_nine_slice_is_sub9slice(const struct nk_nine_slice* img);
Ivan Mahonin b53a5c
NK_API struct nk_nine_slice nk_sub9slice_ptr(void*, nk_ushort w, nk_ushort h, struct nk_rect sub_region, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b);
Ivan Mahonin b53a5c
NK_API struct nk_nine_slice nk_sub9slice_id(int, nk_ushort w, nk_ushort h, struct nk_rect sub_region, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b);
Ivan Mahonin b53a5c
NK_API struct nk_nine_slice nk_sub9slice_handle(nk_handle, nk_ushort w, nk_ushort h, struct nk_rect sub_region, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  MATH
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API nk_hash nk_murmur_hash(const void *key, int len, nk_hash seed);
Ivan Mahonin b53a5c
NK_API void nk_triangle_from_direction(struct nk_vec2 *result, struct nk_rect r, float pad_x, float pad_y, enum nk_heading);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API struct nk_vec2 nk_vec2(float x, float y);
Ivan Mahonin b53a5c
NK_API struct nk_vec2 nk_vec2i(int x, int y);
Ivan Mahonin b53a5c
NK_API struct nk_vec2 nk_vec2v(const float *xy);
Ivan Mahonin b53a5c
NK_API struct nk_vec2 nk_vec2iv(const int *xy);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API struct nk_rect nk_get_null_rect(void);
Ivan Mahonin b53a5c
NK_API struct nk_rect nk_rect(float x, float y, float w, float h);
Ivan Mahonin b53a5c
NK_API struct nk_rect nk_recti(int x, int y, int w, int h);
Ivan Mahonin b53a5c
NK_API struct nk_rect nk_recta(struct nk_vec2 pos, struct nk_vec2 size);
Ivan Mahonin b53a5c
NK_API struct nk_rect nk_rectv(const float *xywh);
Ivan Mahonin b53a5c
NK_API struct nk_rect nk_rectiv(const int *xywh);
Ivan Mahonin b53a5c
NK_API struct nk_vec2 nk_rect_pos(struct nk_rect);
Ivan Mahonin b53a5c
NK_API struct nk_vec2 nk_rect_size(struct nk_rect);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  STRING
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API int nk_strlen(const char *str);
Ivan Mahonin b53a5c
NK_API int nk_stricmp(const char *s1, const char *s2);
Ivan Mahonin b53a5c
NK_API int nk_stricmpn(const char *s1, const char *s2, int n);
Ivan Mahonin b53a5c
NK_API int nk_strtoi(const char *str, const char **endptr);
Ivan Mahonin b53a5c
NK_API float nk_strtof(const char *str, const char **endptr);
Ivan Mahonin b53a5c
#ifndef NK_STRTOD
Ivan Mahonin b53a5c
#define NK_STRTOD nk_strtod
Ivan Mahonin b53a5c
NK_API double nk_strtod(const char *str, const char **endptr);
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
NK_API int nk_strfilter(const char *text, const char *regexp);
Ivan Mahonin b53a5c
NK_API int nk_strmatch_fuzzy_string(char const *str, char const *pattern, int *out_score);
Ivan Mahonin b53a5c
NK_API int nk_strmatch_fuzzy_text(const char *txt, int txt_len, const char *pattern, int *out_score);
Ivan Mahonin b53a5c
/* =============================================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                                  UTF-8
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ============================================================================= */
Ivan Mahonin b53a5c
NK_API int nk_utf_decode(const char*, nk_rune*, int);
Ivan Mahonin b53a5c
NK_API int nk_utf_encode(nk_rune, char*, int);
Ivan Mahonin b53a5c
NK_API int nk_utf_len(const char*, int byte_len);
Ivan Mahonin b53a5c
NK_API const char* nk_utf_at(const char *buffer, int length, int index, nk_rune *unicode, int *len);
Ivan Mahonin b53a5c
/* ===============================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                          FONT
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ===============================================================*/
Ivan Mahonin b53a5c
/*/// ### Font
Ivan Mahonin b53a5c
/// Font handling in this library was designed to be quite customizable and lets
Ivan Mahonin b53a5c
/// you decide what you want to use and what you want to provide. There are three
Ivan Mahonin b53a5c
/// different ways to use the font atlas. The first two will use your font
Ivan Mahonin b53a5c
/// handling scheme and only requires essential data to run nuklear. The next
Ivan Mahonin b53a5c
/// slightly more advanced features is font handling with vertex buffer output.
Ivan Mahonin b53a5c
/// Finally the most complex API wise is using nuklear's font baking API.
Ivan Mahonin b53a5c
//
Ivan Mahonin b53a5c
/// #### Using your own implementation without vertex buffer output
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
/// So first up the easiest way to do font handling is by just providing a
Ivan Mahonin b53a5c
/// `nk_user_font` struct which only requires the height in pixel of the used
Ivan Mahonin b53a5c
/// font and a callback to calculate the width of a string. This way of handling
Ivan Mahonin b53a5c
/// fonts is best fitted for using the normal draw shape command API where you
Ivan Mahonin b53a5c
/// do all the text drawing yourself and the library does not require any kind
Ivan Mahonin b53a5c
/// of deeper knowledge about which font handling mechanism you use.
Ivan Mahonin b53a5c
/// IMPORTANT: the `nk_user_font` pointer provided to nuklear has to persist
Ivan Mahonin b53a5c
/// over the complete life time! I know this sucks but it is currently the only
Ivan Mahonin b53a5c
/// way to switch between fonts.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ```c
Ivan Mahonin b53a5c
///     float your_text_width_calculation(nk_handle handle, float height, const char *text, int len)
Ivan Mahonin b53a5c
///     {
Ivan Mahonin b53a5c
///         your_font_type *type = handle.ptr;
Ivan Mahonin b53a5c
///         float text_width = ...;
Ivan Mahonin b53a5c
///         return text_width;
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
///     struct nk_user_font font;
Ivan Mahonin b53a5c
///     font.userdata.ptr = &your_font_class_or_struct;
Ivan Mahonin b53a5c
///     font.height = your_font_height;
Ivan Mahonin b53a5c
///     font.width = your_text_width_calculation;
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
///     struct nk_context ctx;
Ivan Mahonin b53a5c
///     nk_init_default(&ctx, &font);
Ivan Mahonin b53a5c
/// ```
Ivan Mahonin b53a5c
/// #### Using your own implementation with vertex buffer output
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
/// While the first approach works fine if you don't want to use the optional
Ivan Mahonin b53a5c
/// vertex buffer output it is not enough if you do. To get font handling working
Ivan Mahonin b53a5c
/// for these cases you have to provide two additional parameters inside the
Ivan Mahonin b53a5c
/// `nk_user_font`. First a texture atlas handle used to draw text as subimages
Ivan Mahonin b53a5c
/// of a bigger font atlas texture and a callback to query a character's glyph
Ivan Mahonin b53a5c
/// information (offset, size, ...). So it is still possible to provide your own
Ivan Mahonin b53a5c
/// font and use the vertex buffer output.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ```c
Ivan Mahonin b53a5c
///     float your_text_width_calculation(nk_handle handle, float height, const char *text, int len)
Ivan Mahonin b53a5c
///     {
Ivan Mahonin b53a5c
///         your_font_type *type = handle.ptr;
Ivan Mahonin b53a5c
///         float text_width = ...;
Ivan Mahonin b53a5c
///         return text_width;
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     void query_your_font_glyph(nk_handle handle, float font_height, struct nk_user_font_glyph *glyph, nk_rune codepoint, nk_rune next_codepoint)
Ivan Mahonin b53a5c
///     {
Ivan Mahonin b53a5c
///         your_font_type *type = handle.ptr;
Ivan Mahonin b53a5c
///         glyph.width = ...;
Ivan Mahonin b53a5c
///         glyph.height = ...;
Ivan Mahonin b53a5c
///         glyph.xadvance = ...;
Ivan Mahonin b53a5c
///         glyph.uv[0].x = ...;
Ivan Mahonin b53a5c
///         glyph.uv[0].y = ...;
Ivan Mahonin b53a5c
///         glyph.uv[1].x = ...;
Ivan Mahonin b53a5c
///         glyph.uv[1].y = ...;
Ivan Mahonin b53a5c
///         glyph.offset.x = ...;
Ivan Mahonin b53a5c
///         glyph.offset.y = ...;
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
///     struct nk_user_font font;
Ivan Mahonin b53a5c
///     font.userdata.ptr = &your_font_class_or_struct;
Ivan Mahonin b53a5c
///     font.height = your_font_height;
Ivan Mahonin b53a5c
///     font.width = your_text_width_calculation;
Ivan Mahonin b53a5c
///     font.query = query_your_font_glyph;
Ivan Mahonin b53a5c
///     font.texture.id = your_font_texture;
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
///     struct nk_context ctx;
Ivan Mahonin b53a5c
///     nk_init_default(&ctx, &font);
Ivan Mahonin b53a5c
/// ```
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// #### Nuklear font baker
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
/// The final approach if you do not have a font handling functionality or don't
Ivan Mahonin b53a5c
/// want to use it in this library is by using the optional font baker.
Ivan Mahonin b53a5c
/// The font baker APIs can be used to create a font plus font atlas texture
Ivan Mahonin b53a5c
/// and can be used with or without the vertex buffer output.
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
/// It still uses the `nk_user_font` struct and the two different approaches
Ivan Mahonin b53a5c
/// previously stated still work. The font baker is not located inside
Ivan Mahonin b53a5c
/// `nk_context` like all other systems since it can be understood as more of
Ivan Mahonin b53a5c
/// an extension to nuklear and does not really depend on any `nk_context` state.
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
/// Font baker need to be initialized first by one of the nk_font_atlas_init_xxx
Ivan Mahonin b53a5c
/// functions. If you don't care about memory just call the default version
Ivan Mahonin b53a5c
/// `nk_font_atlas_init_default` which will allocate all memory from the standard library.
Ivan Mahonin b53a5c
/// If you want to control memory allocation but you don't care if the allocated
Ivan Mahonin b53a5c
/// memory is temporary and therefore can be freed directly after the baking process
Ivan Mahonin b53a5c
/// is over or permanent you can call `nk_font_atlas_init`.
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
/// After successfully initializing the font baker you can add Truetype(.ttf) fonts from
Ivan Mahonin b53a5c
/// different sources like memory or from file by calling one of the `nk_font_atlas_add_xxx`.
Ivan Mahonin b53a5c
/// functions. Adding font will permanently store each font, font config and ttf memory block(!)
Ivan Mahonin b53a5c
/// inside the font atlas and allows to reuse the font atlas. If you don't want to reuse
Ivan Mahonin b53a5c
/// the font baker by for example adding additional fonts you can call
Ivan Mahonin b53a5c
/// `nk_font_atlas_cleanup` after the baking process is over (after calling nk_font_atlas_end).
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
/// As soon as you added all fonts you wanted you can now start the baking process
Ivan Mahonin b53a5c
/// for every selected glyph to image by calling `nk_font_atlas_bake`.
Ivan Mahonin b53a5c
/// The baking process returns image memory, width and height which can be used to
Ivan Mahonin b53a5c
/// either create your own image object or upload it to any graphics library.
Ivan Mahonin b53a5c
/// No matter which case you finally have to call `nk_font_atlas_end` which
Ivan Mahonin b53a5c
/// will free all temporary memory including the font atlas image so make sure
Ivan Mahonin b53a5c
/// you created our texture beforehand. `nk_font_atlas_end` requires a handle
Ivan Mahonin b53a5c
/// to your font texture or object and optionally fills a `struct nk_draw_null_texture`
Ivan Mahonin b53a5c
/// which can be used for the optional vertex output. If you don't want it just
Ivan Mahonin b53a5c
/// set the argument to `NULL`.
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
/// At this point you are done and if you don't want to reuse the font atlas you
Ivan Mahonin b53a5c
/// can call `nk_font_atlas_cleanup` to free all truetype blobs and configuration
Ivan Mahonin b53a5c
/// memory. Finally if you don't use the font atlas and any of it's fonts anymore
Ivan Mahonin b53a5c
/// you need to call `nk_font_atlas_clear` to free all memory still being used.
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
/// ```c
Ivan Mahonin b53a5c
///     struct nk_font_atlas atlas;
Ivan Mahonin b53a5c
///     nk_font_atlas_init_default(&atlas);
Ivan Mahonin b53a5c
///     nk_font_atlas_begin(&atlas);
Ivan Mahonin b53a5c
///     nk_font *font = nk_font_atlas_add_from_file(&atlas, "Path/To/Your/TTF_Font.ttf", 13, 0);
Ivan Mahonin b53a5c
///     nk_font *font2 = nk_font_atlas_add_from_file(&atlas, "Path/To/Your/TTF_Font2.ttf", 16, 0);
Ivan Mahonin b53a5c
///     const void* img = nk_font_atlas_bake(&atlas, &img_width, &img_height, NK_FONT_ATLAS_RGBA32);
Ivan Mahonin b53a5c
///     nk_font_atlas_end(&atlas, nk_handle_id(texture), 0);
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
///     struct nk_context ctx;
Ivan Mahonin b53a5c
///     nk_init_default(&ctx, &font->handle);
Ivan Mahonin b53a5c
///     while (1) {
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_font_atlas_clear(&atlas);
Ivan Mahonin b53a5c
/// ```
Ivan Mahonin b53a5c
/// The font baker API is probably the most complex API inside this library and
Ivan Mahonin b53a5c
/// I would suggest reading some of my examples `example/` to get a grip on how
Ivan Mahonin b53a5c
/// to use the font atlas. There are a number of details I left out. For example
Ivan Mahonin b53a5c
/// how to merge fonts, configure a font with `nk_font_config` to use other languages,
Ivan Mahonin b53a5c
/// use another texture coordinate format and a lot more:
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// ```c
Ivan Mahonin b53a5c
///     struct nk_font_config cfg = nk_font_config(font_pixel_height);
Ivan Mahonin b53a5c
///     cfg.merge_mode = nk_false or nk_true;
Ivan Mahonin b53a5c
///     cfg.range = nk_font_korean_glyph_ranges();
Ivan Mahonin b53a5c
///     cfg.coord_type = NK_COORD_PIXEL;
Ivan Mahonin b53a5c
///     nk_font *font = nk_font_atlas_add_from_file(&atlas, "Path/To/Your/TTF_Font.ttf", 13, &cfg);
Ivan Mahonin b53a5c
/// ```
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
struct nk_user_font_glyph;
Ivan Mahonin b53a5c
typedef float(*nk_text_width_f)(nk_handle, float h, const char*, int len);
Ivan Mahonin b53a5c
typedef void(*nk_query_font_glyph_f)(nk_handle handle, float font_height,
Ivan Mahonin b53a5c
                                    struct nk_user_font_glyph *glyph,
Ivan Mahonin b53a5c
                                    nk_rune codepoint, nk_rune next_codepoint);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#if defined(NK_INCLUDE_VERTEX_BUFFER_OUTPUT) || defined(NK_INCLUDE_SOFTWARE_FONT)
Ivan Mahonin b53a5c
struct nk_user_font_glyph {
Ivan Mahonin b53a5c
    struct nk_vec2 uv[2];
Ivan Mahonin b53a5c
    /* texture coordinates */
Ivan Mahonin b53a5c
    struct nk_vec2 offset;
Ivan Mahonin b53a5c
    /* offset between top left and glyph */
Ivan Mahonin b53a5c
    float width, height;
Ivan Mahonin b53a5c
    /* size of the glyph  */
Ivan Mahonin b53a5c
    float xadvance;
Ivan Mahonin b53a5c
    /* offset to the next glyph */
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_user_font {
Ivan Mahonin b53a5c
    nk_handle userdata;
Ivan Mahonin b53a5c
    /* user provided font handle */
Ivan Mahonin b53a5c
    float height;
Ivan Mahonin b53a5c
    /* max height of the font */
Ivan Mahonin b53a5c
    nk_text_width_f width;
Ivan Mahonin b53a5c
    /* font string width in pixel callback */
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_VERTEX_BUFFER_OUTPUT
Ivan Mahonin b53a5c
    nk_query_font_glyph_f query;
Ivan Mahonin b53a5c
    /* font glyph callback to query drawing info */
Ivan Mahonin b53a5c
    nk_handle texture;
Ivan Mahonin b53a5c
    /* texture handle to the used font atlas or texture */
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_FONT_BAKING
Ivan Mahonin b53a5c
enum nk_font_coord_type {
Ivan Mahonin b53a5c
    NK_COORD_UV, /* texture coordinates inside font glyphs are clamped between 0-1 */
Ivan Mahonin b53a5c
    NK_COORD_PIXEL /* texture coordinates inside font glyphs are in absolute pixel */
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_font;
Ivan Mahonin b53a5c
struct nk_baked_font {
Ivan Mahonin b53a5c
    float height;
Ivan Mahonin b53a5c
    /* height of the font  */
Ivan Mahonin b53a5c
    float ascent, descent;
Ivan Mahonin b53a5c
    /* font glyphs ascent and descent  */
Ivan Mahonin b53a5c
    nk_rune glyph_offset;
Ivan Mahonin b53a5c
    /* glyph array offset inside the font glyph baking output array  */
Ivan Mahonin b53a5c
    nk_rune glyph_count;
Ivan Mahonin b53a5c
    /* number of glyphs of this font inside the glyph baking array output */
Ivan Mahonin b53a5c
    const nk_rune *ranges;
Ivan Mahonin b53a5c
    /* font codepoint ranges as pairs of (from/to) and 0 as last element */
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_font_config {
Ivan Mahonin b53a5c
    struct nk_font_config *next;
Ivan Mahonin b53a5c
    /* NOTE: only used internally */
Ivan Mahonin b53a5c
    void *ttf_blob;
Ivan Mahonin b53a5c
    /* pointer to loaded TTF file memory block.
Ivan Mahonin b53a5c
     * NOTE: not needed for nk_font_atlas_add_from_memory and nk_font_atlas_add_from_file. */
Ivan Mahonin b53a5c
    nk_size ttf_size;
Ivan Mahonin b53a5c
    /* size of the loaded TTF file memory block
Ivan Mahonin b53a5c
     * NOTE: not needed for nk_font_atlas_add_from_memory and nk_font_atlas_add_from_file. */
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    unsigned char ttf_data_owned_by_atlas;
Ivan Mahonin b53a5c
    /* used inside font atlas: default to: 0*/
Ivan Mahonin b53a5c
    unsigned char merge_mode;
Ivan Mahonin b53a5c
    /* merges this font into the last font */
Ivan Mahonin b53a5c
    unsigned char pixel_snap;
Ivan Mahonin b53a5c
    /* align every character to pixel boundary (if true set oversample (1,1)) */
Ivan Mahonin b53a5c
    unsigned char oversample_v, oversample_h;
Ivan Mahonin b53a5c
    /* rasterize at high quality for sub-pixel position */
Ivan Mahonin b53a5c
    unsigned char padding[3];
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    float size;
Ivan Mahonin b53a5c
    /* baked pixel height of the font */
Ivan Mahonin b53a5c
    enum nk_font_coord_type coord_type;
Ivan Mahonin b53a5c
    /* texture coordinate format with either pixel or UV coordinates */
Ivan Mahonin b53a5c
    struct nk_vec2 spacing;
Ivan Mahonin b53a5c
    /* extra pixel spacing between glyphs  */
Ivan Mahonin b53a5c
    const nk_rune *range;
Ivan Mahonin b53a5c
    /* list of unicode ranges (2 values per range, zero terminated) */
Ivan Mahonin b53a5c
    struct nk_baked_font *font;
Ivan Mahonin b53a5c
    /* font to setup in the baking process: NOTE: not needed for font atlas */
Ivan Mahonin b53a5c
    nk_rune fallback_glyph;
Ivan Mahonin b53a5c
    /* fallback glyph to use if a given rune is not found */
Ivan Mahonin b53a5c
    struct nk_font_config *n;
Ivan Mahonin b53a5c
    struct nk_font_config *p;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_font_glyph {
Ivan Mahonin b53a5c
    nk_rune codepoint;
Ivan Mahonin b53a5c
    float xadvance;
Ivan Mahonin b53a5c
    float x0, y0, x1, y1, w, h;
Ivan Mahonin b53a5c
    float u0, v0, u1, v1;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_font {
Ivan Mahonin b53a5c
    struct nk_font *next;
Ivan Mahonin b53a5c
    struct nk_user_font handle;
Ivan Mahonin b53a5c
    struct nk_baked_font info;
Ivan Mahonin b53a5c
    float scale;
Ivan Mahonin b53a5c
    struct nk_font_glyph *glyphs;
Ivan Mahonin b53a5c
    const struct nk_font_glyph *fallback;
Ivan Mahonin b53a5c
    nk_rune fallback_codepoint;
Ivan Mahonin b53a5c
    nk_handle texture;
Ivan Mahonin b53a5c
    struct nk_font_config *config;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
enum nk_font_atlas_format {
Ivan Mahonin b53a5c
    NK_FONT_ATLAS_ALPHA8,
Ivan Mahonin b53a5c
    NK_FONT_ATLAS_RGBA32
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_font_atlas {
Ivan Mahonin b53a5c
    void *pixel;
Ivan Mahonin b53a5c
    int tex_width;
Ivan Mahonin b53a5c
    int tex_height;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    struct nk_allocator permanent;
Ivan Mahonin b53a5c
    struct nk_allocator temporary;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    struct nk_recti custom;
Ivan Mahonin b53a5c
    struct nk_cursor cursors[NK_CURSOR_COUNT];
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    int glyph_count;
Ivan Mahonin b53a5c
    struct nk_font_glyph *glyphs;
Ivan Mahonin b53a5c
    struct nk_font *default_font;
Ivan Mahonin b53a5c
    struct nk_font *fonts;
Ivan Mahonin b53a5c
    struct nk_font_config *config;
Ivan Mahonin b53a5c
    int font_num;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* some language glyph codepoint ranges */
Ivan Mahonin b53a5c
NK_API const nk_rune *nk_font_default_glyph_ranges(void);
Ivan Mahonin b53a5c
NK_API const nk_rune *nk_font_chinese_glyph_ranges(void);
Ivan Mahonin b53a5c
NK_API const nk_rune *nk_font_cyrillic_glyph_ranges(void);
Ivan Mahonin b53a5c
NK_API const nk_rune *nk_font_korean_glyph_ranges(void);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_DEFAULT_ALLOCATOR
Ivan Mahonin b53a5c
NK_API void nk_font_atlas_init_default(struct nk_font_atlas*);
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
NK_API void nk_font_atlas_init(struct nk_font_atlas*, struct nk_allocator*);
Ivan Mahonin b53a5c
NK_API void nk_font_atlas_init_custom(struct nk_font_atlas*, struct nk_allocator *persistent, struct nk_allocator *transient);
Ivan Mahonin b53a5c
NK_API void nk_font_atlas_begin(struct nk_font_atlas*);
Ivan Mahonin b53a5c
NK_API struct nk_font_config nk_font_config(float pixel_height);
Ivan Mahonin b53a5c
NK_API struct nk_font *nk_font_atlas_add(struct nk_font_atlas*, const struct nk_font_config*);
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_DEFAULT_FONT
Ivan Mahonin b53a5c
NK_API struct nk_font* nk_font_atlas_add_default(struct nk_font_atlas*, float height, const struct nk_font_config*);
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
NK_API struct nk_font* nk_font_atlas_add_from_memory(struct nk_font_atlas *atlas, void *memory, nk_size size, float height, const struct nk_font_config *config);
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_STANDARD_IO
Ivan Mahonin b53a5c
NK_API struct nk_font* nk_font_atlas_add_from_file(struct nk_font_atlas *atlas, const char *file_path, float height, const struct nk_font_config*);
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
NK_API struct nk_font *nk_font_atlas_add_compressed(struct nk_font_atlas*, void *memory, nk_size size, float height, const struct nk_font_config*);
Ivan Mahonin b53a5c
NK_API struct nk_font* nk_font_atlas_add_compressed_base85(struct nk_font_atlas*, const char *data, float height, const struct nk_font_config *config);
Ivan Mahonin b53a5c
NK_API const void* nk_font_atlas_bake(struct nk_font_atlas*, int *width, int *height, enum nk_font_atlas_format);
Ivan Mahonin b53a5c
NK_API void nk_font_atlas_end(struct nk_font_atlas*, nk_handle tex, struct nk_draw_null_texture*);
Ivan Mahonin b53a5c
NK_API const struct nk_font_glyph* nk_font_find_glyph(struct nk_font*, nk_rune unicode);
Ivan Mahonin b53a5c
NK_API void nk_font_atlas_cleanup(struct nk_font_atlas *atlas);
Ivan Mahonin b53a5c
NK_API void nk_font_atlas_clear(struct nk_font_atlas*);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* ==============================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                          MEMORY BUFFER
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ===============================================================*/
Ivan Mahonin b53a5c
/*/// ### Memory Buffer
Ivan Mahonin b53a5c
/// A basic (double)-buffer with linear allocation and resetting as only
Ivan Mahonin b53a5c
/// freeing policy. The buffer's main purpose is to control all memory management
Ivan Mahonin b53a5c
/// inside the GUI toolkit and still leave memory control as much as possible in
Ivan Mahonin b53a5c
/// the hand of the user while also making sure the library is easy to use if
Ivan Mahonin b53a5c
/// not as much control is needed.
Ivan Mahonin b53a5c
/// In general all memory inside this library can be provided from the user in
Ivan Mahonin b53a5c
/// three different ways.
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
/// The first way and the one providing most control is by just passing a fixed
Ivan Mahonin b53a5c
/// size memory block. In this case all control lies in the hand of the user
Ivan Mahonin b53a5c
/// since he can exactly control where the memory comes from and how much memory
Ivan Mahonin b53a5c
/// the library should consume. Of course using the fixed size API removes the
Ivan Mahonin b53a5c
/// ability to automatically resize a buffer if not enough memory is provided so
Ivan Mahonin b53a5c
/// you have to take over the resizing. While being a fixed sized buffer sounds
Ivan Mahonin b53a5c
/// quite limiting, it is very effective in this library since the actual memory
Ivan Mahonin b53a5c
/// consumption is quite stable and has a fixed upper bound for a lot of cases.
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
/// If you don't want to think about how much memory the library should allocate
Ivan Mahonin b53a5c
/// at all time or have a very dynamic UI with unpredictable memory consumption
Ivan Mahonin b53a5c
/// habits but still want control over memory allocation you can use the dynamic
Ivan Mahonin b53a5c
/// allocator based API. The allocator consists of two callbacks for allocating
Ivan Mahonin b53a5c
/// and freeing memory and optional userdata so you can plugin your own allocator.
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
/// The final and easiest way can be used by defining
Ivan Mahonin b53a5c
/// NK_INCLUDE_DEFAULT_ALLOCATOR which uses the standard library memory
Ivan Mahonin b53a5c
/// allocation functions malloc and free and takes over complete control over
Ivan Mahonin b53a5c
/// memory in this library.
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
struct nk_memory_status {
Ivan Mahonin b53a5c
    void *memory;
Ivan Mahonin b53a5c
    unsigned int type;
Ivan Mahonin b53a5c
    nk_size size;
Ivan Mahonin b53a5c
    nk_size allocated;
Ivan Mahonin b53a5c
    nk_size needed;
Ivan Mahonin b53a5c
    nk_size calls;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
enum nk_allocation_type {
Ivan Mahonin b53a5c
    NK_BUFFER_FIXED,
Ivan Mahonin b53a5c
    NK_BUFFER_DYNAMIC
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
enum nk_buffer_allocation_type {
Ivan Mahonin b53a5c
    NK_BUFFER_FRONT,
Ivan Mahonin b53a5c
    NK_BUFFER_BACK,
Ivan Mahonin b53a5c
    NK_BUFFER_MAX
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_buffer_marker {
Ivan Mahonin b53a5c
    nk_bool active;
Ivan Mahonin b53a5c
    nk_size offset;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_memory {void *ptr;nk_size size;};
Ivan Mahonin b53a5c
struct nk_buffer {
Ivan Mahonin b53a5c
    struct nk_buffer_marker marker[NK_BUFFER_MAX];
Ivan Mahonin b53a5c
    /* buffer marker to free a buffer to a certain offset */
Ivan Mahonin b53a5c
    struct nk_allocator pool;
Ivan Mahonin b53a5c
    /* allocator callback for dynamic buffers */
Ivan Mahonin b53a5c
    enum nk_allocation_type type;
Ivan Mahonin b53a5c
    /* memory management type */
Ivan Mahonin b53a5c
    struct nk_memory memory;
Ivan Mahonin b53a5c
    /* memory and size of the current memory block */
Ivan Mahonin b53a5c
    float grow_factor;
Ivan Mahonin b53a5c
    /* growing factor for dynamic memory management */
Ivan Mahonin b53a5c
    nk_size allocated;
Ivan Mahonin b53a5c
    /* total amount of memory allocated */
Ivan Mahonin b53a5c
    nk_size needed;
Ivan Mahonin b53a5c
    /* totally consumed memory given that enough memory is present */
Ivan Mahonin b53a5c
    nk_size calls;
Ivan Mahonin b53a5c
    /* number of allocation calls */
Ivan Mahonin b53a5c
    nk_size size;
Ivan Mahonin b53a5c
    /* current size of the buffer */
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_DEFAULT_ALLOCATOR
Ivan Mahonin b53a5c
NK_API void nk_buffer_init_default(struct nk_buffer*);
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
NK_API void nk_buffer_init(struct nk_buffer*, const struct nk_allocator*, nk_size size);
Ivan Mahonin b53a5c
NK_API void nk_buffer_init_fixed(struct nk_buffer*, void *memory, nk_size size);
Ivan Mahonin b53a5c
NK_API void nk_buffer_info(struct nk_memory_status*, struct nk_buffer*);
Ivan Mahonin b53a5c
NK_API void nk_buffer_push(struct nk_buffer*, enum nk_buffer_allocation_type type, const void *memory, nk_size size, nk_size align);
Ivan Mahonin b53a5c
NK_API void nk_buffer_mark(struct nk_buffer*, enum nk_buffer_allocation_type type);
Ivan Mahonin b53a5c
NK_API void nk_buffer_reset(struct nk_buffer*, enum nk_buffer_allocation_type type);
Ivan Mahonin b53a5c
NK_API void nk_buffer_clear(struct nk_buffer*);
Ivan Mahonin b53a5c
NK_API void nk_buffer_free(struct nk_buffer*);
Ivan Mahonin b53a5c
NK_API void *nk_buffer_memory(struct nk_buffer*);
Ivan Mahonin b53a5c
NK_API const void *nk_buffer_memory_const(const struct nk_buffer*);
Ivan Mahonin b53a5c
NK_API nk_size nk_buffer_total(struct nk_buffer*);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* ==============================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                          STRING
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ===============================================================*/
Ivan Mahonin b53a5c
/*  Basic string buffer which is only used in context with the text editor
Ivan Mahonin b53a5c
 *  to manage and manipulate dynamic or fixed size string content. This is _NOT_
Ivan Mahonin b53a5c
 *  the default string handling method. The only instance you should have any contact
Ivan Mahonin b53a5c
 *  with this API is if you interact with an `nk_text_edit` object inside one of the
Ivan Mahonin b53a5c
 *  copy and paste functions and even there only for more advanced cases. */
Ivan Mahonin b53a5c
struct nk_str {
Ivan Mahonin b53a5c
    struct nk_buffer buffer;
Ivan Mahonin b53a5c
    int len; /* in codepoints/runes/glyphs */
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_DEFAULT_ALLOCATOR
Ivan Mahonin b53a5c
NK_API void nk_str_init_default(struct nk_str*);
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
NK_API void nk_str_init(struct nk_str*, const struct nk_allocator*, nk_size size);
Ivan Mahonin b53a5c
NK_API void nk_str_init_fixed(struct nk_str*, void *memory, nk_size size);
Ivan Mahonin b53a5c
NK_API void nk_str_clear(struct nk_str*);
Ivan Mahonin b53a5c
NK_API void nk_str_free(struct nk_str*);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API int nk_str_append_text_char(struct nk_str*, const char*, int);
Ivan Mahonin b53a5c
NK_API int nk_str_append_str_char(struct nk_str*, const char*);
Ivan Mahonin b53a5c
NK_API int nk_str_append_text_utf8(struct nk_str*, const char*, int);
Ivan Mahonin b53a5c
NK_API int nk_str_append_str_utf8(struct nk_str*, const char*);
Ivan Mahonin b53a5c
NK_API int nk_str_append_text_runes(struct nk_str*, const nk_rune*, int);
Ivan Mahonin b53a5c
NK_API int nk_str_append_str_runes(struct nk_str*, const nk_rune*);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API int nk_str_insert_at_char(struct nk_str*, int pos, const char*, int);
Ivan Mahonin b53a5c
NK_API int nk_str_insert_at_rune(struct nk_str*, int pos, const char*, int);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API int nk_str_insert_text_char(struct nk_str*, int pos, const char*, int);
Ivan Mahonin b53a5c
NK_API int nk_str_insert_str_char(struct nk_str*, int pos, const char*);
Ivan Mahonin b53a5c
NK_API int nk_str_insert_text_utf8(struct nk_str*, int pos, const char*, int);
Ivan Mahonin b53a5c
NK_API int nk_str_insert_str_utf8(struct nk_str*, int pos, const char*);
Ivan Mahonin b53a5c
NK_API int nk_str_insert_text_runes(struct nk_str*, int pos, const nk_rune*, int);
Ivan Mahonin b53a5c
NK_API int nk_str_insert_str_runes(struct nk_str*, int pos, const nk_rune*);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API void nk_str_remove_chars(struct nk_str*, int len);
Ivan Mahonin b53a5c
NK_API void nk_str_remove_runes(struct nk_str *str, int len);
Ivan Mahonin b53a5c
NK_API void nk_str_delete_chars(struct nk_str*, int pos, int len);
Ivan Mahonin b53a5c
NK_API void nk_str_delete_runes(struct nk_str*, int pos, int len);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API char *nk_str_at_char(struct nk_str*, int pos);
Ivan Mahonin b53a5c
NK_API char *nk_str_at_rune(struct nk_str*, int pos, nk_rune *unicode, int *len);
Ivan Mahonin b53a5c
NK_API nk_rune nk_str_rune_at(const struct nk_str*, int pos);
Ivan Mahonin b53a5c
NK_API const char *nk_str_at_char_const(const struct nk_str*, int pos);
Ivan Mahonin b53a5c
NK_API const char *nk_str_at_const(const struct nk_str*, int pos, nk_rune *unicode, int *len);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API char *nk_str_get(struct nk_str*);
Ivan Mahonin b53a5c
NK_API const char *nk_str_get_const(const struct nk_str*);
Ivan Mahonin b53a5c
NK_API int nk_str_len(struct nk_str*);
Ivan Mahonin b53a5c
NK_API int nk_str_len_char(struct nk_str*);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/*===============================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                      TEXT EDITOR
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ===============================================================*/
Ivan Mahonin b53a5c
/*/// ### Text Editor
Ivan Mahonin b53a5c
/// Editing text in this library is handled by either `nk_edit_string` or
Ivan Mahonin b53a5c
/// `nk_edit_buffer`. But like almost everything in this library there are multiple
Ivan Mahonin b53a5c
/// ways of doing it and a balance between control and ease of use with memory
Ivan Mahonin b53a5c
/// as well as functionality controlled by flags.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// This library generally allows three different levels of memory control:
Ivan Mahonin b53a5c
/// First of is the most basic way of just providing a simple char array with
Ivan Mahonin b53a5c
/// string length. This method is probably the easiest way of handling simple
Ivan Mahonin b53a5c
/// user text input. Main upside is complete control over memory while the biggest
Ivan Mahonin b53a5c
/// downside in comparison with the other two approaches is missing undo/redo.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// For UIs that require undo/redo the second way was created. It is based on
Ivan Mahonin b53a5c
/// a fixed size nk_text_edit struct, which has an internal undo/redo stack.
Ivan Mahonin b53a5c
/// This is mainly useful if you want something more like a text editor but don't want
Ivan Mahonin b53a5c
/// to have a dynamically growing buffer.
Ivan Mahonin b53a5c
///
Ivan Mahonin b53a5c
/// The final way is using a dynamically growing nk_text_edit struct, which
Ivan Mahonin b53a5c
/// has both a default version if you don't care where memory comes from and an
Ivan Mahonin b53a5c
/// allocator version if you do. While the text editor is quite powerful for its
Ivan Mahonin b53a5c
/// complexity I would not recommend editing gigabytes of data with it.
Ivan Mahonin b53a5c
/// It is rather designed for uses cases which make sense for a GUI library not for
Ivan Mahonin b53a5c
/// an full blown text editor.
Ivan Mahonin b53a5c
 */
Ivan Mahonin b53a5c
#ifndef NK_TEXTEDIT_UNDOSTATECOUNT
Ivan Mahonin b53a5c
#define NK_TEXTEDIT_UNDOSTATECOUNT     99
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifndef NK_TEXTEDIT_UNDOCHARCOUNT
Ivan Mahonin b53a5c
#define NK_TEXTEDIT_UNDOCHARCOUNT      999
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_text_edit;
Ivan Mahonin b53a5c
struct nk_clipboard {
Ivan Mahonin b53a5c
    nk_handle userdata;
Ivan Mahonin b53a5c
    nk_plugin_paste paste;
Ivan Mahonin b53a5c
    nk_plugin_copy copy;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_text_undo_record {
Ivan Mahonin b53a5c
   int where;
Ivan Mahonin b53a5c
   short insert_length;
Ivan Mahonin b53a5c
   short delete_length;
Ivan Mahonin b53a5c
   short char_storage;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_text_undo_state {
Ivan Mahonin b53a5c
   struct nk_text_undo_record undo_rec[NK_TEXTEDIT_UNDOSTATECOUNT];
Ivan Mahonin b53a5c
   nk_rune undo_char[NK_TEXTEDIT_UNDOCHARCOUNT];
Ivan Mahonin b53a5c
   short undo_point;
Ivan Mahonin b53a5c
   short redo_point;
Ivan Mahonin b53a5c
   short undo_char_point;
Ivan Mahonin b53a5c
   short redo_char_point;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
enum nk_text_edit_type {
Ivan Mahonin b53a5c
    NK_TEXT_EDIT_SINGLE_LINE,
Ivan Mahonin b53a5c
    NK_TEXT_EDIT_MULTI_LINE
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
enum nk_text_edit_mode {
Ivan Mahonin b53a5c
    NK_TEXT_EDIT_MODE_VIEW,
Ivan Mahonin b53a5c
    NK_TEXT_EDIT_MODE_INSERT,
Ivan Mahonin b53a5c
    NK_TEXT_EDIT_MODE_REPLACE
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_text_edit {
Ivan Mahonin b53a5c
    struct nk_clipboard clip;
Ivan Mahonin b53a5c
    struct nk_str string;
Ivan Mahonin b53a5c
    nk_plugin_filter filter;
Ivan Mahonin b53a5c
    struct nk_vec2 scrollbar;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    int cursor;
Ivan Mahonin b53a5c
    int select_start;
Ivan Mahonin b53a5c
    int select_end;
Ivan Mahonin b53a5c
    unsigned char mode;
Ivan Mahonin b53a5c
    unsigned char cursor_at_end_of_line;
Ivan Mahonin b53a5c
    unsigned char initialized;
Ivan Mahonin b53a5c
    unsigned char has_preferred_x;
Ivan Mahonin b53a5c
    unsigned char single_line;
Ivan Mahonin b53a5c
    unsigned char active;
Ivan Mahonin b53a5c
    unsigned char padding1;
Ivan Mahonin b53a5c
    float preferred_x;
Ivan Mahonin b53a5c
    struct nk_text_undo_state undo;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* filter function */
Ivan Mahonin b53a5c
NK_API nk_bool nk_filter_default(const struct nk_text_edit*, nk_rune unicode);
Ivan Mahonin b53a5c
NK_API nk_bool nk_filter_ascii(const struct nk_text_edit*, nk_rune unicode);
Ivan Mahonin b53a5c
NK_API nk_bool nk_filter_float(const struct nk_text_edit*, nk_rune unicode);
Ivan Mahonin b53a5c
NK_API nk_bool nk_filter_decimal(const struct nk_text_edit*, nk_rune unicode);
Ivan Mahonin b53a5c
NK_API nk_bool nk_filter_hex(const struct nk_text_edit*, nk_rune unicode);
Ivan Mahonin b53a5c
NK_API nk_bool nk_filter_oct(const struct nk_text_edit*, nk_rune unicode);
Ivan Mahonin b53a5c
NK_API nk_bool nk_filter_binary(const struct nk_text_edit*, nk_rune unicode);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* text editor */
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_DEFAULT_ALLOCATOR
Ivan Mahonin b53a5c
NK_API void nk_textedit_init_default(struct nk_text_edit*);
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
NK_API void nk_textedit_init(struct nk_text_edit*, struct nk_allocator*, nk_size size);
Ivan Mahonin b53a5c
NK_API void nk_textedit_init_fixed(struct nk_text_edit*, void *memory, nk_size size);
Ivan Mahonin b53a5c
NK_API void nk_textedit_free(struct nk_text_edit*);
Ivan Mahonin b53a5c
NK_API void nk_textedit_text(struct nk_text_edit*, const char*, int total_len);
Ivan Mahonin b53a5c
NK_API void nk_textedit_delete(struct nk_text_edit*, int where, int len);
Ivan Mahonin b53a5c
NK_API void nk_textedit_delete_selection(struct nk_text_edit*);
Ivan Mahonin b53a5c
NK_API void nk_textedit_select_all(struct nk_text_edit*);
Ivan Mahonin b53a5c
NK_API nk_bool nk_textedit_cut(struct nk_text_edit*);
Ivan Mahonin b53a5c
NK_API nk_bool nk_textedit_paste(struct nk_text_edit*, char const*, int len);
Ivan Mahonin b53a5c
NK_API void nk_textedit_undo(struct nk_text_edit*);
Ivan Mahonin b53a5c
NK_API void nk_textedit_redo(struct nk_text_edit*);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* ===============================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                          DRAWING
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ===============================================================*/
Ivan Mahonin b53a5c
/*/// ### Drawing
Ivan Mahonin b53a5c
/// This library was designed to be render backend agnostic so it does
Ivan Mahonin b53a5c
/// not draw anything to screen. Instead all drawn shapes, widgets
Ivan Mahonin b53a5c
/// are made of, are buffered into memory and make up a command queue.
Ivan Mahonin b53a5c
/// Each frame therefore fills the command buffer with draw commands
Ivan Mahonin b53a5c
/// that then need to be executed by the user and his own render backend.
Ivan Mahonin b53a5c
/// After that the command buffer needs to be cleared and a new frame can be
Ivan Mahonin b53a5c
/// started. It is probably important to note that the command buffer is the main
Ivan Mahonin b53a5c
/// drawing API and the optional vertex buffer API only takes this format and
Ivan Mahonin b53a5c
/// converts it into a hardware accessible format.
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
/// To use the command queue to draw your own widgets you can access the
Ivan Mahonin b53a5c
/// command buffer of each window by calling `nk_window_get_canvas` after
Ivan Mahonin b53a5c
/// previously having called `nk_begin`:
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
/// ```c
Ivan Mahonin b53a5c
///     void draw_red_rectangle_widget(struct nk_context *ctx)
Ivan Mahonin b53a5c
///     {
Ivan Mahonin b53a5c
///         struct nk_command_buffer *canvas;
Ivan Mahonin b53a5c
///         struct nk_input *input = &ctx->input;
Ivan Mahonin b53a5c
///         canvas = nk_window_get_canvas(ctx);
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
///         struct nk_rect space;
Ivan Mahonin b53a5c
///         enum nk_widget_layout_states state;
Ivan Mahonin b53a5c
///         state = nk_widget(&space, ctx);
Ivan Mahonin b53a5c
///         if (!state) return;
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
///         if (state != NK_WIDGET_ROM)
Ivan Mahonin b53a5c
///             update_your_widget_by_user_input(...);
Ivan Mahonin b53a5c
///         nk_fill_rect(canvas, space, 0, nk_rgb(255,0,0));
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
///     if (nk_begin(...)) {
Ivan Mahonin b53a5c
///         nk_layout_row_dynamic(ctx, 25, 1);
Ivan Mahonin b53a5c
///         draw_red_rectangle_widget(ctx);
Ivan Mahonin b53a5c
///     }
Ivan Mahonin b53a5c
///     nk_end(..)
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
/// ```
Ivan Mahonin b53a5c
/// Important to know if you want to create your own widgets is the `nk_widget`
Ivan Mahonin b53a5c
/// call. It allocates space on the panel reserved for this widget to be used,
Ivan Mahonin b53a5c
/// but also returns the state of the widget space. If your widget is not seen and does
Ivan Mahonin b53a5c
/// not have to be updated it is '0' and you can just return. If it only has
Ivan Mahonin b53a5c
/// to be drawn the state will be `NK_WIDGET_ROM` otherwise you can do both
Ivan Mahonin b53a5c
/// update and draw your widget. The reason for separating is to only draw and
Ivan Mahonin b53a5c
/// update what is actually necessary which is crucial for performance.
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
enum nk_command_type {
Ivan Mahonin b53a5c
    NK_COMMAND_NOP,
Ivan Mahonin b53a5c
    NK_COMMAND_SCISSOR,
Ivan Mahonin b53a5c
    NK_COMMAND_LINE,
Ivan Mahonin b53a5c
    NK_COMMAND_CURVE,
Ivan Mahonin b53a5c
    NK_COMMAND_RECT,
Ivan Mahonin b53a5c
    NK_COMMAND_RECT_FILLED,
Ivan Mahonin b53a5c
    NK_COMMAND_RECT_MULTI_COLOR,
Ivan Mahonin b53a5c
    NK_COMMAND_CIRCLE,
Ivan Mahonin b53a5c
    NK_COMMAND_CIRCLE_FILLED,
Ivan Mahonin b53a5c
    NK_COMMAND_ARC,
Ivan Mahonin b53a5c
    NK_COMMAND_ARC_FILLED,
Ivan Mahonin b53a5c
    NK_COMMAND_TRIANGLE,
Ivan Mahonin b53a5c
    NK_COMMAND_TRIANGLE_FILLED,
Ivan Mahonin b53a5c
    NK_COMMAND_POLYGON,
Ivan Mahonin b53a5c
    NK_COMMAND_POLYGON_FILLED,
Ivan Mahonin b53a5c
    NK_COMMAND_POLYLINE,
Ivan Mahonin b53a5c
    NK_COMMAND_TEXT,
Ivan Mahonin b53a5c
    NK_COMMAND_IMAGE,
Ivan Mahonin b53a5c
    NK_COMMAND_CUSTOM
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* command base and header of every command inside the buffer */
Ivan Mahonin b53a5c
struct nk_command {
Ivan Mahonin b53a5c
    enum nk_command_type type;
Ivan Mahonin b53a5c
    nk_size next;
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_COMMAND_USERDATA
Ivan Mahonin b53a5c
    nk_handle userdata;
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_scissor {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    short x, y;
Ivan Mahonin b53a5c
    unsigned short w, h;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_line {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    unsigned short line_thickness;
Ivan Mahonin b53a5c
    struct nk_vec2i begin;
Ivan Mahonin b53a5c
    struct nk_vec2i end;
Ivan Mahonin b53a5c
    struct nk_color color;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_curve {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    unsigned short line_thickness;
Ivan Mahonin b53a5c
    struct nk_vec2i begin;
Ivan Mahonin b53a5c
    struct nk_vec2i end;
Ivan Mahonin b53a5c
    struct nk_vec2i ctrl[2];
Ivan Mahonin b53a5c
    struct nk_color color;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_rect {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    unsigned short rounding;
Ivan Mahonin b53a5c
    unsigned short line_thickness;
Ivan Mahonin b53a5c
    short x, y;
Ivan Mahonin b53a5c
    unsigned short w, h;
Ivan Mahonin b53a5c
    struct nk_color color;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_rect_filled {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    unsigned short rounding;
Ivan Mahonin b53a5c
    short x, y;
Ivan Mahonin b53a5c
    unsigned short w, h;
Ivan Mahonin b53a5c
    struct nk_color color;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_rect_multi_color {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    short x, y;
Ivan Mahonin b53a5c
    unsigned short w, h;
Ivan Mahonin b53a5c
    struct nk_color left;
Ivan Mahonin b53a5c
    struct nk_color top;
Ivan Mahonin b53a5c
    struct nk_color bottom;
Ivan Mahonin b53a5c
    struct nk_color right;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_triangle {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    unsigned short line_thickness;
Ivan Mahonin b53a5c
    struct nk_vec2i a;
Ivan Mahonin b53a5c
    struct nk_vec2i b;
Ivan Mahonin b53a5c
    struct nk_vec2i c;
Ivan Mahonin b53a5c
    struct nk_color color;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_triangle_filled {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    struct nk_vec2i a;
Ivan Mahonin b53a5c
    struct nk_vec2i b;
Ivan Mahonin b53a5c
    struct nk_vec2i c;
Ivan Mahonin b53a5c
    struct nk_color color;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_circle {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    short x, y;
Ivan Mahonin b53a5c
    unsigned short line_thickness;
Ivan Mahonin b53a5c
    unsigned short w, h;
Ivan Mahonin b53a5c
    struct nk_color color;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_circle_filled {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    short x, y;
Ivan Mahonin b53a5c
    unsigned short w, h;
Ivan Mahonin b53a5c
    struct nk_color color;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_arc {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    short cx, cy;
Ivan Mahonin b53a5c
    unsigned short r;
Ivan Mahonin b53a5c
    unsigned short line_thickness;
Ivan Mahonin b53a5c
    float a[2];
Ivan Mahonin b53a5c
    struct nk_color color;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_arc_filled {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    short cx, cy;
Ivan Mahonin b53a5c
    unsigned short r;
Ivan Mahonin b53a5c
    float a[2];
Ivan Mahonin b53a5c
    struct nk_color color;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_polygon {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    struct nk_color color;
Ivan Mahonin b53a5c
    unsigned short line_thickness;
Ivan Mahonin b53a5c
    unsigned short point_count;
Ivan Mahonin b53a5c
    struct nk_vec2i points[1];
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_polygon_filled {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    struct nk_color color;
Ivan Mahonin b53a5c
    unsigned short point_count;
Ivan Mahonin b53a5c
    struct nk_vec2i points[1];
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_polyline {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    struct nk_color color;
Ivan Mahonin b53a5c
    unsigned short line_thickness;
Ivan Mahonin b53a5c
    unsigned short point_count;
Ivan Mahonin b53a5c
    struct nk_vec2i points[1];
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_image {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    short x, y;
Ivan Mahonin b53a5c
    unsigned short w, h;
Ivan Mahonin b53a5c
    struct nk_image img;
Ivan Mahonin b53a5c
    struct nk_color col;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
typedef void (*nk_command_custom_callback)(void *canvas, short x,short y,
Ivan Mahonin b53a5c
    unsigned short w, unsigned short h, nk_handle callback_data);
Ivan Mahonin b53a5c
struct nk_command_custom {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    short x, y;
Ivan Mahonin b53a5c
    unsigned short w, h;
Ivan Mahonin b53a5c
    nk_handle callback_data;
Ivan Mahonin b53a5c
    nk_command_custom_callback callback;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_text {
Ivan Mahonin b53a5c
    struct nk_command header;
Ivan Mahonin b53a5c
    const struct nk_user_font *font;
Ivan Mahonin b53a5c
    struct nk_color background;
Ivan Mahonin b53a5c
    struct nk_color foreground;
Ivan Mahonin b53a5c
    short x, y;
Ivan Mahonin b53a5c
    unsigned short w, h;
Ivan Mahonin b53a5c
    float height;
Ivan Mahonin b53a5c
    int length;
Ivan Mahonin b53a5c
    char string[1];
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
enum nk_command_clipping {
Ivan Mahonin b53a5c
    NK_CLIPPING_OFF = nk_false,
Ivan Mahonin b53a5c
    NK_CLIPPING_ON = nk_true
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_command_buffer {
Ivan Mahonin b53a5c
    struct nk_buffer *base;
Ivan Mahonin b53a5c
    struct nk_rect clip;
Ivan Mahonin b53a5c
    int use_clipping;
Ivan Mahonin b53a5c
    nk_handle userdata;
Ivan Mahonin b53a5c
    nk_size begin, end, last;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* shape outlines */
Ivan Mahonin b53a5c
NK_API void nk_stroke_line(struct nk_command_buffer *b, float x0, float y0, float x1, float y1, float line_thickness, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_stroke_curve(struct nk_command_buffer*, float, float, float, float, float, float, float, float, float line_thickness, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_stroke_rect(struct nk_command_buffer*, struct nk_rect, float rounding, float line_thickness, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_stroke_circle(struct nk_command_buffer*, struct nk_rect, float line_thickness, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_stroke_arc(struct nk_command_buffer*, float cx, float cy, float radius, float a_min, float a_max, float line_thickness, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_stroke_triangle(struct nk_command_buffer*, float, float, float, float, float, float, float line_thichness, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_stroke_polyline(struct nk_command_buffer*, float *points, int point_count, float line_thickness, struct nk_color col);
Ivan Mahonin b53a5c
NK_API void nk_stroke_polygon(struct nk_command_buffer*, float*, int point_count, float line_thickness, struct nk_color);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* filled shades */
Ivan Mahonin b53a5c
NK_API void nk_fill_rect(struct nk_command_buffer*, struct nk_rect, float rounding, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_fill_rect_multi_color(struct nk_command_buffer*, struct nk_rect, struct nk_color left, struct nk_color top, struct nk_color right, struct nk_color bottom);
Ivan Mahonin b53a5c
NK_API void nk_fill_circle(struct nk_command_buffer*, struct nk_rect, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_fill_arc(struct nk_command_buffer*, float cx, float cy, float radius, float a_min, float a_max, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_fill_triangle(struct nk_command_buffer*, float x0, float y0, float x1, float y1, float x2, float y2, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_fill_polygon(struct nk_command_buffer*, float*, int point_count, struct nk_color);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* misc */
Ivan Mahonin b53a5c
NK_API void nk_draw_image(struct nk_command_buffer*, struct nk_rect, const struct nk_image*, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_draw_nine_slice(struct nk_command_buffer*, struct nk_rect, const struct nk_nine_slice*, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_draw_text(struct nk_command_buffer*, struct nk_rect, const char *text, int len, const struct nk_user_font*, struct nk_color, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_push_scissor(struct nk_command_buffer*, struct nk_rect);
Ivan Mahonin b53a5c
NK_API void nk_push_custom(struct nk_command_buffer*, struct nk_rect, nk_command_custom_callback, nk_handle usr);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* ===============================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                          INPUT
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ===============================================================*/
Ivan Mahonin b53a5c
struct nk_mouse_button {
Ivan Mahonin b53a5c
    nk_bool down;
Ivan Mahonin b53a5c
    unsigned int clicked;
Ivan Mahonin b53a5c
    struct nk_vec2 clicked_pos;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
struct nk_mouse {
Ivan Mahonin b53a5c
    struct nk_mouse_button buttons[NK_BUTTON_MAX];
Ivan Mahonin b53a5c
    struct nk_vec2 pos;
Ivan Mahonin b53a5c
#ifdef NK_BUTTON_TRIGGER_ON_RELEASE
Ivan Mahonin b53a5c
    struct nk_vec2 down_pos;
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
    struct nk_vec2 prev;
Ivan Mahonin b53a5c
    struct nk_vec2 delta;
Ivan Mahonin b53a5c
    struct nk_vec2 scroll_delta;
Ivan Mahonin b53a5c
    unsigned char grab;
Ivan Mahonin b53a5c
    unsigned char grabbed;
Ivan Mahonin b53a5c
    unsigned char ungrab;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_key {
Ivan Mahonin b53a5c
    nk_bool down;
Ivan Mahonin b53a5c
    unsigned int clicked;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
struct nk_keyboard {
Ivan Mahonin b53a5c
    struct nk_key keys[NK_KEY_MAX];
Ivan Mahonin b53a5c
    char text[NK_INPUT_MAX];
Ivan Mahonin b53a5c
    int text_len;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_input {
Ivan Mahonin b53a5c
    struct nk_keyboard keyboard;
Ivan Mahonin b53a5c
    struct nk_mouse mouse;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API nk_bool nk_input_has_mouse_click(const struct nk_input*, enum nk_buttons);
Ivan Mahonin b53a5c
NK_API nk_bool nk_input_has_mouse_click_in_rect(const struct nk_input*, enum nk_buttons, struct nk_rect);
Ivan Mahonin b53a5c
NK_API nk_bool nk_input_has_mouse_click_in_button_rect(const struct nk_input*, enum nk_buttons, struct nk_rect);
Ivan Mahonin b53a5c
NK_API nk_bool nk_input_has_mouse_click_down_in_rect(const struct nk_input*, enum nk_buttons, struct nk_rect, nk_bool down);
Ivan Mahonin b53a5c
NK_API nk_bool nk_input_is_mouse_click_in_rect(const struct nk_input*, enum nk_buttons, struct nk_rect);
Ivan Mahonin b53a5c
NK_API nk_bool nk_input_is_mouse_click_down_in_rect(const struct nk_input *i, enum nk_buttons id, struct nk_rect b, nk_bool down);
Ivan Mahonin b53a5c
NK_API nk_bool nk_input_any_mouse_click_in_rect(const struct nk_input*, struct nk_rect);
Ivan Mahonin b53a5c
NK_API nk_bool nk_input_is_mouse_prev_hovering_rect(const struct nk_input*, struct nk_rect);
Ivan Mahonin b53a5c
NK_API nk_bool nk_input_is_mouse_hovering_rect(const struct nk_input*, struct nk_rect);
Ivan Mahonin b53a5c
NK_API nk_bool nk_input_mouse_clicked(const struct nk_input*, enum nk_buttons, struct nk_rect);
Ivan Mahonin b53a5c
NK_API nk_bool nk_input_is_mouse_down(const struct nk_input*, enum nk_buttons);
Ivan Mahonin b53a5c
NK_API nk_bool nk_input_is_mouse_pressed(const struct nk_input*, enum nk_buttons);
Ivan Mahonin b53a5c
NK_API nk_bool nk_input_is_mouse_released(const struct nk_input*, enum nk_buttons);
Ivan Mahonin b53a5c
NK_API nk_bool nk_input_is_key_pressed(const struct nk_input*, enum nk_keys);
Ivan Mahonin b53a5c
NK_API nk_bool nk_input_is_key_released(const struct nk_input*, enum nk_keys);
Ivan Mahonin b53a5c
NK_API nk_bool nk_input_is_key_down(const struct nk_input*, enum nk_keys);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* ===============================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                          DRAW LIST
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ===============================================================*/
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_VERTEX_BUFFER_OUTPUT
Ivan Mahonin b53a5c
/* ### Draw List
Ivan Mahonin b53a5c
/// The optional vertex buffer draw list provides a 2D drawing context
Ivan Mahonin b53a5c
/// with antialiasing functionality which takes basic filled or outlined shapes
Ivan Mahonin b53a5c
/// or a path and outputs vertexes, elements and draw commands.
Ivan Mahonin b53a5c
/// The actual draw list API is not required to be used directly while using this
Ivan Mahonin b53a5c
/// library since converting the default library draw command output is done by
Ivan Mahonin b53a5c
/// just calling `nk_convert` but I decided to still make this library accessible
Ivan Mahonin b53a5c
/// since it can be useful.
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
/// The draw list is based on a path buffering and polygon and polyline
Ivan Mahonin b53a5c
/// rendering API which allows a lot of ways to draw 2D content to screen.
Ivan Mahonin b53a5c
/// In fact it is probably more powerful than needed but allows even more crazy
Ivan Mahonin b53a5c
/// things than this library provides by default.
Ivan Mahonin b53a5c
*/
Ivan Mahonin b53a5c
#ifdef NK_UINT_DRAW_INDEX
Ivan Mahonin b53a5c
typedef nk_uint nk_draw_index;
Ivan Mahonin b53a5c
#else
Ivan Mahonin b53a5c
typedef nk_ushort nk_draw_index;
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
enum nk_draw_list_stroke {
Ivan Mahonin b53a5c
    NK_STROKE_OPEN = nk_false,
Ivan Mahonin b53a5c
    /* build up path has no connection back to the beginning */
Ivan Mahonin b53a5c
    NK_STROKE_CLOSED = nk_true
Ivan Mahonin b53a5c
    /* build up path has a connection back to the beginning */
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
enum nk_draw_vertex_layout_attribute {
Ivan Mahonin b53a5c
    NK_VERTEX_POSITION,
Ivan Mahonin b53a5c
    NK_VERTEX_COLOR,
Ivan Mahonin b53a5c
    NK_VERTEX_TEXCOORD,
Ivan Mahonin b53a5c
    NK_VERTEX_ATTRIBUTE_COUNT
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
enum nk_draw_vertex_layout_format {
Ivan Mahonin b53a5c
    NK_FORMAT_SCHAR,
Ivan Mahonin b53a5c
    NK_FORMAT_SSHORT,
Ivan Mahonin b53a5c
    NK_FORMAT_SINT,
Ivan Mahonin b53a5c
    NK_FORMAT_UCHAR,
Ivan Mahonin b53a5c
    NK_FORMAT_USHORT,
Ivan Mahonin b53a5c
    NK_FORMAT_UINT,
Ivan Mahonin b53a5c
    NK_FORMAT_FLOAT,
Ivan Mahonin b53a5c
    NK_FORMAT_DOUBLE,
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_FORMAT_COLOR_BEGIN,
Ivan Mahonin b53a5c
    NK_FORMAT_R8G8B8 = NK_FORMAT_COLOR_BEGIN,
Ivan Mahonin b53a5c
    NK_FORMAT_R16G15B16,
Ivan Mahonin b53a5c
    NK_FORMAT_R32G32B32,
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    NK_FORMAT_R8G8B8A8,
Ivan Mahonin b53a5c
    NK_FORMAT_B8G8R8A8,
Ivan Mahonin b53a5c
    NK_FORMAT_R16G15B16A16,
Ivan Mahonin b53a5c
    NK_FORMAT_R32G32B32A32,
Ivan Mahonin b53a5c
    NK_FORMAT_R32G32B32A32_FLOAT,
Ivan Mahonin b53a5c
    NK_FORMAT_R32G32B32A32_DOUBLE,
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    NK_FORMAT_RGB32,
Ivan Mahonin b53a5c
    NK_FORMAT_RGBA32,
Ivan Mahonin b53a5c
NK_FORMAT_COLOR_END = NK_FORMAT_RGBA32,
Ivan Mahonin b53a5c
    NK_FORMAT_COUNT
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#define NK_VERTEX_LAYOUT_END NK_VERTEX_ATTRIBUTE_COUNT,NK_FORMAT_COUNT,0
Ivan Mahonin b53a5c
struct nk_draw_vertex_layout_element {
Ivan Mahonin b53a5c
    enum nk_draw_vertex_layout_attribute attribute;
Ivan Mahonin b53a5c
    enum nk_draw_vertex_layout_format format;
Ivan Mahonin b53a5c
    nk_size offset;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_draw_command {
Ivan Mahonin b53a5c
    unsigned int elem_count;
Ivan Mahonin b53a5c
    /* number of elements in the current draw batch */
Ivan Mahonin b53a5c
    struct nk_rect clip_rect;
Ivan Mahonin b53a5c
    /* current screen clipping rectangle */
Ivan Mahonin b53a5c
    nk_handle texture;
Ivan Mahonin b53a5c
    /* current texture to set */
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_COMMAND_USERDATA
Ivan Mahonin b53a5c
    nk_handle userdata;
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_draw_list {
Ivan Mahonin b53a5c
    struct nk_rect clip_rect;
Ivan Mahonin b53a5c
    struct nk_vec2 circle_vtx[12];
Ivan Mahonin b53a5c
    struct nk_convert_config config;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    struct nk_buffer *buffer;
Ivan Mahonin b53a5c
    struct nk_buffer *vertices;
Ivan Mahonin b53a5c
    struct nk_buffer *elements;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    unsigned int element_count;
Ivan Mahonin b53a5c
    unsigned int vertex_count;
Ivan Mahonin b53a5c
    unsigned int cmd_count;
Ivan Mahonin b53a5c
    nk_size cmd_offset;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    unsigned int path_count;
Ivan Mahonin b53a5c
    unsigned int path_offset;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    enum nk_anti_aliasing line_AA;
Ivan Mahonin b53a5c
    enum nk_anti_aliasing shape_AA;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_COMMAND_USERDATA
Ivan Mahonin b53a5c
    nk_handle userdata;
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* draw list */
Ivan Mahonin b53a5c
NK_API void nk_draw_list_init(struct nk_draw_list*);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_setup(struct nk_draw_list*, const struct nk_convert_config*, struct nk_buffer *cmds, struct nk_buffer *vertices, struct nk_buffer *elements, enum nk_anti_aliasing line_aa,enum nk_anti_aliasing shape_aa);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* drawing */
Ivan Mahonin b53a5c
#define nk_draw_list_foreach(cmd, can, b) for((cmd)=nk__draw_list_begin(can, b); (cmd)!=0; (cmd)=nk__draw_list_next(cmd, b, can))
Ivan Mahonin b53a5c
NK_API const struct nk_draw_command* nk__draw_list_begin(const struct nk_draw_list*, const struct nk_buffer*);
Ivan Mahonin b53a5c
NK_API const struct nk_draw_command* nk__draw_list_next(const struct nk_draw_command*, const struct nk_buffer*, const struct nk_draw_list*);
Ivan Mahonin b53a5c
NK_API const struct nk_draw_command* nk__draw_list_end(const struct nk_draw_list*, const struct nk_buffer*);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* path */
Ivan Mahonin b53a5c
NK_API void nk_draw_list_path_clear(struct nk_draw_list*);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_path_line_to(struct nk_draw_list*, struct nk_vec2 pos);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_path_arc_to_fast(struct nk_draw_list*, struct nk_vec2 center, float radius, int a_min, int a_max);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_path_arc_to(struct nk_draw_list*, struct nk_vec2 center, float radius, float a_min, float a_max, unsigned int segments);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_path_rect_to(struct nk_draw_list*, struct nk_vec2 a, struct nk_vec2 b, float rounding);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_path_curve_to(struct nk_draw_list*, struct nk_vec2 p2, struct nk_vec2 p3, struct nk_vec2 p4, unsigned int num_segments);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_path_fill(struct nk_draw_list*, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_path_stroke(struct nk_draw_list*, struct nk_color, enum nk_draw_list_stroke closed, float thickness);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* stroke */
Ivan Mahonin b53a5c
NK_API void nk_draw_list_stroke_line(struct nk_draw_list*, struct nk_vec2 a, struct nk_vec2 b, struct nk_color, float thickness);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_stroke_rect(struct nk_draw_list*, struct nk_rect rect, struct nk_color, float rounding, float thickness);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_stroke_triangle(struct nk_draw_list*, struct nk_vec2 a, struct nk_vec2 b, struct nk_vec2 c, struct nk_color, float thickness);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_stroke_circle(struct nk_draw_list*, struct nk_vec2 center, float radius, struct nk_color, unsigned int segs, float thickness);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_stroke_curve(struct nk_draw_list*, struct nk_vec2 p0, struct nk_vec2 cp0, struct nk_vec2 cp1, struct nk_vec2 p1, struct nk_color, unsigned int segments, float thickness);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_stroke_poly_line(struct nk_draw_list*, const struct nk_vec2 *pnts, const unsigned int cnt, struct nk_color, enum nk_draw_list_stroke, float thickness, enum nk_anti_aliasing);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* fill */
Ivan Mahonin b53a5c
NK_API void nk_draw_list_fill_rect(struct nk_draw_list*, struct nk_rect rect, struct nk_color, float rounding);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_fill_rect_multi_color(struct nk_draw_list*, struct nk_rect rect, struct nk_color left, struct nk_color top, struct nk_color right, struct nk_color bottom);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_fill_triangle(struct nk_draw_list*, struct nk_vec2 a, struct nk_vec2 b, struct nk_vec2 c, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_fill_circle(struct nk_draw_list*, struct nk_vec2 center, float radius, struct nk_color col, unsigned int segs);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_fill_poly_convex(struct nk_draw_list*, const struct nk_vec2 *points, const unsigned int count, struct nk_color, enum nk_anti_aliasing);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* misc */
Ivan Mahonin b53a5c
NK_API void nk_draw_list_add_image(struct nk_draw_list*, struct nk_image texture, struct nk_rect rect, struct nk_color);
Ivan Mahonin b53a5c
NK_API void nk_draw_list_add_text(struct nk_draw_list*, const struct nk_user_font*, struct nk_rect, const char *text, int len, float font_height, struct nk_color);
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_COMMAND_USERDATA
Ivan Mahonin b53a5c
NK_API void nk_draw_list_push_userdata(struct nk_draw_list*, nk_handle userdata);
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* ===============================================================
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 *                          GUI
Ivan Mahonin b53a5c
 *
Ivan Mahonin b53a5c
 * ===============================================================*/
Ivan Mahonin b53a5c
enum nk_style_item_type {
Ivan Mahonin b53a5c
    NK_STYLE_ITEM_COLOR,
Ivan Mahonin b53a5c
    NK_STYLE_ITEM_IMAGE,
Ivan Mahonin b53a5c
    NK_STYLE_ITEM_NINE_SLICE
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
union nk_style_item_data {
Ivan Mahonin b53a5c
    struct nk_color color;
Ivan Mahonin b53a5c
    struct nk_image image;
Ivan Mahonin b53a5c
    struct nk_nine_slice slice;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_style_item {
Ivan Mahonin b53a5c
    enum nk_style_item_type type;
Ivan Mahonin b53a5c
    union nk_style_item_data data;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_style_text {
Ivan Mahonin b53a5c
    struct nk_color color;
Ivan Mahonin b53a5c
    struct nk_vec2 padding;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_style_button {
Ivan Mahonin b53a5c
    /* background */
Ivan Mahonin b53a5c
    struct nk_style_item normal;
Ivan Mahonin b53a5c
    struct nk_style_item hover;
Ivan Mahonin b53a5c
    struct nk_style_item active;
Ivan Mahonin b53a5c
    struct nk_color border_color;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* text */
Ivan Mahonin b53a5c
    struct nk_color text_background;
Ivan Mahonin b53a5c
    struct nk_color text_normal;
Ivan Mahonin b53a5c
    struct nk_color text_hover;
Ivan Mahonin b53a5c
    struct nk_color text_active;
Ivan Mahonin b53a5c
    nk_flags text_alignment;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* properties */
Ivan Mahonin b53a5c
    float border;
Ivan Mahonin b53a5c
    float rounding;
Ivan Mahonin b53a5c
    struct nk_vec2 padding;
Ivan Mahonin b53a5c
    struct nk_vec2 image_padding;
Ivan Mahonin b53a5c
    struct nk_vec2 touch_padding;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* optional user callbacks */
Ivan Mahonin b53a5c
    nk_handle userdata;
Ivan Mahonin b53a5c
    void(*draw_begin)(struct nk_command_buffer*, nk_handle userdata);
Ivan Mahonin b53a5c
    void(*draw_end)(struct nk_command_buffer*, nk_handle userdata);
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_style_toggle {
Ivan Mahonin b53a5c
    /* background */
Ivan Mahonin b53a5c
    struct nk_style_item normal;
Ivan Mahonin b53a5c
    struct nk_style_item hover;
Ivan Mahonin b53a5c
    struct nk_style_item active;
Ivan Mahonin b53a5c
    struct nk_color border_color;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* cursor */
Ivan Mahonin b53a5c
    struct nk_style_item cursor_normal;
Ivan Mahonin b53a5c
    struct nk_style_item cursor_hover;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* text */
Ivan Mahonin b53a5c
    struct nk_color text_normal;
Ivan Mahonin b53a5c
    struct nk_color text_hover;
Ivan Mahonin b53a5c
    struct nk_color text_active;
Ivan Mahonin b53a5c
    struct nk_color text_background;
Ivan Mahonin b53a5c
    nk_flags text_alignment;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* properties */
Ivan Mahonin b53a5c
    struct nk_vec2 padding;
Ivan Mahonin b53a5c
    struct nk_vec2 touch_padding;
Ivan Mahonin b53a5c
    float spacing;
Ivan Mahonin b53a5c
    float border;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* optional user callbacks */
Ivan Mahonin b53a5c
    nk_handle userdata;
Ivan Mahonin b53a5c
    void(*draw_begin)(struct nk_command_buffer*, nk_handle);
Ivan Mahonin b53a5c
    void(*draw_end)(struct nk_command_buffer*, nk_handle);
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_style_selectable {
Ivan Mahonin b53a5c
    /* background (inactive) */
Ivan Mahonin b53a5c
    struct nk_style_item normal;
Ivan Mahonin b53a5c
    struct nk_style_item hover;
Ivan Mahonin b53a5c
    struct nk_style_item pressed;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* background (active) */
Ivan Mahonin b53a5c
    struct nk_style_item normal_active;
Ivan Mahonin b53a5c
    struct nk_style_item hover_active;
Ivan Mahonin b53a5c
    struct nk_style_item pressed_active;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* text color (inactive) */
Ivan Mahonin b53a5c
    struct nk_color text_normal;
Ivan Mahonin b53a5c
    struct nk_color text_hover;
Ivan Mahonin b53a5c
    struct nk_color text_pressed;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* text color (active) */
Ivan Mahonin b53a5c
    struct nk_color text_normal_active;
Ivan Mahonin b53a5c
    struct nk_color text_hover_active;
Ivan Mahonin b53a5c
    struct nk_color text_pressed_active;
Ivan Mahonin b53a5c
    struct nk_color text_background;
Ivan Mahonin b53a5c
    nk_flags text_alignment;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* properties */
Ivan Mahonin b53a5c
    float rounding;
Ivan Mahonin b53a5c
    struct nk_vec2 padding;
Ivan Mahonin b53a5c
    struct nk_vec2 touch_padding;
Ivan Mahonin b53a5c
    struct nk_vec2 image_padding;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* optional user callbacks */
Ivan Mahonin b53a5c
    nk_handle userdata;
Ivan Mahonin b53a5c
    void(*draw_begin)(struct nk_command_buffer*, nk_handle);
Ivan Mahonin b53a5c
    void(*draw_end)(struct nk_command_buffer*, nk_handle);
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_style_slider {
Ivan Mahonin b53a5c
    /* background */
Ivan Mahonin b53a5c
    struct nk_style_item normal;
Ivan Mahonin b53a5c
    struct nk_style_item hover;
Ivan Mahonin b53a5c
    struct nk_style_item active;
Ivan Mahonin b53a5c
    struct nk_color border_color;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* background bar */
Ivan Mahonin b53a5c
    struct nk_color bar_normal;
Ivan Mahonin b53a5c
    struct nk_color bar_hover;
Ivan Mahonin b53a5c
    struct nk_color bar_active;
Ivan Mahonin b53a5c
    struct nk_color bar_filled;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* cursor */
Ivan Mahonin b53a5c
    struct nk_style_item cursor_normal;
Ivan Mahonin b53a5c
    struct nk_style_item cursor_hover;
Ivan Mahonin b53a5c
    struct nk_style_item cursor_active;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* properties */
Ivan Mahonin b53a5c
    float border;
Ivan Mahonin b53a5c
    float rounding;
Ivan Mahonin b53a5c
    float bar_height;
Ivan Mahonin b53a5c
    struct nk_vec2 padding;
Ivan Mahonin b53a5c
    struct nk_vec2 spacing;
Ivan Mahonin b53a5c
    struct nk_vec2 cursor_size;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* optional buttons */
Ivan Mahonin b53a5c
    int show_buttons;
Ivan Mahonin b53a5c
    struct nk_style_button inc_button;
Ivan Mahonin b53a5c
    struct nk_style_button dec_button;
Ivan Mahonin b53a5c
    enum nk_symbol_type inc_symbol;
Ivan Mahonin b53a5c
    enum nk_symbol_type dec_symbol;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* optional user callbacks */
Ivan Mahonin b53a5c
    nk_handle userdata;
Ivan Mahonin b53a5c
    void(*draw_begin)(struct nk_command_buffer*, nk_handle);
Ivan Mahonin b53a5c
    void(*draw_end)(struct nk_command_buffer*, nk_handle);
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_style_progress {
Ivan Mahonin b53a5c
    /* background */
Ivan Mahonin b53a5c
    struct nk_style_item normal;
Ivan Mahonin b53a5c
    struct nk_style_item hover;
Ivan Mahonin b53a5c
    struct nk_style_item active;
Ivan Mahonin b53a5c
    struct nk_color border_color;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* cursor */
Ivan Mahonin b53a5c
    struct nk_style_item cursor_normal;
Ivan Mahonin b53a5c
    struct nk_style_item cursor_hover;
Ivan Mahonin b53a5c
    struct nk_style_item cursor_active;
Ivan Mahonin b53a5c
    struct nk_color cursor_border_color;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* properties */
Ivan Mahonin b53a5c
    float rounding;
Ivan Mahonin b53a5c
    float border;
Ivan Mahonin b53a5c
    float cursor_border;
Ivan Mahonin b53a5c
    float cursor_rounding;
Ivan Mahonin b53a5c
    struct nk_vec2 padding;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* optional user callbacks */
Ivan Mahonin b53a5c
    nk_handle userdata;
Ivan Mahonin b53a5c
    void(*draw_begin)(struct nk_command_buffer*, nk_handle);
Ivan Mahonin b53a5c
    void(*draw_end)(struct nk_command_buffer*, nk_handle);
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_style_scrollbar {
Ivan Mahonin b53a5c
    /* background */
Ivan Mahonin b53a5c
    struct nk_style_item normal;
Ivan Mahonin b53a5c
    struct nk_style_item hover;
Ivan Mahonin b53a5c
    struct nk_style_item active;
Ivan Mahonin b53a5c
    struct nk_color border_color;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* cursor */
Ivan Mahonin b53a5c
    struct nk_style_item cursor_normal;
Ivan Mahonin b53a5c
    struct nk_style_item cursor_hover;
Ivan Mahonin b53a5c
    struct nk_style_item cursor_active;
Ivan Mahonin b53a5c
    struct nk_color cursor_border_color;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* properties */
Ivan Mahonin b53a5c
    float border;
Ivan Mahonin b53a5c
    float rounding;
Ivan Mahonin b53a5c
    float border_cursor;
Ivan Mahonin b53a5c
    float rounding_cursor;
Ivan Mahonin b53a5c
    struct nk_vec2 padding;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* optional buttons */
Ivan Mahonin b53a5c
    int show_buttons;
Ivan Mahonin b53a5c
    struct nk_style_button inc_button;
Ivan Mahonin b53a5c
    struct nk_style_button dec_button;
Ivan Mahonin b53a5c
    enum nk_symbol_type inc_symbol;
Ivan Mahonin b53a5c
    enum nk_symbol_type dec_symbol;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* optional user callbacks */
Ivan Mahonin b53a5c
    nk_handle userdata;
Ivan Mahonin b53a5c
    void(*draw_begin)(struct nk_command_buffer*, nk_handle);
Ivan Mahonin b53a5c
    void(*draw_end)(struct nk_command_buffer*, nk_handle);
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_style_edit {
Ivan Mahonin b53a5c
    /* background */
Ivan Mahonin b53a5c
    struct nk_style_item normal;
Ivan Mahonin b53a5c
    struct nk_style_item hover;
Ivan Mahonin b53a5c
    struct nk_style_item active;
Ivan Mahonin b53a5c
    struct nk_color border_color;
Ivan Mahonin b53a5c
    struct nk_style_scrollbar scrollbar;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* cursor  */
Ivan Mahonin b53a5c
    struct nk_color cursor_normal;
Ivan Mahonin b53a5c
    struct nk_color cursor_hover;
Ivan Mahonin b53a5c
    struct nk_color cursor_text_normal;
Ivan Mahonin b53a5c
    struct nk_color cursor_text_hover;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* text (unselected) */
Ivan Mahonin b53a5c
    struct nk_color text_normal;
Ivan Mahonin b53a5c
    struct nk_color text_hover;
Ivan Mahonin b53a5c
    struct nk_color text_active;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* text (selected) */
Ivan Mahonin b53a5c
    struct nk_color selected_normal;
Ivan Mahonin b53a5c
    struct nk_color selected_hover;
Ivan Mahonin b53a5c
    struct nk_color selected_text_normal;
Ivan Mahonin b53a5c
    struct nk_color selected_text_hover;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* properties */
Ivan Mahonin b53a5c
    float border;
Ivan Mahonin b53a5c
    float rounding;
Ivan Mahonin b53a5c
    float cursor_size;
Ivan Mahonin b53a5c
    struct nk_vec2 scrollbar_size;
Ivan Mahonin b53a5c
    struct nk_vec2 padding;
Ivan Mahonin b53a5c
    float row_padding;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_style_property {
Ivan Mahonin b53a5c
    /* background */
Ivan Mahonin b53a5c
    struct nk_style_item normal;
Ivan Mahonin b53a5c
    struct nk_style_item hover;
Ivan Mahonin b53a5c
    struct nk_style_item active;
Ivan Mahonin b53a5c
    struct nk_color border_color;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* text */
Ivan Mahonin b53a5c
    struct nk_color label_normal;
Ivan Mahonin b53a5c
    struct nk_color label_hover;
Ivan Mahonin b53a5c
    struct nk_color label_active;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* symbols */
Ivan Mahonin b53a5c
    enum nk_symbol_type sym_left;
Ivan Mahonin b53a5c
    enum nk_symbol_type sym_right;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* properties */
Ivan Mahonin b53a5c
    float border;
Ivan Mahonin b53a5c
    float rounding;
Ivan Mahonin b53a5c
    struct nk_vec2 padding;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    struct nk_style_edit edit;
Ivan Mahonin b53a5c
    struct nk_style_button inc_button;
Ivan Mahonin b53a5c
    struct nk_style_button dec_button;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* optional user callbacks */
Ivan Mahonin b53a5c
    nk_handle userdata;
Ivan Mahonin b53a5c
    void(*draw_begin)(struct nk_command_buffer*, nk_handle);
Ivan Mahonin b53a5c
    void(*draw_end)(struct nk_command_buffer*, nk_handle);
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_style_chart {
Ivan Mahonin b53a5c
    /* colors */
Ivan Mahonin b53a5c
    struct nk_style_item background;
Ivan Mahonin b53a5c
    struct nk_color border_color;
Ivan Mahonin b53a5c
    struct nk_color selected_color;
Ivan Mahonin b53a5c
    struct nk_color color;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* properties */
Ivan Mahonin b53a5c
    float border;
Ivan Mahonin b53a5c
    float rounding;
Ivan Mahonin b53a5c
    struct nk_vec2 padding;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_style_combo {
Ivan Mahonin b53a5c
    /* background */
Ivan Mahonin b53a5c
    struct nk_style_item normal;
Ivan Mahonin b53a5c
    struct nk_style_item hover;
Ivan Mahonin b53a5c
    struct nk_style_item active;
Ivan Mahonin b53a5c
    struct nk_color border_color;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* label */
Ivan Mahonin b53a5c
    struct nk_color label_normal;
Ivan Mahonin b53a5c
    struct nk_color label_hover;
Ivan Mahonin b53a5c
    struct nk_color label_active;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* symbol */
Ivan Mahonin b53a5c
    struct nk_color symbol_normal;
Ivan Mahonin b53a5c
    struct nk_color symbol_hover;
Ivan Mahonin b53a5c
    struct nk_color symbol_active;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* button */
Ivan Mahonin b53a5c
    struct nk_style_button button;
Ivan Mahonin b53a5c
    enum nk_symbol_type sym_normal;
Ivan Mahonin b53a5c
    enum nk_symbol_type sym_hover;
Ivan Mahonin b53a5c
    enum nk_symbol_type sym_active;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* properties */
Ivan Mahonin b53a5c
    float border;
Ivan Mahonin b53a5c
    float rounding;
Ivan Mahonin b53a5c
    struct nk_vec2 content_padding;
Ivan Mahonin b53a5c
    struct nk_vec2 button_padding;
Ivan Mahonin b53a5c
    struct nk_vec2 spacing;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_style_tab {
Ivan Mahonin b53a5c
    /* background */
Ivan Mahonin b53a5c
    struct nk_style_item background;
Ivan Mahonin b53a5c
    struct nk_color border_color;
Ivan Mahonin b53a5c
    struct nk_color text;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* button */
Ivan Mahonin b53a5c
    struct nk_style_button tab_maximize_button;
Ivan Mahonin b53a5c
    struct nk_style_button tab_minimize_button;
Ivan Mahonin b53a5c
    struct nk_style_button node_maximize_button;
Ivan Mahonin b53a5c
    struct nk_style_button node_minimize_button;
Ivan Mahonin b53a5c
    enum nk_symbol_type sym_minimize;
Ivan Mahonin b53a5c
    enum nk_symbol_type sym_maximize;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* properties */
Ivan Mahonin b53a5c
    float border;
Ivan Mahonin b53a5c
    float rounding;
Ivan Mahonin b53a5c
    float indent;
Ivan Mahonin b53a5c
    struct nk_vec2 padding;
Ivan Mahonin b53a5c
    struct nk_vec2 spacing;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
enum nk_style_header_align {
Ivan Mahonin b53a5c
    NK_HEADER_LEFT,
Ivan Mahonin b53a5c
    NK_HEADER_RIGHT
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
struct nk_style_window_header {
Ivan Mahonin b53a5c
    /* background */
Ivan Mahonin b53a5c
    struct nk_style_item normal;
Ivan Mahonin b53a5c
    struct nk_style_item hover;
Ivan Mahonin b53a5c
    struct nk_style_item active;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* button */
Ivan Mahonin b53a5c
    struct nk_style_button close_button;
Ivan Mahonin b53a5c
    struct nk_style_button minimize_button;
Ivan Mahonin b53a5c
    enum nk_symbol_type close_symbol;
Ivan Mahonin b53a5c
    enum nk_symbol_type minimize_symbol;
Ivan Mahonin b53a5c
    enum nk_symbol_type maximize_symbol;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* title */
Ivan Mahonin b53a5c
    struct nk_color label_normal;
Ivan Mahonin b53a5c
    struct nk_color label_hover;
Ivan Mahonin b53a5c
    struct nk_color label_active;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* properties */
Ivan Mahonin b53a5c
    enum nk_style_header_align align;
Ivan Mahonin b53a5c
    struct nk_vec2 padding;
Ivan Mahonin b53a5c
    struct nk_vec2 label_padding;
Ivan Mahonin b53a5c
    struct nk_vec2 spacing;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_style_window {
Ivan Mahonin b53a5c
    struct nk_style_window_header header;
Ivan Mahonin b53a5c
    struct nk_style_item fixed_background;
Ivan Mahonin b53a5c
    struct nk_color background;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    struct nk_color border_color;
Ivan Mahonin b53a5c
    struct nk_color popup_border_color;
Ivan Mahonin b53a5c
    struct nk_color combo_border_color;
Ivan Mahonin b53a5c
    struct nk_color contextual_border_color;
Ivan Mahonin b53a5c
    struct nk_color menu_border_color;
Ivan Mahonin b53a5c
    struct nk_color group_border_color;
Ivan Mahonin b53a5c
    struct nk_color tooltip_border_color;
Ivan Mahonin b53a5c
    struct nk_style_item scaler;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    float border;
Ivan Mahonin b53a5c
    float combo_border;
Ivan Mahonin b53a5c
    float contextual_border;
Ivan Mahonin b53a5c
    float menu_border;
Ivan Mahonin b53a5c
    float group_border;
Ivan Mahonin b53a5c
    float tooltip_border;
Ivan Mahonin b53a5c
    float popup_border;
Ivan Mahonin b53a5c
    float min_row_height_padding;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    float rounding;
Ivan Mahonin b53a5c
    struct nk_vec2 spacing;
Ivan Mahonin b53a5c
    struct nk_vec2 scrollbar_size;
Ivan Mahonin b53a5c
    struct nk_vec2 min_size;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    struct nk_vec2 padding;
Ivan Mahonin b53a5c
    struct nk_vec2 group_padding;
Ivan Mahonin b53a5c
    struct nk_vec2 popup_padding;
Ivan Mahonin b53a5c
    struct nk_vec2 combo_padding;
Ivan Mahonin b53a5c
    struct nk_vec2 contextual_padding;
Ivan Mahonin b53a5c
    struct nk_vec2 menu_padding;
Ivan Mahonin b53a5c
    struct nk_vec2 tooltip_padding;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_style {
Ivan Mahonin b53a5c
    const struct nk_user_font *font;
Ivan Mahonin b53a5c
    const struct nk_cursor *cursors[NK_CURSOR_COUNT];
Ivan Mahonin b53a5c
    const struct nk_cursor *cursor_active;
Ivan Mahonin b53a5c
    struct nk_cursor *cursor_last;
Ivan Mahonin b53a5c
    int cursor_visible;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    struct nk_style_text text;
Ivan Mahonin b53a5c
    struct nk_style_button button;
Ivan Mahonin b53a5c
    struct nk_style_button contextual_button;
Ivan Mahonin b53a5c
    struct nk_style_button menu_button;
Ivan Mahonin b53a5c
    struct nk_style_toggle option;
Ivan Mahonin b53a5c
    struct nk_style_toggle checkbox;
Ivan Mahonin b53a5c
    struct nk_style_selectable selectable;
Ivan Mahonin b53a5c
    struct nk_style_slider slider;
Ivan Mahonin b53a5c
    struct nk_style_progress progress;
Ivan Mahonin b53a5c
    struct nk_style_property property;
Ivan Mahonin b53a5c
    struct nk_style_edit edit;
Ivan Mahonin b53a5c
    struct nk_style_chart chart;
Ivan Mahonin b53a5c
    struct nk_style_scrollbar scrollh;
Ivan Mahonin b53a5c
    struct nk_style_scrollbar scrollv;
Ivan Mahonin b53a5c
    struct nk_style_tab tab;
Ivan Mahonin b53a5c
    struct nk_style_combo combo;
Ivan Mahonin b53a5c
    struct nk_style_window window;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_API struct nk_style_item nk_style_item_color(struct nk_color);
Ivan Mahonin b53a5c
NK_API struct nk_style_item nk_style_item_image(struct nk_image img);
Ivan Mahonin b53a5c
NK_API struct nk_style_item nk_style_item_nine_slice(struct nk_nine_slice slice);
Ivan Mahonin b53a5c
NK_API struct nk_style_item nk_style_item_hide(void);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/*==============================================================
Ivan Mahonin b53a5c
 *                          PANEL
Ivan Mahonin b53a5c
 * =============================================================*/
Ivan Mahonin b53a5c
#ifndef NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS
Ivan Mahonin b53a5c
#define NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS 16
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
#ifndef NK_CHART_MAX_SLOT
Ivan Mahonin b53a5c
#define NK_CHART_MAX_SLOT 4
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
enum nk_panel_type {
Ivan Mahonin b53a5c
    NK_PANEL_NONE       = 0,
Ivan Mahonin b53a5c
    NK_PANEL_WINDOW     = NK_FLAG(0),
Ivan Mahonin b53a5c
    NK_PANEL_GROUP      = NK_FLAG(1),
Ivan Mahonin b53a5c
    NK_PANEL_POPUP      = NK_FLAG(2),
Ivan Mahonin b53a5c
    NK_PANEL_CONTEXTUAL = NK_FLAG(4),
Ivan Mahonin b53a5c
    NK_PANEL_COMBO      = NK_FLAG(5),
Ivan Mahonin b53a5c
    NK_PANEL_MENU       = NK_FLAG(6),
Ivan Mahonin b53a5c
    NK_PANEL_TOOLTIP    = NK_FLAG(7)
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
enum nk_panel_set {
Ivan Mahonin b53a5c
    NK_PANEL_SET_NONBLOCK = NK_PANEL_CONTEXTUAL|NK_PANEL_COMBO|NK_PANEL_MENU|NK_PANEL_TOOLTIP,
Ivan Mahonin b53a5c
    NK_PANEL_SET_POPUP = NK_PANEL_SET_NONBLOCK|NK_PANEL_POPUP,
Ivan Mahonin b53a5c
    NK_PANEL_SET_SUB = NK_PANEL_SET_POPUP|NK_PANEL_GROUP
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_chart_slot {
Ivan Mahonin b53a5c
    enum nk_chart_type type;
Ivan Mahonin b53a5c
    struct nk_color color;
Ivan Mahonin b53a5c
    struct nk_color highlight;
Ivan Mahonin b53a5c
    float min, max, range;
Ivan Mahonin b53a5c
    int count;
Ivan Mahonin b53a5c
    struct nk_vec2 last;
Ivan Mahonin b53a5c
    int index;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_chart {
Ivan Mahonin b53a5c
    int slot;
Ivan Mahonin b53a5c
    float x, y, w, h;
Ivan Mahonin b53a5c
    struct nk_chart_slot slots[NK_CHART_MAX_SLOT];
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
enum nk_panel_row_layout_type {
Ivan Mahonin b53a5c
    NK_LAYOUT_DYNAMIC_FIXED = 0,
Ivan Mahonin b53a5c
    NK_LAYOUT_DYNAMIC_ROW,
Ivan Mahonin b53a5c
    NK_LAYOUT_DYNAMIC_FREE,
Ivan Mahonin b53a5c
    NK_LAYOUT_DYNAMIC,
Ivan Mahonin b53a5c
    NK_LAYOUT_STATIC_FIXED,
Ivan Mahonin b53a5c
    NK_LAYOUT_STATIC_ROW,
Ivan Mahonin b53a5c
    NK_LAYOUT_STATIC_FREE,
Ivan Mahonin b53a5c
    NK_LAYOUT_STATIC,
Ivan Mahonin b53a5c
    NK_LAYOUT_TEMPLATE,
Ivan Mahonin b53a5c
    NK_LAYOUT_COUNT
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
struct nk_row_layout {
Ivan Mahonin b53a5c
    enum nk_panel_row_layout_type type;
Ivan Mahonin b53a5c
    int index;
Ivan Mahonin b53a5c
    float height;
Ivan Mahonin b53a5c
    float min_height;
Ivan Mahonin b53a5c
    int columns;
Ivan Mahonin b53a5c
    const float *ratio;
Ivan Mahonin b53a5c
    float item_width;
Ivan Mahonin b53a5c
    float item_height;
Ivan Mahonin b53a5c
    float item_offset;
Ivan Mahonin b53a5c
    float filled;
Ivan Mahonin b53a5c
    struct nk_rect item;
Ivan Mahonin b53a5c
    int tree_depth;
Ivan Mahonin b53a5c
    float templates[NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS];
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_popup_buffer {
Ivan Mahonin b53a5c
    nk_size begin;
Ivan Mahonin b53a5c
    nk_size parent;
Ivan Mahonin b53a5c
    nk_size last;
Ivan Mahonin b53a5c
    nk_size end;
Ivan Mahonin b53a5c
    nk_bool active;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_menu_state {
Ivan Mahonin b53a5c
    float x, y, w, h;
Ivan Mahonin b53a5c
    struct nk_scroll offset;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_panel {
Ivan Mahonin b53a5c
    enum nk_panel_type type;
Ivan Mahonin b53a5c
    nk_flags flags;
Ivan Mahonin b53a5c
    struct nk_rect bounds;
Ivan Mahonin b53a5c
    nk_uint *offset_x;
Ivan Mahonin b53a5c
    nk_uint *offset_y;
Ivan Mahonin b53a5c
    float at_x, at_y, max_x;
Ivan Mahonin b53a5c
    float footer_height;
Ivan Mahonin b53a5c
    float header_height;
Ivan Mahonin b53a5c
    float border;
Ivan Mahonin b53a5c
    unsigned int has_scrolling;
Ivan Mahonin b53a5c
    struct nk_rect clip;
Ivan Mahonin b53a5c
    struct nk_menu_state menu;
Ivan Mahonin b53a5c
    struct nk_row_layout row;
Ivan Mahonin b53a5c
    struct nk_chart chart;
Ivan Mahonin b53a5c
    struct nk_command_buffer *buffer;
Ivan Mahonin b53a5c
    struct nk_panel *parent;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/*==============================================================
Ivan Mahonin b53a5c
 *                          WINDOW
Ivan Mahonin b53a5c
 * =============================================================*/
Ivan Mahonin b53a5c
#ifndef NK_WINDOW_MAX_NAME
Ivan Mahonin b53a5c
#define NK_WINDOW_MAX_NAME 64
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_table;
Ivan Mahonin b53a5c
enum nk_window_flags {
Ivan Mahonin b53a5c
    NK_WINDOW_PRIVATE       = NK_FLAG(11),
Ivan Mahonin b53a5c
    NK_WINDOW_DYNAMIC       = NK_WINDOW_PRIVATE,
Ivan Mahonin b53a5c
    /* special window type growing up in height while being filled to a certain maximum height */
Ivan Mahonin b53a5c
    NK_WINDOW_ROM           = NK_FLAG(12),
Ivan Mahonin b53a5c
    /* sets window widgets into a read only mode and does not allow input changes */
Ivan Mahonin b53a5c
    NK_WINDOW_NOT_INTERACTIVE = NK_WINDOW_ROM|NK_WINDOW_NO_INPUT,
Ivan Mahonin b53a5c
    /* prevents all interaction caused by input to either window or widgets inside */
Ivan Mahonin b53a5c
    NK_WINDOW_HIDDEN        = NK_FLAG(13),
Ivan Mahonin b53a5c
    /* Hides window and stops any window interaction and drawing */
Ivan Mahonin b53a5c
    NK_WINDOW_CLOSED        = NK_FLAG(14),
Ivan Mahonin b53a5c
    /* Directly closes and frees the window at the end of the frame */
Ivan Mahonin b53a5c
    NK_WINDOW_MINIMIZED     = NK_FLAG(15),
Ivan Mahonin b53a5c
    /* marks the window as minimized */
Ivan Mahonin b53a5c
    NK_WINDOW_REMOVE_ROM    = NK_FLAG(16)
Ivan Mahonin b53a5c
    /* Removes read only mode at the end of the window */
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_popup_state {
Ivan Mahonin b53a5c
    struct nk_window *win;
Ivan Mahonin b53a5c
    enum nk_panel_type type;
Ivan Mahonin b53a5c
    struct nk_popup_buffer buf;
Ivan Mahonin b53a5c
    nk_hash name;
Ivan Mahonin b53a5c
    nk_bool active;
Ivan Mahonin b53a5c
    unsigned combo_count;
Ivan Mahonin b53a5c
    unsigned con_count, con_old;
Ivan Mahonin b53a5c
    unsigned active_con;
Ivan Mahonin b53a5c
    struct nk_rect header;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_edit_state {
Ivan Mahonin b53a5c
    nk_hash name;
Ivan Mahonin b53a5c
    unsigned int seq;
Ivan Mahonin b53a5c
    unsigned int old;
Ivan Mahonin b53a5c
    int active, prev;
Ivan Mahonin b53a5c
    int cursor;
Ivan Mahonin b53a5c
    int sel_start;
Ivan Mahonin b53a5c
    int sel_end;
Ivan Mahonin b53a5c
    struct nk_scroll scrollbar;
Ivan Mahonin b53a5c
    unsigned char mode;
Ivan Mahonin b53a5c
    unsigned char single_line;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_property_state {
Ivan Mahonin b53a5c
    int active, prev;
Ivan Mahonin b53a5c
    char buffer[NK_MAX_NUMBER_BUFFER];
Ivan Mahonin b53a5c
    int length;
Ivan Mahonin b53a5c
    int cursor;
Ivan Mahonin b53a5c
    int select_start;
Ivan Mahonin b53a5c
    int select_end;
Ivan Mahonin b53a5c
    nk_hash name;
Ivan Mahonin b53a5c
    unsigned int seq;
Ivan Mahonin b53a5c
    unsigned int old;
Ivan Mahonin b53a5c
    int state;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_window {
Ivan Mahonin b53a5c
    unsigned int seq;
Ivan Mahonin b53a5c
    nk_hash name;
Ivan Mahonin b53a5c
    char name_string[NK_WINDOW_MAX_NAME];
Ivan Mahonin b53a5c
    nk_flags flags;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    struct nk_rect bounds;
Ivan Mahonin b53a5c
    struct nk_scroll scrollbar;
Ivan Mahonin b53a5c
    struct nk_command_buffer buffer;
Ivan Mahonin b53a5c
    struct nk_panel *layout;
Ivan Mahonin b53a5c
    float scrollbar_hiding_timer;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* persistent widget state */
Ivan Mahonin b53a5c
    struct nk_property_state property;
Ivan Mahonin b53a5c
    struct nk_popup_state popup;
Ivan Mahonin b53a5c
    struct nk_edit_state edit;
Ivan Mahonin b53a5c
    unsigned int scrolled;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    struct nk_table *tables;
Ivan Mahonin b53a5c
    unsigned int table_count;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* window list hooks */
Ivan Mahonin b53a5c
    struct nk_window *next;
Ivan Mahonin b53a5c
    struct nk_window *prev;
Ivan Mahonin b53a5c
    struct nk_window *parent;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/*==============================================================
Ivan Mahonin b53a5c
 *                          STACK
Ivan Mahonin b53a5c
 * =============================================================*/
Ivan Mahonin b53a5c
/*/// ### Stack
Ivan Mahonin b53a5c
/// The style modifier stack can be used to temporarily change a
Ivan Mahonin b53a5c
/// property inside `nk_style`. For example if you want a special
Ivan Mahonin b53a5c
/// red button you can temporarily push the old button color onto a stack
Ivan Mahonin b53a5c
/// draw the button with a red color and then you just pop the old color
Ivan Mahonin b53a5c
/// back from the stack:
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
///     nk_style_push_style_item(ctx, &ctx->style.button.normal, nk_style_item_color(nk_rgb(255,0,0)));
Ivan Mahonin b53a5c
///     nk_style_push_style_item(ctx, &ctx->style.button.hover, nk_style_item_color(nk_rgb(255,0,0)));
Ivan Mahonin b53a5c
///     nk_style_push_style_item(ctx, &ctx->style.button.active, nk_style_item_color(nk_rgb(255,0,0)));
Ivan Mahonin b53a5c
///     nk_style_push_vec2(ctx, &cx->style.button.padding, nk_vec2(2,2));
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
///     nk_button(...);
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
///     nk_style_pop_style_item(ctx);
Ivan Mahonin b53a5c
///     nk_style_pop_style_item(ctx);
Ivan Mahonin b53a5c
///     nk_style_pop_style_item(ctx);
Ivan Mahonin b53a5c
///     nk_style_pop_vec2(ctx);
Ivan Mahonin b53a5c
/// 
Ivan Mahonin b53a5c
/// Nuklear has a stack for style_items, float properties, vector properties,
Ivan Mahonin b53a5c
/// flags, colors, fonts and for button_behavior. Each has it's own fixed size stack
Ivan Mahonin b53a5c
/// which can be changed at compile time.
Ivan Mahonin b53a5c
 */
Ivan Mahonin b53a5c
#ifndef NK_BUTTON_BEHAVIOR_STACK_SIZE
Ivan Mahonin b53a5c
#define NK_BUTTON_BEHAVIOR_STACK_SIZE 8
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifndef NK_FONT_STACK_SIZE
Ivan Mahonin b53a5c
#define NK_FONT_STACK_SIZE 8
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifndef NK_STYLE_ITEM_STACK_SIZE
Ivan Mahonin b53a5c
#define NK_STYLE_ITEM_STACK_SIZE 16
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifndef NK_FLOAT_STACK_SIZE
Ivan Mahonin b53a5c
#define NK_FLOAT_STACK_SIZE 32
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifndef NK_VECTOR_STACK_SIZE
Ivan Mahonin b53a5c
#define NK_VECTOR_STACK_SIZE 16
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifndef NK_FLAGS_STACK_SIZE
Ivan Mahonin b53a5c
#define NK_FLAGS_STACK_SIZE 32
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifndef NK_COLOR_STACK_SIZE
Ivan Mahonin b53a5c
#define NK_COLOR_STACK_SIZE 32
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#define NK_CONFIGURATION_STACK_TYPE(prefix, name, type)\
Ivan Mahonin b53a5c
    struct nk_config_stack_##name##_element {\
Ivan Mahonin b53a5c
        prefix##_##type *address;\
Ivan Mahonin b53a5c
        prefix##_##type old_value;\
Ivan Mahonin b53a5c
    }
Ivan Mahonin b53a5c
#define NK_CONFIG_STACK(type,size)\
Ivan Mahonin b53a5c
    struct nk_config_stack_##type {\
Ivan Mahonin b53a5c
        int head;\
Ivan Mahonin b53a5c
        struct nk_config_stack_##type##_element elements[size];\
Ivan Mahonin b53a5c
    }
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#define nk_float float
Ivan Mahonin b53a5c
NK_CONFIGURATION_STACK_TYPE(struct nk, style_item, style_item);
Ivan Mahonin b53a5c
NK_CONFIGURATION_STACK_TYPE(nk ,float, float);
Ivan Mahonin b53a5c
NK_CONFIGURATION_STACK_TYPE(struct nk, vec2, vec2);
Ivan Mahonin b53a5c
NK_CONFIGURATION_STACK_TYPE(nk ,flags, flags);
Ivan Mahonin b53a5c
NK_CONFIGURATION_STACK_TYPE(struct nk, color, color);
Ivan Mahonin b53a5c
NK_CONFIGURATION_STACK_TYPE(const struct nk, user_font, user_font*);
Ivan Mahonin b53a5c
NK_CONFIGURATION_STACK_TYPE(enum nk, button_behavior, button_behavior);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
NK_CONFIG_STACK(style_item, NK_STYLE_ITEM_STACK_SIZE);
Ivan Mahonin b53a5c
NK_CONFIG_STACK(float, NK_FLOAT_STACK_SIZE);
Ivan Mahonin b53a5c
NK_CONFIG_STACK(vec2, NK_VECTOR_STACK_SIZE);
Ivan Mahonin b53a5c
NK_CONFIG_STACK(flags, NK_FLAGS_STACK_SIZE);
Ivan Mahonin b53a5c
NK_CONFIG_STACK(color, NK_COLOR_STACK_SIZE);
Ivan Mahonin b53a5c
NK_CONFIG_STACK(user_font, NK_FONT_STACK_SIZE);
Ivan Mahonin b53a5c
NK_CONFIG_STACK(button_behavior, NK_BUTTON_BEHAVIOR_STACK_SIZE);
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_configuration_stacks {
Ivan Mahonin b53a5c
    struct nk_config_stack_style_item style_items;
Ivan Mahonin b53a5c
    struct nk_config_stack_float floats;
Ivan Mahonin b53a5c
    struct nk_config_stack_vec2 vectors;
Ivan Mahonin b53a5c
    struct nk_config_stack_flags flags;
Ivan Mahonin b53a5c
    struct nk_config_stack_color colors;
Ivan Mahonin b53a5c
    struct nk_config_stack_user_font fonts;
Ivan Mahonin b53a5c
    struct nk_config_stack_button_behavior button_behaviors;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/*==============================================================
Ivan Mahonin b53a5c
 *                          CONTEXT
Ivan Mahonin b53a5c
 * =============================================================*/
Ivan Mahonin b53a5c
#define NK_VALUE_PAGE_CAPACITY \
Ivan Mahonin b53a5c
    (((NK_MAX(sizeof(struct nk_window),sizeof(struct nk_panel)) / sizeof(nk_uint))) / 2)
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_table {
Ivan Mahonin b53a5c
    unsigned int seq;
Ivan Mahonin b53a5c
    unsigned int size;
Ivan Mahonin b53a5c
    nk_hash keys[NK_VALUE_PAGE_CAPACITY];
Ivan Mahonin b53a5c
    nk_uint values[NK_VALUE_PAGE_CAPACITY];
Ivan Mahonin b53a5c
    struct nk_table *next, *prev;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
union nk_page_data {
Ivan Mahonin b53a5c
    struct nk_table tbl;
Ivan Mahonin b53a5c
    struct nk_panel pan;
Ivan Mahonin b53a5c
    struct nk_window win;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_page_element {
Ivan Mahonin b53a5c
    union nk_page_data data;
Ivan Mahonin b53a5c
    struct nk_page_element *next;
Ivan Mahonin b53a5c
    struct nk_page_element *prev;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_page {
Ivan Mahonin b53a5c
    unsigned int size;
Ivan Mahonin b53a5c
    struct nk_page *next;
Ivan Mahonin b53a5c
    struct nk_page_element win[1];
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_pool {
Ivan Mahonin b53a5c
    struct nk_allocator alloc;
Ivan Mahonin b53a5c
    enum nk_allocation_type type;
Ivan Mahonin b53a5c
    unsigned int page_count;
Ivan Mahonin b53a5c
    struct nk_page *pages;
Ivan Mahonin b53a5c
    struct nk_page_element *freelist;
Ivan Mahonin b53a5c
    unsigned capacity;
Ivan Mahonin b53a5c
    nk_size size;
Ivan Mahonin b53a5c
    nk_size cap;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
struct nk_context {
Ivan Mahonin b53a5c
/* public: can be accessed freely */
Ivan Mahonin b53a5c
    struct nk_input input;
Ivan Mahonin b53a5c
    struct nk_style style;
Ivan Mahonin b53a5c
    struct nk_buffer memory;
Ivan Mahonin b53a5c
    struct nk_clipboard clip;
Ivan Mahonin b53a5c
    nk_flags last_widget_state;
Ivan Mahonin b53a5c
    enum nk_button_behavior button_behavior;
Ivan Mahonin b53a5c
    struct nk_configuration_stacks stacks;
Ivan Mahonin b53a5c
    float delta_time_seconds;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* private:
Ivan Mahonin b53a5c
    should only be accessed if you
Ivan Mahonin b53a5c
    know what you are doing */
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_VERTEX_BUFFER_OUTPUT
Ivan Mahonin b53a5c
    struct nk_draw_list draw_list;
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
#ifdef NK_INCLUDE_COMMAND_USERDATA
Ivan Mahonin b53a5c
    nk_handle userdata;
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
    /* text editor objects are quite big because of an internal
Ivan Mahonin b53a5c
     * undo/redo stack. Therefore it does not make sense to have one for
Ivan Mahonin b53a5c
     * each window for temporary use cases, so I only provide *one* instance
Ivan Mahonin b53a5c
     * for all windows. This works because the content is cleared anyway */
Ivan Mahonin b53a5c
    struct nk_text_edit text_edit;
Ivan Mahonin b53a5c
    /* draw buffer used for overlay drawing operation like cursor */
Ivan Mahonin b53a5c
    struct nk_command_buffer overlay;
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
    /* windows */
Ivan Mahonin b53a5c
    int build;
Ivan Mahonin b53a5c
    int use_pool;
Ivan Mahonin b53a5c
    struct nk_pool pool;
Ivan Mahonin b53a5c
    struct nk_window *begin;
Ivan Mahonin b53a5c
    struct nk_window *end;
Ivan Mahonin b53a5c
    struct nk_window *active;
Ivan Mahonin b53a5c
    struct nk_window *current;
Ivan Mahonin b53a5c
    struct nk_page_element *freelist;
Ivan Mahonin b53a5c
    unsigned int count;
Ivan Mahonin b53a5c
    unsigned int seq;
Ivan Mahonin b53a5c
};
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* ==============================================================
Ivan Mahonin b53a5c
 *                          MATH
Ivan Mahonin b53a5c
 * =============================================================== */
Ivan Mahonin b53a5c
#define NK_PI 3.141592654f
Ivan Mahonin b53a5c
#define NK_UTF_INVALID 0xFFFD
Ivan Mahonin b53a5c
#define NK_MAX_FLOAT_PRECISION 2
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#define NK_UNUSED(x) ((void)(x))
Ivan Mahonin b53a5c
#define NK_SATURATE(x) (NK_MAX(0, NK_MIN(1.0f, x)))
Ivan Mahonin b53a5c
#define NK_LEN(a) (sizeof(a)/sizeof(a)[0])
Ivan Mahonin b53a5c
#define NK_ABS(a) (((a) < 0) ? -(a) : (a))
Ivan Mahonin b53a5c
#define NK_BETWEEN(x, a, b) ((a) <= (x) && (x) < (b))
Ivan Mahonin b53a5c
#define NK_INBOX(px, py, x, y, w, h)\
Ivan Mahonin b53a5c
    (NK_BETWEEN(px,x,x+w) && NK_BETWEEN(py,y,y+h))
Ivan Mahonin b53a5c
#define NK_INTERSECT(x0, y0, w0, h0, x1, y1, w1, h1) \
Ivan Mahonin b53a5c
    ((x1 < (x0 + w0)) && (x0 < (x1 + w1)) && \
Ivan Mahonin b53a5c
    (y1 < (y0 + h0)) && (y0 < (y1 + h1)))
Ivan Mahonin b53a5c
#define NK_CONTAINS(x, y, w, h, bx, by, bw, bh)\
Ivan Mahonin b53a5c
    (NK_INBOX(x,y, bx, by, bw, bh) && NK_INBOX(x+w,y+h, bx, by, bw, bh))
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#define nk_vec2_sub(a, b) nk_vec2((a).x - (b).x, (a).y - (b).y)
Ivan Mahonin b53a5c
#define nk_vec2_add(a, b) nk_vec2((a).x + (b).x, (a).y + (b).y)
Ivan Mahonin b53a5c
#define nk_vec2_len_sqr(a) ((a).x*(a).x+(a).y*(a).y)
Ivan Mahonin b53a5c
#define nk_vec2_muls(a, t) nk_vec2((a).x * (t), (a).y * (t))
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#define nk_ptr_add(t, p, i) ((t*)((void*)((nk_byte*)(p) + (i))))
Ivan Mahonin b53a5c
#define nk_ptr_add_const(t, p, i) ((const t*)((const void*)((const nk_byte*)(p) + (i))))
Ivan Mahonin b53a5c
#define nk_zero_struct(s) nk_zero(&s, sizeof(s))
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
/* ==============================================================
Ivan Mahonin b53a5c
 *                          ALIGNMENT
Ivan Mahonin b53a5c
 * =============================================================== */
Ivan Mahonin b53a5c
/* Pointer to Integer type conversion for pointer alignment */
Ivan Mahonin b53a5c
#if defined(__PTRDIFF_TYPE__) /* This case should work for GCC*/
Ivan Mahonin b53a5c
# define NK_UINT_TO_PTR(x) ((void*)(__PTRDIFF_TYPE__)(x))
Ivan Mahonin b53a5c
# define NK_PTR_TO_UINT(x) ((nk_size)(__PTRDIFF_TYPE__)(x))
Ivan Mahonin b53a5c
#elif !defined(__GNUC__) /* works for compilers other than LLVM */
Ivan Mahonin b53a5c
# define NK_UINT_TO_PTR(x) ((void*)&((char*)0)[x])
Ivan Mahonin b53a5c
# define NK_PTR_TO_UINT(x) ((nk_size)(((char*)x)-(char*)0))
Ivan Mahonin b53a5c
#elif defined(NK_USE_FIXED_TYPES) /* used if we have <stdint.h> */
Ivan Mahonin b53a5c
# define NK_UINT_TO_PTR(x) ((void*)(uintptr_t)(x))
Ivan Mahonin b53a5c
# define NK_PTR_TO_UINT(x) ((uintptr_t)(x))
Ivan Mahonin b53a5c
#else /* generates warning but works */
Ivan Mahonin b53a5c
# define NK_UINT_TO_PTR(x) ((void*)(x))
Ivan Mahonin b53a5c
# define NK_PTR_TO_UINT(x) ((nk_size)(x))
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#define NK_ALIGN_PTR(x, mask)\
Ivan Mahonin b53a5c
    (NK_UINT_TO_PTR((NK_PTR_TO_UINT((nk_byte*)(x) + (mask-1)) & ~(mask-1))))
Ivan Mahonin b53a5c
#define NK_ALIGN_PTR_BACK(x, mask)\
Ivan Mahonin b53a5c
    (NK_UINT_TO_PTR((NK_PTR_TO_UINT((nk_byte*)(x)) & ~(mask-1))))
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#if (defined(__GNUC__) && __GNUC__ >= 4) || defined(__clang__)
Ivan Mahonin b53a5c
#define NK_OFFSETOF(st,m) (__builtin_offsetof(st,m))
Ivan Mahonin b53a5c
#else
Ivan Mahonin b53a5c
#define NK_OFFSETOF(st,m) ((nk_ptr)&(((st*)0)->m))
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifdef __cplusplus
Ivan Mahonin b53a5c
}
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#ifdef __cplusplus
Ivan Mahonin b53a5c
template<typename T> struct nk_alignof;
Ivan Mahonin b53a5c
template<typename T, int size_diff> struct nk_helper{enum {value = size_diff};};
Ivan Mahonin b53a5c
template<typename T> struct nk_helper<T,0>{enum {value = nk_alignof<T>::value};};
Ivan Mahonin b53a5c
template<typename T> struct nk_alignof{struct Big {T x; char c;}; enum {
Ivan Mahonin b53a5c
    diff = sizeof(Big) - sizeof(T), value = nk_helper<Big, diff>::value};};
Ivan Mahonin b53a5c
#define NK_ALIGNOF(t) (nk_alignof<t>::value)
Ivan Mahonin b53a5c
#else
Ivan Mahonin b53a5c
#define NK_ALIGNOF(t) NK_OFFSETOF(struct {char c; t _h;}, _h)
Ivan Mahonin b53a5c
#endif
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#define NK_CONTAINER_OF(ptr,type,member)\
Ivan Mahonin b53a5c
    (type*)((void*)((char*)(1 ? (ptr): &((type*)0)->member) - NK_OFFSETOF(type, member)))
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
Ivan Mahonin b53a5c
#endif /* NK_NUKLEAR_H_ */