@@ -3580,7 +3580,7 @@ NK_API nk_bool nk_color_pick(struct nk_context*, struct nk_colorf*, enum nk_colo
35803580 * a `#` at the beginning. It will not be shown but guarantees correct behavior.
35813581 *
35823582 * ```c
3583- * void nk_property_int(struct nk_context *ctx, const char *name, int min, int *val, int max, int step, float inc_per_pixel);
3583+ * nk_bool nk_property_int(struct nk_context *ctx, const char *name, int min, int *val, int max, int step, float inc_per_pixel);
35843584 * ```
35853585 *
35863586 * Parameter | Description
@@ -3592,8 +3592,10 @@ NK_API nk_bool nk_color_pick(struct nk_context*, struct nk_colorf*, enum nk_colo
35923592 * \param[in] max | Maximum value not allowed to be overflown
35933593 * \param[in] step | Increment added and subtracted on increment and decrement button
35943594 * \param[in] inc_per_pixel | Value per pixel added or subtracted on dragging
3595+ *
3596+ * \returns `true(1)` if the value changed
35953597 */
3596- NK_API void nk_property_int(struct nk_context*, const char *name, int min, int *val, int max, int step, float inc_per_pixel);
3598+ NK_API nk_bool nk_property_int(struct nk_context*, const char *name, int min, int *val, int max, int step, float inc_per_pixel);
35973599
35983600/**
35993601 * # # nk_property_float
@@ -3603,7 +3605,7 @@ NK_API void nk_property_int(struct nk_context*, const char *name, int min, int *
36033605 * a `#` at the beginning. It will not be shown but guarantees correct behavior.
36043606 *
36053607 * ```c
3606- * void nk_property_float(struct nk_context *ctx, const char *name, float min, float *val, float max, float step, float inc_per_pixel);
3608+ * nk_bool nk_property_float(struct nk_context *ctx, const char *name, float min, float *val, float max, float step, float inc_per_pixel);
36073609 * ```
36083610 *
36093611 * Parameter | Description
@@ -3615,8 +3617,10 @@ NK_API void nk_property_int(struct nk_context*, const char *name, int min, int *
36153617 * \param[in] max | Maximum value not allowed to be overflown
36163618 * \param[in] step | Increment added and subtracted on increment and decrement button
36173619 * \param[in] inc_per_pixel | Value per pixel added or subtracted on dragging
3620+ *
3621+ * \returns `true(1)` if the value changed
36183622 */
3619- NK_API void nk_property_float(struct nk_context*, const char *name, float min, float *val, float max, float step, float inc_per_pixel);
3623+ NK_API nk_bool nk_property_float(struct nk_context*, const char *name, float min, float *val, float max, float step, float inc_per_pixel);
36203624
36213625/**
36223626 * # # nk_property_double
@@ -3626,7 +3630,7 @@ NK_API void nk_property_float(struct nk_context*, const char *name, float min, f
36263630 * a `#` at the beginning. It will not be shown but guarantees correct behavior.
36273631 *
36283632 * ```c
3629- * void nk_property_double(struct nk_context *ctx, const char *name, double min, double *val, double max, double step, double inc_per_pixel);
3633+ * nk_bool nk_property_double(struct nk_context *ctx, const char *name, double min, double *val, double max, double step, double inc_per_pixel);
36303634 * ```
36313635 *
36323636 * Parameter | Description
@@ -3638,8 +3642,10 @@ NK_API void nk_property_float(struct nk_context*, const char *name, float min, f
36383642 * \param[in] max | Maximum value not allowed to be overflown
36393643 * \param[in] step | Increment added and subtracted on increment and decrement button
36403644 * \param[in] inc_per_pixel | Value per pixel added or subtracted on dragging
3645+ *
3646+ * \returns `true(1)` if the value changed
36413647 */
3642- NK_API void nk_property_double(struct nk_context*, const char *name, double min, double *val, double max, double step, float inc_per_pixel);
3648+ NK_API nk_bool nk_property_double(struct nk_context*, const char *name, double min, double *val, double max, double step, float inc_per_pixel);
36433649
36443650/**
36453651 * # # nk_propertyi
@@ -3781,10 +3787,10 @@ NK_API int nk_combo(struct nk_context*, const char *const *items, int count, int
37813787NK_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);
37823788NK_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);
37833789NK_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);
3784- NK_API void nk_combobox(struct nk_context*, const char *const *items, int count, int *selected, int item_height, struct nk_vec2 size);
3785- 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);
3786- 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);
3787- 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);
3790+ NK_API nk_bool nk_combobox(struct nk_context*, const char *const *items, int count, int *selected, int item_height, struct nk_vec2 size);
3791+ NK_API nk_bool nk_combobox_string(struct nk_context*, const char *items_separated_by_zeros, int *selected, int count, int item_height, struct nk_vec2 size);
3792+ NK_API nk_bool 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);
3793+ NK_API nk_bool 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);
37883794/* =============================================================================
37893795 *
37903796 * ABSTRACT COMBOBOX
@@ -29149,47 +29155,56 @@ nk_property(struct nk_context *ctx, const char *name, struct nk_property_variant
2914929155 win->edit.active = nk_false;
2915029156 }
2915129157}
29152- NK_API void
29158+ NK_API nk_bool
2915329159nk_property_int(struct nk_context *ctx, const char *name,
2915429160 int min, int *val, int max, int step, float inc_per_pixel)
2915529161{
2915629162 struct nk_property_variant variant;
29163+ nk_bool changed;
2915729164 NK_ASSERT(ctx);
2915829165 NK_ASSERT(name);
2915929166 NK_ASSERT(val);
2916029167
29161- if (!ctx || !ctx->current || !name || !val) return;
29168+ if (!ctx || !ctx->current || !name || !val) return nk_false ;
2916229169 variant = nk_property_variant_int(*val, min, max, step);
2916329170 nk_property(ctx, name, &variant, inc_per_pixel, NK_FILTER_INT);
29171+ changed = variant.value.i != *val;
2916429172 *val = variant.value.i;
29173+ return changed;
2916529174}
29166- NK_API void
29175+ NK_API nk_bool
2916729176nk_property_float(struct nk_context *ctx, const char *name,
2916829177 float min, float *val, float max, float step, float inc_per_pixel)
2916929178{
2917029179 struct nk_property_variant variant;
29180+ nk_bool changed;
2917129181 NK_ASSERT(ctx);
2917229182 NK_ASSERT(name);
2917329183 NK_ASSERT(val);
2917429184
29175- if (!ctx || !ctx->current || !name || !val) return;
29185+ if (!ctx || !ctx->current || !name || !val) return nk_false ;
2917629186 variant = nk_property_variant_float(*val, min, max, step);
2917729187 nk_property(ctx, name, &variant, inc_per_pixel, NK_FILTER_FLOAT);
29188+ changed = variant.value.f != *val;
2917829189 *val = variant.value.f;
29190+ return changed;
2917929191}
29180- NK_API void
29192+ NK_API nk_bool
2918129193nk_property_double(struct nk_context *ctx, const char *name,
2918229194 double min, double *val, double max, double step, float inc_per_pixel)
2918329195{
2918429196 struct nk_property_variant variant;
29197+ nk_bool changed;
2918529198 NK_ASSERT(ctx);
2918629199 NK_ASSERT(name);
2918729200 NK_ASSERT(val);
2918829201
29189- if (!ctx || !ctx->current || !name || !val) return;
29202+ if (!ctx || !ctx->current || !name || !val) return nk_false ;
2919029203 variant = nk_property_variant_double(*val, min, max, step);
2919129204 nk_property(ctx, name, &variant, inc_per_pixel, NK_FILTER_FLOAT);
29205+ changed = variant.value.d != *val;
2919229206 *val = variant.value.d;
29207+ return changed;
2919329208}
2919429209NK_API int
2919529210nk_propertyi(struct nk_context *ctx, const char *name, int min, int val,
@@ -30594,31 +30609,39 @@ nk_combo_callback(struct nk_context *ctx, void(*item_getter)(void*, int, const c
3059430609 nk_combo_end(ctx);
3059530610 } return selected;
3059630611}
30597- NK_API void
30612+ NK_API nk_bool
3059830613nk_combobox(struct nk_context *ctx, const char *const *items, int count,
3059930614 int *selected, int item_height, struct nk_vec2 size)
3060030615{
30616+ int tmp = *selected;
3060130617 *selected = nk_combo(ctx, items, count, *selected, item_height, size);
30618+ return tmp != *selected;
3060230619}
30603- NK_API void
30620+ NK_API nk_bool
3060430621nk_combobox_string(struct nk_context *ctx, const char *items_separated_by_zeros,
3060530622 int *selected, int count, int item_height, struct nk_vec2 size)
3060630623{
30624+ int tmp = *selected;
3060730625 *selected = nk_combo_string(ctx, items_separated_by_zeros, *selected, count, item_height, size);
30626+ return tmp != *selected;
3060830627}
30609- NK_API void
30628+ NK_API nk_bool
3061030629nk_combobox_separator(struct nk_context *ctx, const char *items_separated_by_separator,
3061130630 int separator, int *selected, int count, int item_height, struct nk_vec2 size)
3061230631{
30632+ int tmp = *selected;
3061330633 *selected = nk_combo_separator(ctx, items_separated_by_separator, separator,
3061430634 *selected, count, item_height, size);
30635+ return tmp != *selected;
3061530636}
30616- NK_API void
30637+ NK_API nk_bool
3061730638nk_combobox_callback(struct nk_context *ctx,
3061830639 void(*item_getter)(void* data, int id, const char **out_text),
3061930640 void *userdata, int *selected, int count, int item_height, struct nk_vec2 size)
3062030641{
30642+ int tmp = *selected;
3062130643 *selected = nk_combo_callback(ctx, item_getter, userdata, *selected, count, item_height, size);
30644+ return tmp != *selected;
3062230645}
3062330646
3062430647
0 commit comments