diff --git a/nuklear.h b/nuklear.h index 5091695e1..9788714a0 100644 --- a/nuklear.h +++ b/nuklear.h @@ -1551,7 +1551,7 @@ NK_API void nk_end(struct nk_context *ctx); /// Returns a `nk_window` struct pointing to the identified window or NULL if /// no window with the given name was found */ -NK_API struct nk_window *nk_window_find(struct nk_context *ctx, const char *name); +NK_API struct nk_window *nk_window_find(const struct nk_context *ctx, const char *name); /*/// #### nk_window_get_bounds /// Returns a rectangle with screen position and size of the currently processed window /// @@ -1649,7 +1649,7 @@ NK_API float nk_window_get_height(const struct nk_context*); /// /// Returns a pointer to window internal `nk_panel` state. */ -NK_API struct nk_panel* nk_window_get_panel(struct nk_context*); +NK_API struct nk_panel* nk_window_get_panel(const struct nk_context *ctx); /*/// #### nk_window_get_content_region /// Returns the position and size of the currently visible and non-clipped space /// inside the currently processed window. @@ -1668,7 +1668,7 @@ NK_API struct nk_panel* nk_window_get_panel(struct nk_context*); /// Returns `nk_rect` struct with screen position and size (no scrollbar offset) /// of the visible space inside the current window */ -NK_API struct nk_rect nk_window_get_content_region(struct nk_context*); +NK_API struct nk_rect nk_window_get_content_region(const struct nk_context *ctx); /*/// #### nk_window_get_content_region_min /// Returns the upper left position of the currently visible and non-clipped /// space inside the currently processed window. @@ -1687,7 +1687,7 @@ NK_API struct nk_rect nk_window_get_content_region(struct nk_context*); /// returns `nk_vec2` struct with upper left screen position (no scrollbar offset) /// of the visible space inside the current window */ -NK_API struct nk_vec2 nk_window_get_content_region_min(struct nk_context*); +NK_API struct nk_vec2 nk_window_get_content_region_min(const struct nk_context *ctx); /*/// #### nk_window_get_content_region_max /// Returns the lower right screen position of the currently visible and /// non-clipped space inside the currently processed window. @@ -1706,7 +1706,7 @@ NK_API struct nk_vec2 nk_window_get_content_region_min(struct nk_context*); /// Returns `nk_vec2` struct with lower right screen position (no scrollbar offset) /// of the visible space inside the current window */ -NK_API struct nk_vec2 nk_window_get_content_region_max(struct nk_context*); +NK_API struct nk_vec2 nk_window_get_content_region_max(const struct nk_context *ctx); /*/// #### nk_window_get_content_region_size /// Returns the size of the currently visible and non-clipped space inside the /// currently processed window @@ -1724,7 +1724,7 @@ NK_API struct nk_vec2 nk_window_get_content_region_max(struct nk_context*); /// /// Returns `nk_vec2` struct with size the visible space inside the current window */ -NK_API struct nk_vec2 nk_window_get_content_region_size(struct nk_context*); +NK_API struct nk_vec2 nk_window_get_content_region_size(const struct nk_context *ctx); /*/// #### nk_window_get_canvas /// Returns the draw command buffer. Can be used to draw custom widgets /// !!! WARNING @@ -1743,7 +1743,7 @@ NK_API struct nk_vec2 nk_window_get_content_region_size(struct nk_context*); /// Returns a pointer to window internal `nk_command_buffer` struct used as /// drawing canvas. Can be used to do custom drawing. */ -NK_API struct nk_command_buffer* nk_window_get_canvas(struct nk_context*); +NK_API struct nk_command_buffer* nk_window_get_canvas(const struct nk_context *ctx); /*/// #### nk_window_get_scroll /// Gets the scroll offset for the current window /// !!! WARNING @@ -1759,7 +1759,7 @@ NK_API struct nk_command_buffer* nk_window_get_canvas(struct nk_context*); /// __offset_x__ | A pointer to the x offset output (or NULL to ignore) /// __offset_y__ | A pointer to the y offset output (or NULL to ignore) */ -NK_API void nk_window_get_scroll(struct nk_context*, nk_uint *offset_x, nk_uint *offset_y); +NK_API void nk_window_get_scroll(const struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y); /*/// #### nk_window_has_focus /// Returns if the currently processed window is currently active /// !!! WARNING @@ -1774,7 +1774,7 @@ NK_API void nk_window_get_scroll(struct nk_context*, nk_uint *offset_x, nk_uint /// /// Returns `false(0)` if current window is not active or `true(1)` if it is */ -NK_API nk_bool nk_window_has_focus(const struct nk_context*); +NK_API nk_bool nk_window_has_focus(const struct nk_context *ctx); /*/// #### nk_window_is_hovered /// Return if the current window is being hovered /// !!! WARNING @@ -1789,7 +1789,7 @@ NK_API nk_bool nk_window_has_focus(const struct nk_context*); /// /// Returns `true(1)` if current window is hovered or `false(0)` otherwise */ -NK_API nk_bool nk_window_is_hovered(struct nk_context*); +NK_API nk_bool nk_window_is_hovered(const struct nk_context *ctx); /*/// #### nk_window_is_collapsed /// Returns if the window with given name is currently minimized/collapsed /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -1804,7 +1804,7 @@ NK_API nk_bool nk_window_is_hovered(struct nk_context*); /// Returns `true(1)` if current window is minimized and `false(0)` if window not /// found or is not minimized */ -NK_API nk_bool nk_window_is_collapsed(struct nk_context *ctx, const char *name); +NK_API nk_bool nk_window_is_collapsed(const struct nk_context *ctx, const char *name); /*/// #### nk_window_is_closed /// Returns if the window with given name was closed by calling `nk_close` /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -1818,7 +1818,7 @@ NK_API nk_bool nk_window_is_collapsed(struct nk_context *ctx, const char *name); /// /// Returns `true(1)` if current window was closed or `false(0)` window not found or not closed */ -NK_API nk_bool nk_window_is_closed(struct nk_context*, const char*); +NK_API nk_bool nk_window_is_closed(const struct nk_context *ctx, const char *name); /*/// #### nk_window_is_hidden /// Returns if the window with given name is hidden /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -1832,7 +1832,7 @@ NK_API nk_bool nk_window_is_closed(struct nk_context*, const char*); /// /// Returns `true(1)` if current window is hidden or `false(0)` window not found or visible */ -NK_API nk_bool nk_window_is_hidden(struct nk_context*, const char*); +NK_API nk_bool nk_window_is_hidden(const struct nk_context *ctx, const char *name); /*/// #### nk_window_is_active /// Same as nk_window_has_focus for some reason /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -1846,7 +1846,7 @@ NK_API nk_bool nk_window_is_hidden(struct nk_context*, const char*); /// /// Returns `true(1)` if current window is active or `false(0)` window not found or not active */ -NK_API nk_bool nk_window_is_active(struct nk_context*, const char*); +NK_API nk_bool nk_window_is_active(const struct nk_context *ctx, const char *name); /*/// #### nk_window_is_any_hovered /// Returns if the any window is being hovered /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -1859,7 +1859,7 @@ NK_API nk_bool nk_window_is_active(struct nk_context*, const char*); /// /// Returns `true(1)` if any window is hovered or `false(0)` otherwise */ -NK_API nk_bool nk_window_is_any_hovered(struct nk_context*); +NK_API nk_bool nk_window_is_any_hovered(const struct nk_context *ctx); /*/// #### nk_item_is_any_active /// Returns if the any window is being hovered or any widget is currently active. /// Can be used to decide if input should be processed by UI or your specific input handling. @@ -1874,7 +1874,7 @@ NK_API nk_bool nk_window_is_any_hovered(struct nk_context*); /// /// Returns `true(1)` if any window is hovered or any item is active or `false(0)` otherwise */ -NK_API nk_bool nk_item_is_any_active(struct nk_context*); +NK_API nk_bool nk_item_is_any_active(const struct nk_context *ctx); /*/// #### nk_window_set_bounds /// Updates position and size of window with passed in name /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -2348,7 +2348,7 @@ NK_API void nk_layout_reset_min_row_height(struct nk_context*); /// /// Return `nk_rect` with both position and size of the next row */ -NK_API struct nk_rect nk_layout_widget_bounds(struct nk_context*); +NK_API struct nk_rect nk_layout_widget_bounds(const struct nk_context *ctx); /*/// #### nk_layout_ratio_from_pixel /// Utility functions to calculate window ratio from pixel size /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -2362,7 +2362,7 @@ NK_API struct nk_rect nk_layout_widget_bounds(struct nk_context*); /// /// Returns `nk_rect` with both position and size of the next row */ -NK_API float nk_layout_ratio_from_pixel(struct nk_context*, float pixel_width); +NK_API float nk_layout_ratio_from_pixel(const struct nk_context *ctx, float pixel_width); /*/// #### nk_layout_row_dynamic /// Sets current row layout to share horizontal space /// between @cols number of widgets evenly. Once called all subsequent widget @@ -2553,7 +2553,7 @@ NK_API void nk_layout_space_end(struct nk_context*); /// /// Returns `nk_rect` holding the total space allocated */ -NK_API struct nk_rect nk_layout_space_bounds(struct nk_context*); +NK_API struct nk_rect nk_layout_space_bounds(const struct nk_context *ctx); /*/// #### nk_layout_space_to_screen /// Converts vector from nk_layout_space coordinate space into screen space /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -2567,7 +2567,7 @@ NK_API struct nk_rect nk_layout_space_bounds(struct nk_context*); /// /// Returns transformed `nk_vec2` in screen space coordinates */ -NK_API struct nk_vec2 nk_layout_space_to_screen(struct nk_context*, struct nk_vec2); +NK_API struct nk_vec2 nk_layout_space_to_screen(const struct nk_context *ctx, struct nk_vec2 vec); /*/// #### nk_layout_space_to_local /// Converts vector from layout space into screen space /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -2581,7 +2581,7 @@ NK_API struct nk_vec2 nk_layout_space_to_screen(struct nk_context*, struct nk_ve /// /// Returns transformed `nk_vec2` in layout space coordinates */ -NK_API struct nk_vec2 nk_layout_space_to_local(struct nk_context*, struct nk_vec2); +NK_API struct nk_vec2 nk_layout_space_to_local(const struct nk_context *ctx, struct nk_vec2 vec); /*/// #### nk_layout_space_rect_to_screen /// Converts rectangle from screen space into layout space /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -2595,7 +2595,7 @@ NK_API struct nk_vec2 nk_layout_space_to_local(struct nk_context*, struct nk_vec /// /// Returns transformed `nk_rect` in screen space coordinates */ -NK_API struct nk_rect nk_layout_space_rect_to_screen(struct nk_context*, struct nk_rect); +NK_API struct nk_rect nk_layout_space_rect_to_screen(const struct nk_context *ctx, struct nk_rect bounds); /*/// #### nk_layout_space_rect_to_local /// Converts rectangle from layout space into screen space /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -2609,7 +2609,7 @@ NK_API struct nk_rect nk_layout_space_rect_to_screen(struct nk_context*, struct /// /// Returns transformed `nk_rect` in layout space coordinates */ -NK_API struct nk_rect nk_layout_space_rect_to_local(struct nk_context*, struct nk_rect); +NK_API struct nk_rect nk_layout_space_rect_to_local(const struct nk_context *ctx, struct nk_rect bounds); /*/// #### nk_spacer /// Spacer is a dummy widget that consumes space as usual but doesn't draw anything @@ -3122,15 +3122,15 @@ enum nk_widget_states { NK_WIDGET_STATE_ACTIVE = NK_WIDGET_STATE_ACTIVED|NK_WIDGET_STATE_MODIFIED /* widget is currently activated */ }; NK_API enum nk_widget_layout_states nk_widget(struct nk_rect*, const struct nk_context*); -NK_API enum nk_widget_layout_states nk_widget_fitting(struct nk_rect*, struct nk_context*, struct nk_vec2); -NK_API struct nk_rect nk_widget_bounds(struct nk_context*); -NK_API struct nk_vec2 nk_widget_position(struct nk_context*); -NK_API struct nk_vec2 nk_widget_size(struct nk_context*); -NK_API float nk_widget_width(struct nk_context*); -NK_API float nk_widget_height(struct nk_context*); -NK_API nk_bool nk_widget_is_hovered(struct nk_context*); -NK_API nk_bool nk_widget_is_mouse_clicked(struct nk_context*, enum nk_buttons); -NK_API nk_bool nk_widget_has_mouse_click_down(struct nk_context*, enum nk_buttons, nk_bool down); +NK_API enum nk_widget_layout_states nk_widget_fitting(struct nk_rect*, const struct nk_context*, struct nk_vec2); +NK_API struct nk_rect nk_widget_bounds(const struct nk_context*); +NK_API struct nk_vec2 nk_widget_position(const struct nk_context*); +NK_API struct nk_vec2 nk_widget_size(const struct nk_context*); +NK_API float nk_widget_width(const struct nk_context*); +NK_API float nk_widget_height(const struct nk_context*); +NK_API nk_bool nk_widget_is_hovered(const struct nk_context*); +NK_API nk_bool nk_widget_is_mouse_clicked(const struct nk_context*, enum nk_buttons); +NK_API nk_bool nk_widget_has_mouse_click_down(const struct nk_context*, enum nk_buttons, nk_bool down); NK_API void nk_spacing(struct nk_context*, int cols); NK_API void nk_widget_disable_begin(struct nk_context* ctx); NK_API void nk_widget_disable_end(struct nk_context* ctx); @@ -3553,18 +3553,18 @@ NK_API void nk_plot_function(struct nk_context*, enum nk_chart_type, void *userd NK_API nk_bool nk_popup_begin(struct nk_context*, enum nk_popup_type, const char*, nk_flags, struct nk_rect bounds); NK_API void nk_popup_close(struct nk_context*); NK_API void nk_popup_end(struct nk_context*); -NK_API void nk_popup_get_scroll(struct nk_context*, nk_uint *offset_x, nk_uint *offset_y); +NK_API void nk_popup_get_scroll(const struct nk_context*, nk_uint *offset_x, nk_uint *offset_y); NK_API void nk_popup_set_scroll(struct nk_context*, nk_uint offset_x, nk_uint offset_y); /* ============================================================================= * * COMBOBOX * * ============================================================================= */ -NK_API int nk_combo(struct nk_context*, const char **items, int count, int selected, int item_height, struct nk_vec2 size); +NK_API int nk_combo(struct nk_context*, const char *const *items, int count, int selected, int item_height, struct nk_vec2 size); 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); 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); 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); -NK_API void nk_combobox(struct nk_context*, const char **items, int count, int *selected, int item_height, struct nk_vec2 size); +NK_API void nk_combobox(struct nk_context*, const char *const *items, int count, int *selected, int item_height, struct nk_vec2 size); 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); 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); 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); @@ -3695,7 +3695,7 @@ enum nk_style_cursor { NK_API void nk_style_default(struct nk_context*); NK_API void nk_style_from_table(struct nk_context*, const struct nk_color*); NK_API void nk_style_load_cursor(struct nk_context*, enum nk_style_cursor, const struct nk_cursor*); -NK_API void nk_style_load_all_cursors(struct nk_context*, struct nk_cursor*); +NK_API void nk_style_load_all_cursors(struct nk_context*, const struct nk_cursor*); NK_API const char* nk_style_get_color_by_name(enum nk_style_colors); NK_API void nk_style_set_font(struct nk_context*, const struct nk_user_font*); NK_API nk_bool nk_style_set_cursor(struct nk_context*, enum nk_style_cursor); @@ -3727,7 +3727,7 @@ NK_API struct nk_color nk_rgb_f(float r, float g, float b); NK_API struct nk_color nk_rgb_fv(const float *rgb); NK_API struct nk_color nk_rgb_cf(struct nk_colorf c); NK_API struct nk_color nk_rgb_hex(const char *rgb); -NK_API struct nk_color nk_rgb_factor(struct nk_color col, const float factor); +NK_API struct nk_color nk_rgb_factor(struct nk_color col, float factor); NK_API struct nk_color nk_rgba(int r, int g, int b, int a); NK_API struct nk_color nk_rgba_u32(nk_uint); @@ -3739,7 +3739,7 @@ NK_API struct nk_color nk_rgba_cf(struct nk_colorf c); NK_API struct nk_color nk_rgba_hex(const char *rgb); NK_API struct nk_colorf nk_hsva_colorf(float h, float s, float v, float a); -NK_API struct nk_colorf nk_hsva_colorfv(float *c); +NK_API struct nk_colorf nk_hsva_colorfv(const float *c); NK_API void nk_colorf_hsva_f(float *out_h, float *out_s, float *out_v, float *out_a, struct nk_colorf in); NK_API void nk_colorf_hsva_fv(float *hsva, struct nk_colorf in); @@ -4165,7 +4165,7 @@ NK_API struct nk_font *nk_font_atlas_add_compressed(struct nk_font_atlas*, void 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); NK_API const void* nk_font_atlas_bake(struct nk_font_atlas*, int *width, int *height, enum nk_font_atlas_format); NK_API void nk_font_atlas_end(struct nk_font_atlas*, nk_handle tex, struct nk_draw_null_texture*); -NK_API const struct nk_font_glyph* nk_font_find_glyph(struct nk_font*, nk_rune unicode); +NK_API const struct nk_font_glyph* nk_font_find_glyph(const struct nk_font*, nk_rune unicode); NK_API void nk_font_atlas_cleanup(struct nk_font_atlas *atlas); NK_API void nk_font_atlas_clear(struct nk_font_atlas*); @@ -4257,7 +4257,7 @@ NK_API void nk_buffer_init_default(struct nk_buffer*); #endif NK_API void nk_buffer_init(struct nk_buffer*, const struct nk_allocator*, nk_size size); NK_API void nk_buffer_init_fixed(struct nk_buffer*, void *memory, nk_size size); -NK_API void nk_buffer_info(struct nk_memory_status*, struct nk_buffer*); +NK_API void nk_buffer_info(struct nk_memory_status*, const struct nk_buffer*); NK_API void nk_buffer_push(struct nk_buffer*, enum nk_buffer_allocation_type type, const void *memory, nk_size size, nk_size align); NK_API void nk_buffer_mark(struct nk_buffer*, enum nk_buffer_allocation_type type); NK_API void nk_buffer_reset(struct nk_buffer*, enum nk_buffer_allocation_type type); @@ -4265,7 +4265,7 @@ NK_API void nk_buffer_clear(struct nk_buffer*); NK_API void nk_buffer_free(struct nk_buffer*); NK_API void *nk_buffer_memory(struct nk_buffer*); NK_API const void *nk_buffer_memory_const(const struct nk_buffer*); -NK_API nk_size nk_buffer_total(struct nk_buffer*); +NK_API nk_size nk_buffer_total(const struct nk_buffer*); /* ============================================================== * @@ -4320,8 +4320,8 @@ NK_API const char *nk_str_at_const(const struct nk_str*, int pos, nk_rune *unico NK_API char *nk_str_get(struct nk_str*); NK_API const char *nk_str_get_const(const struct nk_str*); -NK_API int nk_str_len(struct nk_str*); -NK_API int nk_str_len_char(struct nk_str*); +NK_API int nk_str_len(const struct nk_str*); +NK_API int nk_str_len_char(const struct nk_str*); /*=============================================================== * @@ -4694,8 +4694,8 @@ NK_API void nk_stroke_rect(struct nk_command_buffer*, struct nk_rect, float roun NK_API void nk_stroke_circle(struct nk_command_buffer*, struct nk_rect, float line_thickness, struct nk_color); 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); NK_API void nk_stroke_triangle(struct nk_command_buffer*, float, float, float, float, float, float, float line_thichness, struct nk_color); -NK_API void nk_stroke_polyline(struct nk_command_buffer*, float *points, int point_count, float line_thickness, struct nk_color col); -NK_API void nk_stroke_polygon(struct nk_command_buffer*, float*, int point_count, float line_thickness, struct nk_color); +NK_API void nk_stroke_polyline(struct nk_command_buffer*, const float *points, int point_count, float line_thickness, struct nk_color col); +NK_API void nk_stroke_polygon(struct nk_command_buffer*, const float *points, int point_count, float line_thickness, struct nk_color); /* filled shades */ NK_API void nk_fill_rect(struct nk_command_buffer*, struct nk_rect, float rounding, struct nk_color); @@ -4703,7 +4703,7 @@ NK_API void nk_fill_rect_multi_color(struct nk_command_buffer*, struct nk_rect, NK_API void nk_fill_circle(struct nk_command_buffer*, struct nk_rect, struct nk_color); 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); 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); -NK_API void nk_fill_polygon(struct nk_command_buffer*, float*, int point_count, struct nk_color); +NK_API void nk_fill_polygon(struct nk_command_buffer*, const float *points, int point_count, struct nk_color); /* misc */ NK_API void nk_draw_image(struct nk_command_buffer*, struct nk_rect, const struct nk_image*, struct nk_color); @@ -6070,7 +6070,7 @@ enum nk_window_insert_location { NK_LIB void *nk_create_window(struct nk_context *ctx); NK_LIB void nk_remove_window(struct nk_context*, struct nk_window*); NK_LIB void nk_free_window(struct nk_context *ctx, struct nk_window *win); -NK_LIB struct nk_window *nk_find_window(struct nk_context *ctx, nk_hash hash, const char *name); +NK_LIB struct nk_window *nk_find_window(const struct nk_context *ctx, nk_hash hash, const char *name); NK_LIB void nk_insert_window(struct nk_context *ctx, struct nk_window *win, enum nk_window_insert_location loc); /* pool */ @@ -6090,7 +6090,7 @@ NK_LIB void nk_remove_table(struct nk_window *win, struct nk_table *tbl); NK_LIB void nk_free_table(struct nk_context *ctx, struct nk_table *tbl); NK_LIB void nk_push_table(struct nk_window *win, struct nk_table *tbl); NK_LIB nk_uint *nk_add_value(struct nk_context *ctx, struct nk_window *win, nk_hash name, nk_uint value); -NK_LIB nk_uint *nk_find_value(struct nk_window *win, nk_hash name); +NK_LIB nk_uint *nk_find_value(const struct nk_window *win, nk_hash name); /* panel */ NK_LIB void *nk_create_panel(struct nk_context *ctx); @@ -6111,7 +6111,7 @@ NK_LIB void nk_row_layout(struct nk_context *ctx, enum nk_layout_format fmt, flo NK_LIB void nk_panel_alloc_row(const struct nk_context *ctx, struct nk_window *win); NK_LIB void nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx, struct nk_window *win, int modify); NK_LIB void nk_panel_alloc_space(struct nk_rect *bounds, const struct nk_context *ctx); -NK_LIB void nk_layout_peek(struct nk_rect *bounds, struct nk_context *ctx); +NK_LIB void nk_layout_peek(struct nk_rect *bounds, const struct nk_context *ctx); /* popup */ NK_LIB nk_bool nk_nonblock_begin(struct nk_context *ctx, nk_flags flags, struct nk_rect body, struct nk_rect header, enum nk_panel_type panel_type); @@ -6263,7 +6263,6 @@ nk_stbtt_free(void *ptr, void *user_data) { - /* =============================================================== * * MATH @@ -7770,7 +7769,7 @@ nk_parse_hex(const char *p, int length) return i; } NK_API struct nk_color -nk_rgb_factor(struct nk_color col, const float factor) +nk_rgb_factor(struct nk_color col, float factor) { if (factor == 1.0f) return col; @@ -7993,7 +7992,7 @@ nk_hsva_colorf(float h, float s, float v, float a) return out; } NK_API struct nk_colorf -nk_hsva_colorfv(float *c) +nk_hsva_colorfv(const float *c) { return nk_hsva_colorf(c[0], c[1], c[2], c[3]); } @@ -8172,7 +8171,6 @@ nk_color_hsv_bv(nk_byte *out, struct nk_color in) - /* =============================================================== * * UTF-8 @@ -8559,7 +8557,7 @@ nk_buffer_free(struct nk_buffer *b) b->pool.free(b->pool.userdata, b->memory.ptr); } NK_API void -nk_buffer_info(struct nk_memory_status *s, struct nk_buffer *b) +nk_buffer_info(struct nk_memory_status *s, const struct nk_buffer *b) { NK_ASSERT(b); NK_ASSERT(s); @@ -8585,7 +8583,7 @@ nk_buffer_memory_const(const struct nk_buffer *buffer) return buffer->memory.ptr; } NK_API nk_size -nk_buffer_total(struct nk_buffer *buffer) +nk_buffer_total(const struct nk_buffer *buffer) { NK_ASSERT(buffer); if (!buffer) return 0; @@ -8595,7 +8593,6 @@ nk_buffer_total(struct nk_buffer *buffer) - /* =============================================================== * * STRING @@ -9014,14 +9011,14 @@ nk_str_get_const(const struct nk_str *s) return (const char*)s->buffer.memory.ptr; } NK_API int -nk_str_len(struct nk_str *s) +nk_str_len(const struct nk_str *s) { NK_ASSERT(s); if (!s || !s->len || !s->buffer.allocated) return 0; return s->len; } NK_API int -nk_str_len_char(struct nk_str *s) +nk_str_len_char(const struct nk_str *s) { NK_ASSERT(s); if (!s || !s->len || !s->buffer.allocated) return 0; @@ -9045,7 +9042,6 @@ nk_str_free(struct nk_str *str) - /* ============================================================== * * DRAW @@ -9374,7 +9370,7 @@ nk_fill_triangle(struct nk_command_buffer *b, float x0, float y0, float x1, cmd->color = c; } NK_API void -nk_stroke_polygon(struct nk_command_buffer *b, float *points, int point_count, +nk_stroke_polygon(struct nk_command_buffer *b, const float *points, int point_count, float line_thickness, struct nk_color col) { int i; @@ -9395,7 +9391,7 @@ nk_stroke_polygon(struct nk_command_buffer *b, float *points, int point_count, } } NK_API void -nk_fill_polygon(struct nk_command_buffer *b, float *points, int point_count, +nk_fill_polygon(struct nk_command_buffer *b, const float *points, int point_count, struct nk_color col) { int i; @@ -9416,7 +9412,7 @@ nk_fill_polygon(struct nk_command_buffer *b, float *points, int point_count, } } NK_API void -nk_stroke_polyline(struct nk_command_buffer *b, float *points, int point_count, +nk_stroke_polyline(struct nk_command_buffer *b, const float *points, int point_count, float line_thickness, struct nk_color col) { int i; @@ -9604,7 +9600,6 @@ nk_draw_text(struct nk_command_buffer *b, struct nk_rect r, - /* =============================================================== * * VERTEX @@ -17151,7 +17146,7 @@ nk_font_query_font_glyph(nk_handle handle, float height, } #endif NK_API const struct nk_font_glyph* -nk_font_find_glyph(struct nk_font *font, nk_rune unicode) +nk_font_find_glyph(const struct nk_font *font, nk_rune unicode) { int i = 0; int count; @@ -18021,7 +18016,6 @@ nk_font_atlas_clear(struct nk_font_atlas *atlas) - /* =============================================================== * * INPUT @@ -19156,7 +19150,7 @@ nk_style_load_cursor(struct nk_context *ctx, enum nk_style_cursor cursor, style->cursors[cursor] = c; } NK_API void -nk_style_load_all_cursors(struct nk_context *ctx, struct nk_cursor *cursors) +nk_style_load_all_cursors(struct nk_context *ctx, const struct nk_cursor *cursors) { int i = 0; struct nk_style *style; @@ -19171,7 +19165,6 @@ nk_style_load_all_cursors(struct nk_context *ctx, struct nk_cursor *cursors) - /* ============================================================== * * CONTEXT @@ -19717,7 +19710,7 @@ nk_add_value(struct nk_context *ctx, struct nk_window *win, return &win->tables->values[win->tables->size++]; } NK_LIB nk_uint* -nk_find_value(struct nk_window *win, nk_hash name) +nk_find_value(const struct nk_window *win, nk_hash name) { struct nk_table *iter = win->tables; while (iter) { @@ -19737,7 +19730,6 @@ nk_find_value(struct nk_window *win, nk_hash name) - /* =============================================================== * * PANEL @@ -20402,7 +20394,7 @@ nk_free_window(struct nk_context *ctx, struct nk_window *win) nk_free_page_element(ctx, pe);} } NK_LIB struct nk_window* -nk_find_window(struct nk_context *ctx, nk_hash hash, const char *name) +nk_find_window(const struct nk_context *ctx, nk_hash hash, const char *name) { struct nk_window *iter; iter = ctx->begin; @@ -20711,7 +20703,7 @@ nk_window_get_height(const struct nk_context *ctx) return ctx->current->bounds.h; } NK_API struct nk_rect -nk_window_get_content_region(struct nk_context *ctx) +nk_window_get_content_region(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); @@ -20719,7 +20711,7 @@ nk_window_get_content_region(struct nk_context *ctx) return ctx->current->layout->clip; } NK_API struct nk_vec2 -nk_window_get_content_region_min(struct nk_context *ctx) +nk_window_get_content_region_min(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); @@ -20728,7 +20720,7 @@ nk_window_get_content_region_min(struct nk_context *ctx) return nk_vec2(ctx->current->layout->clip.x, ctx->current->layout->clip.y); } NK_API struct nk_vec2 -nk_window_get_content_region_max(struct nk_context *ctx) +nk_window_get_content_region_max(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); @@ -20738,7 +20730,7 @@ nk_window_get_content_region_max(struct nk_context *ctx) ctx->current->layout->clip.y + ctx->current->layout->clip.h); } NK_API struct nk_vec2 -nk_window_get_content_region_size(struct nk_context *ctx) +nk_window_get_content_region_size(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); @@ -20747,7 +20739,7 @@ nk_window_get_content_region_size(struct nk_context *ctx) return nk_vec2(ctx->current->layout->clip.w, ctx->current->layout->clip.h); } NK_API struct nk_command_buffer* -nk_window_get_canvas(struct nk_context *ctx) +nk_window_get_canvas(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); @@ -20756,7 +20748,7 @@ nk_window_get_canvas(struct nk_context *ctx) return &ctx->current->buffer; } NK_API struct nk_panel* -nk_window_get_panel(struct nk_context *ctx) +nk_window_get_panel(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); @@ -20764,7 +20756,7 @@ nk_window_get_panel(struct nk_context *ctx) return ctx->current->layout; } NK_API void -nk_window_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y) +nk_window_get_scroll(const struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y) { struct nk_window *win; NK_ASSERT(ctx); @@ -20787,7 +20779,7 @@ nk_window_has_focus(const struct nk_context *ctx) return ctx->current == ctx->active; } NK_API nk_bool -nk_window_is_hovered(struct nk_context *ctx) +nk_window_is_hovered(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); @@ -20802,7 +20794,7 @@ nk_window_is_hovered(struct nk_context *ctx) } } NK_API nk_bool -nk_window_is_any_hovered(struct nk_context *ctx) +nk_window_is_any_hovered(const struct nk_context *ctx) { struct nk_window *iter; NK_ASSERT(ctx); @@ -20829,14 +20821,14 @@ nk_window_is_any_hovered(struct nk_context *ctx) return 0; } NK_API nk_bool -nk_item_is_any_active(struct nk_context *ctx) +nk_item_is_any_active(const struct nk_context *ctx) { int any_hovered = nk_window_is_any_hovered(ctx); int any_active = (ctx->last_widget_state & NK_WIDGET_STATE_MODIFIED); return any_hovered || any_active; } NK_API nk_bool -nk_window_is_collapsed(struct nk_context *ctx, const char *name) +nk_window_is_collapsed(const struct nk_context *ctx, const char *name) { int title_len; nk_hash title_hash; @@ -20851,7 +20843,7 @@ nk_window_is_collapsed(struct nk_context *ctx, const char *name) return win->flags & NK_WINDOW_MINIMIZED; } NK_API nk_bool -nk_window_is_closed(struct nk_context *ctx, const char *name) +nk_window_is_closed(const struct nk_context *ctx, const char *name) { int title_len; nk_hash title_hash; @@ -20866,7 +20858,7 @@ nk_window_is_closed(struct nk_context *ctx, const char *name) return (win->flags & NK_WINDOW_CLOSED); } NK_API nk_bool -nk_window_is_hidden(struct nk_context *ctx, const char *name) +nk_window_is_hidden(const struct nk_context *ctx, const char *name) { int title_len; nk_hash title_hash; @@ -20881,7 +20873,7 @@ nk_window_is_hidden(struct nk_context *ctx, const char *name) return (win->flags & NK_WINDOW_HIDDEN); } NK_API nk_bool -nk_window_is_active(struct nk_context *ctx, const char *name) +nk_window_is_active(const struct nk_context *ctx, const char *name) { int title_len; nk_hash title_hash; @@ -20896,7 +20888,7 @@ nk_window_is_active(struct nk_context *ctx, const char *name) return win == ctx->active; } NK_API struct nk_window* -nk_window_find(struct nk_context *ctx, const char *name) +nk_window_find(const struct nk_context *ctx, const char *name) { int title_len; nk_hash title_hash; @@ -21270,7 +21262,7 @@ nk_popup_end(struct nk_context *ctx) nk_push_scissor(&win->buffer, win->layout->clip); } NK_API void -nk_popup_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y) +nk_popup_get_scroll(const struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y) { struct nk_window *popup; @@ -21963,7 +21955,7 @@ nk_row_layout(struct nk_context *ctx, enum nk_layout_format fmt, win->layout->row.item_width = (float)width; } NK_API float -nk_layout_ratio_from_pixel(struct nk_context *ctx, float pixel_width) +nk_layout_ratio_from_pixel(const struct nk_context *ctx, float pixel_width) { struct nk_window *win; NK_ASSERT(ctx); @@ -22292,7 +22284,7 @@ nk_layout_space_push(struct nk_context *ctx, struct nk_rect rect) layout->row.item = rect; } NK_API struct nk_rect -nk_layout_space_bounds(struct nk_context *ctx) +nk_layout_space_bounds(const struct nk_context *ctx) { struct nk_rect ret; struct nk_window *win; @@ -22311,7 +22303,7 @@ nk_layout_space_bounds(struct nk_context *ctx) return ret; } NK_API struct nk_rect -nk_layout_widget_bounds(struct nk_context *ctx) +nk_layout_widget_bounds(const struct nk_context *ctx) { struct nk_rect ret; struct nk_window *win; @@ -22330,7 +22322,7 @@ nk_layout_widget_bounds(struct nk_context *ctx) return ret; } NK_API struct nk_vec2 -nk_layout_space_to_screen(struct nk_context *ctx, struct nk_vec2 ret) +nk_layout_space_to_screen(const struct nk_context *ctx, struct nk_vec2 ret) { struct nk_window *win; struct nk_panel *layout; @@ -22346,7 +22338,7 @@ nk_layout_space_to_screen(struct nk_context *ctx, struct nk_vec2 ret) return ret; } NK_API struct nk_vec2 -nk_layout_space_to_local(struct nk_context *ctx, struct nk_vec2 ret) +nk_layout_space_to_local(const struct nk_context *ctx, struct nk_vec2 ret) { struct nk_window *win; struct nk_panel *layout; @@ -22362,7 +22354,7 @@ nk_layout_space_to_local(struct nk_context *ctx, struct nk_vec2 ret) return ret; } NK_API struct nk_rect -nk_layout_space_rect_to_screen(struct nk_context *ctx, struct nk_rect ret) +nk_layout_space_rect_to_screen(const struct nk_context *ctx, struct nk_rect ret) { struct nk_window *win; struct nk_panel *layout; @@ -22378,7 +22370,7 @@ nk_layout_space_rect_to_screen(struct nk_context *ctx, struct nk_rect ret) return ret; } NK_API struct nk_rect -nk_layout_space_rect_to_local(struct nk_context *ctx, struct nk_rect ret) +nk_layout_space_rect_to_local(const struct nk_context *ctx, struct nk_rect ret) { struct nk_window *win; struct nk_panel *layout; @@ -22559,7 +22551,7 @@ nk_panel_alloc_space(struct nk_rect *bounds, const struct nk_context *ctx) layout->row.index++; } NK_LIB void -nk_layout_peek(struct nk_rect *bounds, struct nk_context *ctx) +nk_layout_peek(struct nk_rect *bounds, const struct nk_context *ctx) { float y; int index; @@ -23277,7 +23269,7 @@ nk_list_view_end(struct nk_list_view *view) * * ===============================================================*/ NK_API struct nk_rect -nk_widget_bounds(struct nk_context *ctx) +nk_widget_bounds(const struct nk_context *ctx) { struct nk_rect bounds; NK_ASSERT(ctx); @@ -23288,7 +23280,7 @@ nk_widget_bounds(struct nk_context *ctx) return bounds; } NK_API struct nk_vec2 -nk_widget_position(struct nk_context *ctx) +nk_widget_position(const struct nk_context *ctx) { struct nk_rect bounds; NK_ASSERT(ctx); @@ -23300,7 +23292,7 @@ nk_widget_position(struct nk_context *ctx) return nk_vec2(bounds.x, bounds.y); } NK_API struct nk_vec2 -nk_widget_size(struct nk_context *ctx) +nk_widget_size(const struct nk_context *ctx) { struct nk_rect bounds; NK_ASSERT(ctx); @@ -23312,7 +23304,7 @@ nk_widget_size(struct nk_context *ctx) return nk_vec2(bounds.w, bounds.h); } NK_API float -nk_widget_width(struct nk_context *ctx) +nk_widget_width(const struct nk_context *ctx) { struct nk_rect bounds; NK_ASSERT(ctx); @@ -23324,7 +23316,7 @@ nk_widget_width(struct nk_context *ctx) return bounds.w; } NK_API float -nk_widget_height(struct nk_context *ctx) +nk_widget_height(const struct nk_context *ctx) { struct nk_rect bounds; NK_ASSERT(ctx); @@ -23336,7 +23328,7 @@ nk_widget_height(struct nk_context *ctx) return bounds.h; } NK_API nk_bool -nk_widget_is_hovered(struct nk_context *ctx) +nk_widget_is_hovered(const struct nk_context *ctx) { struct nk_rect c, v; struct nk_rect bounds; @@ -23358,7 +23350,7 @@ nk_widget_is_hovered(struct nk_context *ctx) return nk_input_is_mouse_hovering_rect(&ctx->input, bounds); } NK_API nk_bool -nk_widget_is_mouse_clicked(struct nk_context *ctx, enum nk_buttons btn) +nk_widget_is_mouse_clicked(const struct nk_context *ctx, enum nk_buttons btn) { struct nk_rect c, v; struct nk_rect bounds; @@ -23380,7 +23372,7 @@ nk_widget_is_mouse_clicked(struct nk_context *ctx, enum nk_buttons btn) return nk_input_mouse_clicked(&ctx->input, btn, bounds); } NK_API nk_bool -nk_widget_has_mouse_click_down(struct nk_context *ctx, enum nk_buttons btn, nk_bool down) +nk_widget_has_mouse_click_down(const struct nk_context *ctx, enum nk_buttons btn, nk_bool down) { struct nk_rect c, v; struct nk_rect bounds; @@ -23452,7 +23444,7 @@ nk_widget(struct nk_rect *bounds, const struct nk_context *ctx) return NK_WIDGET_VALID; } NK_API enum nk_widget_layout_states -nk_widget_fitting(struct nk_rect *bounds, struct nk_context *ctx, +nk_widget_fitting(struct nk_rect *bounds, const struct nk_context *ctx, struct nk_vec2 item_padding) { /* update the bounds to stand without padding */ @@ -30230,7 +30222,7 @@ NK_API void nk_combo_close(struct nk_context *ctx) nk_contextual_close(ctx); } NK_API int -nk_combo(struct nk_context *ctx, const char **items, int count, +nk_combo(struct nk_context *ctx, const char *const *items, int count, int selected, int item_height, struct nk_vec2 size) { int i = 0; @@ -30348,7 +30340,7 @@ nk_combo_callback(struct nk_context *ctx, void(*item_getter)(void*, int, const c } return selected; } NK_API void -nk_combobox(struct nk_context *ctx, const char **items, int count, +nk_combobox(struct nk_context *ctx, const char *const *items, int count, int *selected, int item_height, struct nk_vec2 size) { *selected = nk_combo(ctx, items, count, *selected, item_height, size); @@ -30377,7 +30369,6 @@ nk_combobox_callback(struct nk_context *ctx, - /* =============================================================== * * TOOLTIP diff --git a/src/nuklear.h b/src/nuklear.h index 6a30b3947..4e73b101d 100644 --- a/src/nuklear.h +++ b/src/nuklear.h @@ -1329,7 +1329,7 @@ NK_API void nk_end(struct nk_context *ctx); /// Returns a `nk_window` struct pointing to the identified window or NULL if /// no window with the given name was found */ -NK_API struct nk_window *nk_window_find(struct nk_context *ctx, const char *name); +NK_API struct nk_window *nk_window_find(const struct nk_context *ctx, const char *name); /*/// #### nk_window_get_bounds /// Returns a rectangle with screen position and size of the currently processed window /// @@ -1427,7 +1427,7 @@ NK_API float nk_window_get_height(const struct nk_context*); /// /// Returns a pointer to window internal `nk_panel` state. */ -NK_API struct nk_panel* nk_window_get_panel(struct nk_context*); +NK_API struct nk_panel* nk_window_get_panel(const struct nk_context *ctx); /*/// #### nk_window_get_content_region /// Returns the position and size of the currently visible and non-clipped space /// inside the currently processed window. @@ -1446,7 +1446,7 @@ NK_API struct nk_panel* nk_window_get_panel(struct nk_context*); /// Returns `nk_rect` struct with screen position and size (no scrollbar offset) /// of the visible space inside the current window */ -NK_API struct nk_rect nk_window_get_content_region(struct nk_context*); +NK_API struct nk_rect nk_window_get_content_region(const struct nk_context *ctx); /*/// #### nk_window_get_content_region_min /// Returns the upper left position of the currently visible and non-clipped /// space inside the currently processed window. @@ -1465,7 +1465,7 @@ NK_API struct nk_rect nk_window_get_content_region(struct nk_context*); /// returns `nk_vec2` struct with upper left screen position (no scrollbar offset) /// of the visible space inside the current window */ -NK_API struct nk_vec2 nk_window_get_content_region_min(struct nk_context*); +NK_API struct nk_vec2 nk_window_get_content_region_min(const struct nk_context *ctx); /*/// #### nk_window_get_content_region_max /// Returns the lower right screen position of the currently visible and /// non-clipped space inside the currently processed window. @@ -1484,7 +1484,7 @@ NK_API struct nk_vec2 nk_window_get_content_region_min(struct nk_context*); /// Returns `nk_vec2` struct with lower right screen position (no scrollbar offset) /// of the visible space inside the current window */ -NK_API struct nk_vec2 nk_window_get_content_region_max(struct nk_context*); +NK_API struct nk_vec2 nk_window_get_content_region_max(const struct nk_context *ctx); /*/// #### nk_window_get_content_region_size /// Returns the size of the currently visible and non-clipped space inside the /// currently processed window @@ -1502,7 +1502,7 @@ NK_API struct nk_vec2 nk_window_get_content_region_max(struct nk_context*); /// /// Returns `nk_vec2` struct with size the visible space inside the current window */ -NK_API struct nk_vec2 nk_window_get_content_region_size(struct nk_context*); +NK_API struct nk_vec2 nk_window_get_content_region_size(const struct nk_context *ctx); /*/// #### nk_window_get_canvas /// Returns the draw command buffer. Can be used to draw custom widgets /// !!! WARNING @@ -1521,7 +1521,7 @@ NK_API struct nk_vec2 nk_window_get_content_region_size(struct nk_context*); /// Returns a pointer to window internal `nk_command_buffer` struct used as /// drawing canvas. Can be used to do custom drawing. */ -NK_API struct nk_command_buffer* nk_window_get_canvas(struct nk_context*); +NK_API struct nk_command_buffer* nk_window_get_canvas(const struct nk_context *ctx); /*/// #### nk_window_get_scroll /// Gets the scroll offset for the current window /// !!! WARNING @@ -1537,7 +1537,7 @@ NK_API struct nk_command_buffer* nk_window_get_canvas(struct nk_context*); /// __offset_x__ | A pointer to the x offset output (or NULL to ignore) /// __offset_y__ | A pointer to the y offset output (or NULL to ignore) */ -NK_API void nk_window_get_scroll(struct nk_context*, nk_uint *offset_x, nk_uint *offset_y); +NK_API void nk_window_get_scroll(const struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y); /*/// #### nk_window_has_focus /// Returns if the currently processed window is currently active /// !!! WARNING @@ -1552,7 +1552,7 @@ NK_API void nk_window_get_scroll(struct nk_context*, nk_uint *offset_x, nk_uint /// /// Returns `false(0)` if current window is not active or `true(1)` if it is */ -NK_API nk_bool nk_window_has_focus(const struct nk_context*); +NK_API nk_bool nk_window_has_focus(const struct nk_context *ctx); /*/// #### nk_window_is_hovered /// Return if the current window is being hovered /// !!! WARNING @@ -1567,7 +1567,7 @@ NK_API nk_bool nk_window_has_focus(const struct nk_context*); /// /// Returns `true(1)` if current window is hovered or `false(0)` otherwise */ -NK_API nk_bool nk_window_is_hovered(struct nk_context*); +NK_API nk_bool nk_window_is_hovered(const struct nk_context *ctx); /*/// #### nk_window_is_collapsed /// Returns if the window with given name is currently minimized/collapsed /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -1582,7 +1582,7 @@ NK_API nk_bool nk_window_is_hovered(struct nk_context*); /// Returns `true(1)` if current window is minimized and `false(0)` if window not /// found or is not minimized */ -NK_API nk_bool nk_window_is_collapsed(struct nk_context *ctx, const char *name); +NK_API nk_bool nk_window_is_collapsed(const struct nk_context *ctx, const char *name); /*/// #### nk_window_is_closed /// Returns if the window with given name was closed by calling `nk_close` /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -1596,7 +1596,7 @@ NK_API nk_bool nk_window_is_collapsed(struct nk_context *ctx, const char *name); /// /// Returns `true(1)` if current window was closed or `false(0)` window not found or not closed */ -NK_API nk_bool nk_window_is_closed(struct nk_context*, const char*); +NK_API nk_bool nk_window_is_closed(const struct nk_context *ctx, const char *name); /*/// #### nk_window_is_hidden /// Returns if the window with given name is hidden /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -1610,7 +1610,7 @@ NK_API nk_bool nk_window_is_closed(struct nk_context*, const char*); /// /// Returns `true(1)` if current window is hidden or `false(0)` window not found or visible */ -NK_API nk_bool nk_window_is_hidden(struct nk_context*, const char*); +NK_API nk_bool nk_window_is_hidden(const struct nk_context *ctx, const char *name); /*/// #### nk_window_is_active /// Same as nk_window_has_focus for some reason /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -1624,7 +1624,7 @@ NK_API nk_bool nk_window_is_hidden(struct nk_context*, const char*); /// /// Returns `true(1)` if current window is active or `false(0)` window not found or not active */ -NK_API nk_bool nk_window_is_active(struct nk_context*, const char*); +NK_API nk_bool nk_window_is_active(const struct nk_context *ctx, const char *name); /*/// #### nk_window_is_any_hovered /// Returns if the any window is being hovered /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -1637,7 +1637,7 @@ NK_API nk_bool nk_window_is_active(struct nk_context*, const char*); /// /// Returns `true(1)` if any window is hovered or `false(0)` otherwise */ -NK_API nk_bool nk_window_is_any_hovered(struct nk_context*); +NK_API nk_bool nk_window_is_any_hovered(const struct nk_context *ctx); /*/// #### nk_item_is_any_active /// Returns if the any window is being hovered or any widget is currently active. /// Can be used to decide if input should be processed by UI or your specific input handling. @@ -1652,7 +1652,7 @@ NK_API nk_bool nk_window_is_any_hovered(struct nk_context*); /// /// Returns `true(1)` if any window is hovered or any item is active or `false(0)` otherwise */ -NK_API nk_bool nk_item_is_any_active(struct nk_context*); +NK_API nk_bool nk_item_is_any_active(const struct nk_context *ctx); /*/// #### nk_window_set_bounds /// Updates position and size of window with passed in name /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -2126,7 +2126,7 @@ NK_API void nk_layout_reset_min_row_height(struct nk_context*); /// /// Return `nk_rect` with both position and size of the next row */ -NK_API struct nk_rect nk_layout_widget_bounds(struct nk_context*); +NK_API struct nk_rect nk_layout_widget_bounds(const struct nk_context *ctx); /*/// #### nk_layout_ratio_from_pixel /// Utility functions to calculate window ratio from pixel size /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -2140,7 +2140,7 @@ NK_API struct nk_rect nk_layout_widget_bounds(struct nk_context*); /// /// Returns `nk_rect` with both position and size of the next row */ -NK_API float nk_layout_ratio_from_pixel(struct nk_context*, float pixel_width); +NK_API float nk_layout_ratio_from_pixel(const struct nk_context *ctx, float pixel_width); /*/// #### nk_layout_row_dynamic /// Sets current row layout to share horizontal space /// between @cols number of widgets evenly. Once called all subsequent widget @@ -2331,7 +2331,7 @@ NK_API void nk_layout_space_end(struct nk_context*); /// /// Returns `nk_rect` holding the total space allocated */ -NK_API struct nk_rect nk_layout_space_bounds(struct nk_context*); +NK_API struct nk_rect nk_layout_space_bounds(const struct nk_context *ctx); /*/// #### nk_layout_space_to_screen /// Converts vector from nk_layout_space coordinate space into screen space /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -2345,7 +2345,7 @@ NK_API struct nk_rect nk_layout_space_bounds(struct nk_context*); /// /// Returns transformed `nk_vec2` in screen space coordinates */ -NK_API struct nk_vec2 nk_layout_space_to_screen(struct nk_context*, struct nk_vec2); +NK_API struct nk_vec2 nk_layout_space_to_screen(const struct nk_context *ctx, struct nk_vec2 vec); /*/// #### nk_layout_space_to_local /// Converts vector from layout space into screen space /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -2359,7 +2359,7 @@ NK_API struct nk_vec2 nk_layout_space_to_screen(struct nk_context*, struct nk_ve /// /// Returns transformed `nk_vec2` in layout space coordinates */ -NK_API struct nk_vec2 nk_layout_space_to_local(struct nk_context*, struct nk_vec2); +NK_API struct nk_vec2 nk_layout_space_to_local(const struct nk_context *ctx, struct nk_vec2 vec); /*/// #### nk_layout_space_rect_to_screen /// Converts rectangle from screen space into layout space /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -2373,7 +2373,7 @@ NK_API struct nk_vec2 nk_layout_space_to_local(struct nk_context*, struct nk_vec /// /// Returns transformed `nk_rect` in screen space coordinates */ -NK_API struct nk_rect nk_layout_space_rect_to_screen(struct nk_context*, struct nk_rect); +NK_API struct nk_rect nk_layout_space_rect_to_screen(const struct nk_context *ctx, struct nk_rect bounds); /*/// #### nk_layout_space_rect_to_local /// Converts rectangle from layout space into screen space /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -2387,7 +2387,7 @@ NK_API struct nk_rect nk_layout_space_rect_to_screen(struct nk_context*, struct /// /// Returns transformed `nk_rect` in layout space coordinates */ -NK_API struct nk_rect nk_layout_space_rect_to_local(struct nk_context*, struct nk_rect); +NK_API struct nk_rect nk_layout_space_rect_to_local(const struct nk_context *ctx, struct nk_rect bounds); /*/// #### nk_spacer /// Spacer is a dummy widget that consumes space as usual but doesn't draw anything @@ -2900,15 +2900,15 @@ enum nk_widget_states { NK_WIDGET_STATE_ACTIVE = NK_WIDGET_STATE_ACTIVED|NK_WIDGET_STATE_MODIFIED /* widget is currently activated */ }; NK_API enum nk_widget_layout_states nk_widget(struct nk_rect*, const struct nk_context*); -NK_API enum nk_widget_layout_states nk_widget_fitting(struct nk_rect*, struct nk_context*, struct nk_vec2); -NK_API struct nk_rect nk_widget_bounds(struct nk_context*); -NK_API struct nk_vec2 nk_widget_position(struct nk_context*); -NK_API struct nk_vec2 nk_widget_size(struct nk_context*); -NK_API float nk_widget_width(struct nk_context*); -NK_API float nk_widget_height(struct nk_context*); -NK_API nk_bool nk_widget_is_hovered(struct nk_context*); -NK_API nk_bool nk_widget_is_mouse_clicked(struct nk_context*, enum nk_buttons); -NK_API nk_bool nk_widget_has_mouse_click_down(struct nk_context*, enum nk_buttons, nk_bool down); +NK_API enum nk_widget_layout_states nk_widget_fitting(struct nk_rect*, const struct nk_context*, struct nk_vec2); +NK_API struct nk_rect nk_widget_bounds(const struct nk_context*); +NK_API struct nk_vec2 nk_widget_position(const struct nk_context*); +NK_API struct nk_vec2 nk_widget_size(const struct nk_context*); +NK_API float nk_widget_width(const struct nk_context*); +NK_API float nk_widget_height(const struct nk_context*); +NK_API nk_bool nk_widget_is_hovered(const struct nk_context*); +NK_API nk_bool nk_widget_is_mouse_clicked(const struct nk_context*, enum nk_buttons); +NK_API nk_bool nk_widget_has_mouse_click_down(const struct nk_context*, enum nk_buttons, nk_bool down); NK_API void nk_spacing(struct nk_context*, int cols); NK_API void nk_widget_disable_begin(struct nk_context* ctx); NK_API void nk_widget_disable_end(struct nk_context* ctx); @@ -3331,18 +3331,18 @@ NK_API void nk_plot_function(struct nk_context*, enum nk_chart_type, void *userd NK_API nk_bool nk_popup_begin(struct nk_context*, enum nk_popup_type, const char*, nk_flags, struct nk_rect bounds); NK_API void nk_popup_close(struct nk_context*); NK_API void nk_popup_end(struct nk_context*); -NK_API void nk_popup_get_scroll(struct nk_context*, nk_uint *offset_x, nk_uint *offset_y); +NK_API void nk_popup_get_scroll(const struct nk_context*, nk_uint *offset_x, nk_uint *offset_y); NK_API void nk_popup_set_scroll(struct nk_context*, nk_uint offset_x, nk_uint offset_y); /* ============================================================================= * * COMBOBOX * * ============================================================================= */ -NK_API int nk_combo(struct nk_context*, const char **items, int count, int selected, int item_height, struct nk_vec2 size); +NK_API int nk_combo(struct nk_context*, const char *const *items, int count, int selected, int item_height, struct nk_vec2 size); 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); 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); 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); -NK_API void nk_combobox(struct nk_context*, const char **items, int count, int *selected, int item_height, struct nk_vec2 size); +NK_API void nk_combobox(struct nk_context*, const char *const *items, int count, int *selected, int item_height, struct nk_vec2 size); 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); 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); 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); @@ -3473,7 +3473,7 @@ enum nk_style_cursor { NK_API void nk_style_default(struct nk_context*); NK_API void nk_style_from_table(struct nk_context*, const struct nk_color*); NK_API void nk_style_load_cursor(struct nk_context*, enum nk_style_cursor, const struct nk_cursor*); -NK_API void nk_style_load_all_cursors(struct nk_context*, struct nk_cursor*); +NK_API void nk_style_load_all_cursors(struct nk_context*, const struct nk_cursor*); NK_API const char* nk_style_get_color_by_name(enum nk_style_colors); NK_API void nk_style_set_font(struct nk_context*, const struct nk_user_font*); NK_API nk_bool nk_style_set_cursor(struct nk_context*, enum nk_style_cursor); @@ -3505,7 +3505,7 @@ NK_API struct nk_color nk_rgb_f(float r, float g, float b); NK_API struct nk_color nk_rgb_fv(const float *rgb); NK_API struct nk_color nk_rgb_cf(struct nk_colorf c); NK_API struct nk_color nk_rgb_hex(const char *rgb); -NK_API struct nk_color nk_rgb_factor(struct nk_color col, const float factor); +NK_API struct nk_color nk_rgb_factor(struct nk_color col, float factor); NK_API struct nk_color nk_rgba(int r, int g, int b, int a); NK_API struct nk_color nk_rgba_u32(nk_uint); @@ -3517,7 +3517,7 @@ NK_API struct nk_color nk_rgba_cf(struct nk_colorf c); NK_API struct nk_color nk_rgba_hex(const char *rgb); NK_API struct nk_colorf nk_hsva_colorf(float h, float s, float v, float a); -NK_API struct nk_colorf nk_hsva_colorfv(float *c); +NK_API struct nk_colorf nk_hsva_colorfv(const float *c); NK_API void nk_colorf_hsva_f(float *out_h, float *out_s, float *out_v, float *out_a, struct nk_colorf in); NK_API void nk_colorf_hsva_fv(float *hsva, struct nk_colorf in); @@ -3943,7 +3943,7 @@ NK_API struct nk_font *nk_font_atlas_add_compressed(struct nk_font_atlas*, void 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); NK_API const void* nk_font_atlas_bake(struct nk_font_atlas*, int *width, int *height, enum nk_font_atlas_format); NK_API void nk_font_atlas_end(struct nk_font_atlas*, nk_handle tex, struct nk_draw_null_texture*); -NK_API const struct nk_font_glyph* nk_font_find_glyph(struct nk_font*, nk_rune unicode); +NK_API const struct nk_font_glyph* nk_font_find_glyph(const struct nk_font*, nk_rune unicode); NK_API void nk_font_atlas_cleanup(struct nk_font_atlas *atlas); NK_API void nk_font_atlas_clear(struct nk_font_atlas*); @@ -4035,7 +4035,7 @@ NK_API void nk_buffer_init_default(struct nk_buffer*); #endif NK_API void nk_buffer_init(struct nk_buffer*, const struct nk_allocator*, nk_size size); NK_API void nk_buffer_init_fixed(struct nk_buffer*, void *memory, nk_size size); -NK_API void nk_buffer_info(struct nk_memory_status*, struct nk_buffer*); +NK_API void nk_buffer_info(struct nk_memory_status*, const struct nk_buffer*); NK_API void nk_buffer_push(struct nk_buffer*, enum nk_buffer_allocation_type type, const void *memory, nk_size size, nk_size align); NK_API void nk_buffer_mark(struct nk_buffer*, enum nk_buffer_allocation_type type); NK_API void nk_buffer_reset(struct nk_buffer*, enum nk_buffer_allocation_type type); @@ -4043,7 +4043,7 @@ NK_API void nk_buffer_clear(struct nk_buffer*); NK_API void nk_buffer_free(struct nk_buffer*); NK_API void *nk_buffer_memory(struct nk_buffer*); NK_API const void *nk_buffer_memory_const(const struct nk_buffer*); -NK_API nk_size nk_buffer_total(struct nk_buffer*); +NK_API nk_size nk_buffer_total(const struct nk_buffer*); /* ============================================================== * @@ -4098,8 +4098,8 @@ NK_API const char *nk_str_at_const(const struct nk_str*, int pos, nk_rune *unico NK_API char *nk_str_get(struct nk_str*); NK_API const char *nk_str_get_const(const struct nk_str*); -NK_API int nk_str_len(struct nk_str*); -NK_API int nk_str_len_char(struct nk_str*); +NK_API int nk_str_len(const struct nk_str*); +NK_API int nk_str_len_char(const struct nk_str*); /*=============================================================== * @@ -4472,8 +4472,8 @@ NK_API void nk_stroke_rect(struct nk_command_buffer*, struct nk_rect, float roun NK_API void nk_stroke_circle(struct nk_command_buffer*, struct nk_rect, float line_thickness, struct nk_color); 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); NK_API void nk_stroke_triangle(struct nk_command_buffer*, float, float, float, float, float, float, float line_thichness, struct nk_color); -NK_API void nk_stroke_polyline(struct nk_command_buffer*, float *points, int point_count, float line_thickness, struct nk_color col); -NK_API void nk_stroke_polygon(struct nk_command_buffer*, float*, int point_count, float line_thickness, struct nk_color); +NK_API void nk_stroke_polyline(struct nk_command_buffer*, const float *points, int point_count, float line_thickness, struct nk_color col); +NK_API void nk_stroke_polygon(struct nk_command_buffer*, const float *points, int point_count, float line_thickness, struct nk_color); /* filled shades */ NK_API void nk_fill_rect(struct nk_command_buffer*, struct nk_rect, float rounding, struct nk_color); @@ -4481,7 +4481,7 @@ NK_API void nk_fill_rect_multi_color(struct nk_command_buffer*, struct nk_rect, NK_API void nk_fill_circle(struct nk_command_buffer*, struct nk_rect, struct nk_color); 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); 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); -NK_API void nk_fill_polygon(struct nk_command_buffer*, float*, int point_count, struct nk_color); +NK_API void nk_fill_polygon(struct nk_command_buffer*, const float *points, int point_count, struct nk_color); /* misc */ NK_API void nk_draw_image(struct nk_command_buffer*, struct nk_rect, const struct nk_image*, struct nk_color); diff --git a/src/nuklear_buffer.c b/src/nuklear_buffer.c index cb789d84e..e3e9b0f26 100644 --- a/src/nuklear_buffer.c +++ b/src/nuklear_buffer.c @@ -242,7 +242,7 @@ nk_buffer_free(struct nk_buffer *b) b->pool.free(b->pool.userdata, b->memory.ptr); } NK_API void -nk_buffer_info(struct nk_memory_status *s, struct nk_buffer *b) +nk_buffer_info(struct nk_memory_status *s, const struct nk_buffer *b) { NK_ASSERT(b); NK_ASSERT(s); @@ -268,10 +268,9 @@ nk_buffer_memory_const(const struct nk_buffer *buffer) return buffer->memory.ptr; } NK_API nk_size -nk_buffer_total(struct nk_buffer *buffer) +nk_buffer_total(const struct nk_buffer *buffer) { NK_ASSERT(buffer); if (!buffer) return 0; return buffer->memory.size; } - diff --git a/src/nuklear_color.c b/src/nuklear_color.c index d73da63bf..f8359d54b 100644 --- a/src/nuklear_color.c +++ b/src/nuklear_color.c @@ -23,7 +23,7 @@ nk_parse_hex(const char *p, int length) return i; } NK_API struct nk_color -nk_rgb_factor(struct nk_color col, const float factor) +nk_rgb_factor(struct nk_color col, float factor) { if (factor == 1.0f) return col; @@ -246,7 +246,7 @@ nk_hsva_colorf(float h, float s, float v, float a) return out; } NK_API struct nk_colorf -nk_hsva_colorfv(float *c) +nk_hsva_colorfv(const float *c) { return nk_hsva_colorf(c[0], c[1], c[2], c[3]); } @@ -421,4 +421,3 @@ nk_color_hsv_bv(nk_byte *out, struct nk_color in) out[1] = (nk_byte)tmp[1]; out[2] = (nk_byte)tmp[2]; } - diff --git a/src/nuklear_combo.c b/src/nuklear_combo.c index 0e403b83c..8cfc6da3f 100644 --- a/src/nuklear_combo.c +++ b/src/nuklear_combo.c @@ -702,7 +702,7 @@ NK_API void nk_combo_close(struct nk_context *ctx) nk_contextual_close(ctx); } NK_API int -nk_combo(struct nk_context *ctx, const char **items, int count, +nk_combo(struct nk_context *ctx, const char *const *items, int count, int selected, int item_height, struct nk_vec2 size) { int i = 0; @@ -820,7 +820,7 @@ nk_combo_callback(struct nk_context *ctx, void(*item_getter)(void*, int, const c } return selected; } NK_API void -nk_combobox(struct nk_context *ctx, const char **items, int count, +nk_combobox(struct nk_context *ctx, const char *const *items, int count, int *selected, int item_height, struct nk_vec2 size) { *selected = nk_combo(ctx, items, count, *selected, item_height, size); @@ -845,4 +845,3 @@ nk_combobox_callback(struct nk_context *ctx, { *selected = nk_combo_callback(ctx, item_getter, userdata, *selected, count, item_height, size); } - diff --git a/src/nuklear_draw.c b/src/nuklear_draw.c index efdf9c59b..8505ed7bf 100644 --- a/src/nuklear_draw.c +++ b/src/nuklear_draw.c @@ -329,7 +329,7 @@ nk_fill_triangle(struct nk_command_buffer *b, float x0, float y0, float x1, cmd->color = c; } NK_API void -nk_stroke_polygon(struct nk_command_buffer *b, float *points, int point_count, +nk_stroke_polygon(struct nk_command_buffer *b, const float *points, int point_count, float line_thickness, struct nk_color col) { int i; @@ -350,7 +350,7 @@ nk_stroke_polygon(struct nk_command_buffer *b, float *points, int point_count, } } NK_API void -nk_fill_polygon(struct nk_command_buffer *b, float *points, int point_count, +nk_fill_polygon(struct nk_command_buffer *b, const float *points, int point_count, struct nk_color col) { int i; @@ -371,7 +371,7 @@ nk_fill_polygon(struct nk_command_buffer *b, float *points, int point_count, } } NK_API void -nk_stroke_polyline(struct nk_command_buffer *b, float *points, int point_count, +nk_stroke_polyline(struct nk_command_buffer *b, const float *points, int point_count, float line_thickness, struct nk_color col) { int i; @@ -555,4 +555,3 @@ nk_draw_text(struct nk_command_buffer *b, struct nk_rect r, NK_MEMCPY(cmd->string, string, (nk_size)length); cmd->string[length] = '\0'; } - diff --git a/src/nuklear_font.c b/src/nuklear_font.c index 72c8e41b3..8688af2f9 100644 --- a/src/nuklear_font.c +++ b/src/nuklear_font.c @@ -504,7 +504,7 @@ nk_font_query_font_glyph(nk_handle handle, float height, } #endif NK_API const struct nk_font_glyph* -nk_font_find_glyph(struct nk_font *font, nk_rune unicode) +nk_font_find_glyph(const struct nk_font *font, nk_rune unicode) { int i = 0; int count; @@ -1370,4 +1370,3 @@ nk_font_atlas_clear(struct nk_font_atlas *atlas) nk_zero_struct(*atlas); } #endif - diff --git a/src/nuklear_internal.h b/src/nuklear_internal.h index 51eef471e..a1523e8e9 100644 --- a/src/nuklear_internal.h +++ b/src/nuklear_internal.h @@ -186,7 +186,7 @@ enum nk_window_insert_location { NK_LIB void *nk_create_window(struct nk_context *ctx); NK_LIB void nk_remove_window(struct nk_context*, struct nk_window*); NK_LIB void nk_free_window(struct nk_context *ctx, struct nk_window *win); -NK_LIB struct nk_window *nk_find_window(struct nk_context *ctx, nk_hash hash, const char *name); +NK_LIB struct nk_window *nk_find_window(const struct nk_context *ctx, nk_hash hash, const char *name); NK_LIB void nk_insert_window(struct nk_context *ctx, struct nk_window *win, enum nk_window_insert_location loc); /* pool */ @@ -206,7 +206,7 @@ NK_LIB void nk_remove_table(struct nk_window *win, struct nk_table *tbl); NK_LIB void nk_free_table(struct nk_context *ctx, struct nk_table *tbl); NK_LIB void nk_push_table(struct nk_window *win, struct nk_table *tbl); NK_LIB nk_uint *nk_add_value(struct nk_context *ctx, struct nk_window *win, nk_hash name, nk_uint value); -NK_LIB nk_uint *nk_find_value(struct nk_window *win, nk_hash name); +NK_LIB nk_uint *nk_find_value(const struct nk_window *win, nk_hash name); /* panel */ NK_LIB void *nk_create_panel(struct nk_context *ctx); @@ -227,7 +227,7 @@ NK_LIB void nk_row_layout(struct nk_context *ctx, enum nk_layout_format fmt, flo NK_LIB void nk_panel_alloc_row(const struct nk_context *ctx, struct nk_window *win); NK_LIB void nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx, struct nk_window *win, int modify); NK_LIB void nk_panel_alloc_space(struct nk_rect *bounds, const struct nk_context *ctx); -NK_LIB void nk_layout_peek(struct nk_rect *bounds, struct nk_context *ctx); +NK_LIB void nk_layout_peek(struct nk_rect *bounds, const struct nk_context *ctx); /* popup */ NK_LIB nk_bool nk_nonblock_begin(struct nk_context *ctx, nk_flags flags, struct nk_rect body, struct nk_rect header, enum nk_panel_type panel_type); @@ -375,4 +375,3 @@ nk_stbtt_free(void *ptr, void *user_data) { #endif /* NK_INCLUDE_FONT_BAKING */ #endif - diff --git a/src/nuklear_layout.c b/src/nuklear_layout.c index e2f3af6fe..84166f236 100644 --- a/src/nuklear_layout.c +++ b/src/nuklear_layout.c @@ -134,7 +134,7 @@ nk_row_layout(struct nk_context *ctx, enum nk_layout_format fmt, win->layout->row.item_width = (float)width; } NK_API float -nk_layout_ratio_from_pixel(struct nk_context *ctx, float pixel_width) +nk_layout_ratio_from_pixel(const struct nk_context *ctx, float pixel_width) { struct nk_window *win; NK_ASSERT(ctx); @@ -463,7 +463,7 @@ nk_layout_space_push(struct nk_context *ctx, struct nk_rect rect) layout->row.item = rect; } NK_API struct nk_rect -nk_layout_space_bounds(struct nk_context *ctx) +nk_layout_space_bounds(const struct nk_context *ctx) { struct nk_rect ret; struct nk_window *win; @@ -482,7 +482,7 @@ nk_layout_space_bounds(struct nk_context *ctx) return ret; } NK_API struct nk_rect -nk_layout_widget_bounds(struct nk_context *ctx) +nk_layout_widget_bounds(const struct nk_context *ctx) { struct nk_rect ret; struct nk_window *win; @@ -501,7 +501,7 @@ nk_layout_widget_bounds(struct nk_context *ctx) return ret; } NK_API struct nk_vec2 -nk_layout_space_to_screen(struct nk_context *ctx, struct nk_vec2 ret) +nk_layout_space_to_screen(const struct nk_context *ctx, struct nk_vec2 ret) { struct nk_window *win; struct nk_panel *layout; @@ -517,7 +517,7 @@ nk_layout_space_to_screen(struct nk_context *ctx, struct nk_vec2 ret) return ret; } NK_API struct nk_vec2 -nk_layout_space_to_local(struct nk_context *ctx, struct nk_vec2 ret) +nk_layout_space_to_local(const struct nk_context *ctx, struct nk_vec2 ret) { struct nk_window *win; struct nk_panel *layout; @@ -533,7 +533,7 @@ nk_layout_space_to_local(struct nk_context *ctx, struct nk_vec2 ret) return ret; } NK_API struct nk_rect -nk_layout_space_rect_to_screen(struct nk_context *ctx, struct nk_rect ret) +nk_layout_space_rect_to_screen(const struct nk_context *ctx, struct nk_rect ret) { struct nk_window *win; struct nk_panel *layout; @@ -549,7 +549,7 @@ nk_layout_space_rect_to_screen(struct nk_context *ctx, struct nk_rect ret) return ret; } NK_API struct nk_rect -nk_layout_space_rect_to_local(struct nk_context *ctx, struct nk_rect ret) +nk_layout_space_rect_to_local(const struct nk_context *ctx, struct nk_rect ret) { struct nk_window *win; struct nk_panel *layout; @@ -730,7 +730,7 @@ nk_panel_alloc_space(struct nk_rect *bounds, const struct nk_context *ctx) layout->row.index++; } NK_LIB void -nk_layout_peek(struct nk_rect *bounds, struct nk_context *ctx) +nk_layout_peek(struct nk_rect *bounds, const struct nk_context *ctx) { float y; int index; diff --git a/src/nuklear_popup.c b/src/nuklear_popup.c index ee3a578bb..6091a8552 100644 --- a/src/nuklear_popup.c +++ b/src/nuklear_popup.c @@ -230,7 +230,7 @@ nk_popup_end(struct nk_context *ctx) nk_push_scissor(&win->buffer, win->layout->clip); } NK_API void -nk_popup_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y) +nk_popup_get_scroll(const struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y) { struct nk_window *popup; diff --git a/src/nuklear_string.c b/src/nuklear_string.c index 01a8de53c..583789391 100644 --- a/src/nuklear_string.c +++ b/src/nuklear_string.c @@ -419,14 +419,14 @@ nk_str_get_const(const struct nk_str *s) return (const char*)s->buffer.memory.ptr; } NK_API int -nk_str_len(struct nk_str *s) +nk_str_len(const struct nk_str *s) { NK_ASSERT(s); if (!s || !s->len || !s->buffer.allocated) return 0; return s->len; } NK_API int -nk_str_len_char(struct nk_str *s) +nk_str_len_char(const struct nk_str *s) { NK_ASSERT(s); if (!s || !s->len || !s->buffer.allocated) return 0; @@ -446,4 +446,3 @@ nk_str_free(struct nk_str *str) nk_buffer_free(&str->buffer); str->len = 0; } - diff --git a/src/nuklear_style.c b/src/nuklear_style.c index acd1278bd..377836a4a 100644 --- a/src/nuklear_style.c +++ b/src/nuklear_style.c @@ -850,7 +850,7 @@ nk_style_load_cursor(struct nk_context *ctx, enum nk_style_cursor cursor, style->cursors[cursor] = c; } NK_API void -nk_style_load_all_cursors(struct nk_context *ctx, struct nk_cursor *cursors) +nk_style_load_all_cursors(struct nk_context *ctx, const struct nk_cursor *cursors) { int i = 0; struct nk_style *style; @@ -861,4 +861,3 @@ nk_style_load_all_cursors(struct nk_context *ctx, struct nk_cursor *cursors) style->cursors[i] = &cursors[i]; style->cursor_visible = nk_true; } - diff --git a/src/nuklear_table.c b/src/nuklear_table.c index d0c45dfc1..a5b298629 100644 --- a/src/nuklear_table.c +++ b/src/nuklear_table.c @@ -71,7 +71,7 @@ nk_add_value(struct nk_context *ctx, struct nk_window *win, return &win->tables->values[win->tables->size++]; } NK_LIB nk_uint* -nk_find_value(struct nk_window *win, nk_hash name) +nk_find_value(const struct nk_window *win, nk_hash name) { struct nk_table *iter = win->tables; while (iter) { @@ -87,4 +87,3 @@ nk_find_value(struct nk_window *win, nk_hash name) } return 0; } - diff --git a/src/nuklear_widget.c b/src/nuklear_widget.c index a21f13721..7521b3e61 100644 --- a/src/nuklear_widget.c +++ b/src/nuklear_widget.c @@ -7,7 +7,7 @@ * * ===============================================================*/ NK_API struct nk_rect -nk_widget_bounds(struct nk_context *ctx) +nk_widget_bounds(const struct nk_context *ctx) { struct nk_rect bounds; NK_ASSERT(ctx); @@ -18,7 +18,7 @@ nk_widget_bounds(struct nk_context *ctx) return bounds; } NK_API struct nk_vec2 -nk_widget_position(struct nk_context *ctx) +nk_widget_position(const struct nk_context *ctx) { struct nk_rect bounds; NK_ASSERT(ctx); @@ -30,7 +30,7 @@ nk_widget_position(struct nk_context *ctx) return nk_vec2(bounds.x, bounds.y); } NK_API struct nk_vec2 -nk_widget_size(struct nk_context *ctx) +nk_widget_size(const struct nk_context *ctx) { struct nk_rect bounds; NK_ASSERT(ctx); @@ -42,7 +42,7 @@ nk_widget_size(struct nk_context *ctx) return nk_vec2(bounds.w, bounds.h); } NK_API float -nk_widget_width(struct nk_context *ctx) +nk_widget_width(const struct nk_context *ctx) { struct nk_rect bounds; NK_ASSERT(ctx); @@ -54,7 +54,7 @@ nk_widget_width(struct nk_context *ctx) return bounds.w; } NK_API float -nk_widget_height(struct nk_context *ctx) +nk_widget_height(const struct nk_context *ctx) { struct nk_rect bounds; NK_ASSERT(ctx); @@ -66,7 +66,7 @@ nk_widget_height(struct nk_context *ctx) return bounds.h; } NK_API nk_bool -nk_widget_is_hovered(struct nk_context *ctx) +nk_widget_is_hovered(const struct nk_context *ctx) { struct nk_rect c, v; struct nk_rect bounds; @@ -88,7 +88,7 @@ nk_widget_is_hovered(struct nk_context *ctx) return nk_input_is_mouse_hovering_rect(&ctx->input, bounds); } NK_API nk_bool -nk_widget_is_mouse_clicked(struct nk_context *ctx, enum nk_buttons btn) +nk_widget_is_mouse_clicked(const struct nk_context *ctx, enum nk_buttons btn) { struct nk_rect c, v; struct nk_rect bounds; @@ -110,7 +110,7 @@ nk_widget_is_mouse_clicked(struct nk_context *ctx, enum nk_buttons btn) return nk_input_mouse_clicked(&ctx->input, btn, bounds); } NK_API nk_bool -nk_widget_has_mouse_click_down(struct nk_context *ctx, enum nk_buttons btn, nk_bool down) +nk_widget_has_mouse_click_down(const struct nk_context *ctx, enum nk_buttons btn, nk_bool down) { struct nk_rect c, v; struct nk_rect bounds; @@ -182,7 +182,7 @@ nk_widget(struct nk_rect *bounds, const struct nk_context *ctx) return NK_WIDGET_VALID; } NK_API enum nk_widget_layout_states -nk_widget_fitting(struct nk_rect *bounds, struct nk_context *ctx, +nk_widget_fitting(struct nk_rect *bounds, const struct nk_context *ctx, struct nk_vec2 item_padding) { /* update the bounds to stand without padding */ diff --git a/src/nuklear_window.c b/src/nuklear_window.c index e3dd51a38..8c286e44e 100644 --- a/src/nuklear_window.c +++ b/src/nuklear_window.c @@ -43,7 +43,7 @@ nk_free_window(struct nk_context *ctx, struct nk_window *win) nk_free_page_element(ctx, pe);} } NK_LIB struct nk_window* -nk_find_window(struct nk_context *ctx, nk_hash hash, const char *name) +nk_find_window(const struct nk_context *ctx, nk_hash hash, const char *name) { struct nk_window *iter; iter = ctx->begin; @@ -352,7 +352,7 @@ nk_window_get_height(const struct nk_context *ctx) return ctx->current->bounds.h; } NK_API struct nk_rect -nk_window_get_content_region(struct nk_context *ctx) +nk_window_get_content_region(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); @@ -360,7 +360,7 @@ nk_window_get_content_region(struct nk_context *ctx) return ctx->current->layout->clip; } NK_API struct nk_vec2 -nk_window_get_content_region_min(struct nk_context *ctx) +nk_window_get_content_region_min(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); @@ -369,7 +369,7 @@ nk_window_get_content_region_min(struct nk_context *ctx) return nk_vec2(ctx->current->layout->clip.x, ctx->current->layout->clip.y); } NK_API struct nk_vec2 -nk_window_get_content_region_max(struct nk_context *ctx) +nk_window_get_content_region_max(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); @@ -379,7 +379,7 @@ nk_window_get_content_region_max(struct nk_context *ctx) ctx->current->layout->clip.y + ctx->current->layout->clip.h); } NK_API struct nk_vec2 -nk_window_get_content_region_size(struct nk_context *ctx) +nk_window_get_content_region_size(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); @@ -388,7 +388,7 @@ nk_window_get_content_region_size(struct nk_context *ctx) return nk_vec2(ctx->current->layout->clip.w, ctx->current->layout->clip.h); } NK_API struct nk_command_buffer* -nk_window_get_canvas(struct nk_context *ctx) +nk_window_get_canvas(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); @@ -397,7 +397,7 @@ nk_window_get_canvas(struct nk_context *ctx) return &ctx->current->buffer; } NK_API struct nk_panel* -nk_window_get_panel(struct nk_context *ctx) +nk_window_get_panel(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); @@ -405,7 +405,7 @@ nk_window_get_panel(struct nk_context *ctx) return ctx->current->layout; } NK_API void -nk_window_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y) +nk_window_get_scroll(const struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y) { struct nk_window *win; NK_ASSERT(ctx); @@ -428,7 +428,7 @@ nk_window_has_focus(const struct nk_context *ctx) return ctx->current == ctx->active; } NK_API nk_bool -nk_window_is_hovered(struct nk_context *ctx) +nk_window_is_hovered(const struct nk_context *ctx) { NK_ASSERT(ctx); NK_ASSERT(ctx->current); @@ -443,7 +443,7 @@ nk_window_is_hovered(struct nk_context *ctx) } } NK_API nk_bool -nk_window_is_any_hovered(struct nk_context *ctx) +nk_window_is_any_hovered(const struct nk_context *ctx) { struct nk_window *iter; NK_ASSERT(ctx); @@ -470,14 +470,14 @@ nk_window_is_any_hovered(struct nk_context *ctx) return 0; } NK_API nk_bool -nk_item_is_any_active(struct nk_context *ctx) +nk_item_is_any_active(const struct nk_context *ctx) { int any_hovered = nk_window_is_any_hovered(ctx); int any_active = (ctx->last_widget_state & NK_WIDGET_STATE_MODIFIED); return any_hovered || any_active; } NK_API nk_bool -nk_window_is_collapsed(struct nk_context *ctx, const char *name) +nk_window_is_collapsed(const struct nk_context *ctx, const char *name) { int title_len; nk_hash title_hash; @@ -492,7 +492,7 @@ nk_window_is_collapsed(struct nk_context *ctx, const char *name) return win->flags & NK_WINDOW_MINIMIZED; } NK_API nk_bool -nk_window_is_closed(struct nk_context *ctx, const char *name) +nk_window_is_closed(const struct nk_context *ctx, const char *name) { int title_len; nk_hash title_hash; @@ -507,7 +507,7 @@ nk_window_is_closed(struct nk_context *ctx, const char *name) return (win->flags & NK_WINDOW_CLOSED); } NK_API nk_bool -nk_window_is_hidden(struct nk_context *ctx, const char *name) +nk_window_is_hidden(const struct nk_context *ctx, const char *name) { int title_len; nk_hash title_hash; @@ -522,7 +522,7 @@ nk_window_is_hidden(struct nk_context *ctx, const char *name) return (win->flags & NK_WINDOW_HIDDEN); } NK_API nk_bool -nk_window_is_active(struct nk_context *ctx, const char *name) +nk_window_is_active(const struct nk_context *ctx, const char *name) { int title_len; nk_hash title_hash; @@ -537,7 +537,7 @@ nk_window_is_active(struct nk_context *ctx, const char *name) return win == ctx->active; } NK_API struct nk_window* -nk_window_find(struct nk_context *ctx, const char *name) +nk_window_find(const struct nk_context *ctx, const char *name) { int title_len; nk_hash title_hash;