@@ -3594,7 +3594,7 @@ NK_API nk_bool nk_color_pick(struct nk_context*, struct nk_colorf*, enum nk_colo
35943594 * a `#` at the beginning. It will not be shown but guarantees correct behavior.
35953595 *
35963596 * ```c
3597- * void nk_property_int(struct nk_context *ctx, const char *name, int min, int *val, int max, int step, float inc_per_pixel);
3597+ * nk_bool nk_property_int(struct nk_context *ctx, const char *name, int min, int *val, int max, int step, float inc_per_pixel);
35983598 * ```
35993599 *
36003600 * Parameter | Description
@@ -3606,8 +3606,10 @@ NK_API nk_bool nk_color_pick(struct nk_context*, struct nk_colorf*, enum nk_colo
36063606 * \param[in] max | Maximum value not allowed to be overflown
36073607 * \param[in] step | Increment added and subtracted on increment and decrement button
36083608 * \param[in] inc_per_pixel | Value per pixel added or subtracted on dragging
3609+ *
3610+ * \returns `true(1)` if the value changed
36093611 */
3610- NK_API void nk_property_int(struct nk_context*, const char *name, int min, int *val, int max, int step, float inc_per_pixel);
3612+ 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);
36113613
36123614/**
36133615 * # # nk_property_float
@@ -3617,7 +3619,7 @@ NK_API void nk_property_int(struct nk_context*, const char *name, int min, int *
36173619 * a `#` at the beginning. It will not be shown but guarantees correct behavior.
36183620 *
36193621 * ```c
3620- * void nk_property_float(struct nk_context *ctx, const char *name, float min, float *val, float max, float step, float inc_per_pixel);
3622+ * nk_bool nk_property_float(struct nk_context *ctx, const char *name, float min, float *val, float max, float step, float inc_per_pixel);
36213623 * ```
36223624 *
36233625 * Parameter | Description
@@ -3629,8 +3631,10 @@ NK_API void nk_property_int(struct nk_context*, const char *name, int min, int *
36293631 * \param[in] max | Maximum value not allowed to be overflown
36303632 * \param[in] step | Increment added and subtracted on increment and decrement button
36313633 * \param[in] inc_per_pixel | Value per pixel added or subtracted on dragging
3634+ *
3635+ * \returns `true(1)` if the value changed
36323636 */
3633- NK_API void nk_property_float(struct nk_context*, const char *name, float min, float *val, float max, float step, float inc_per_pixel);
3637+ 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);
36343638
36353639/**
36363640 * # # nk_property_double
@@ -3640,7 +3644,7 @@ NK_API void nk_property_float(struct nk_context*, const char *name, float min, f
36403644 * a `#` at the beginning. It will not be shown but guarantees correct behavior.
36413645 *
36423646 * ```c
3643- * void nk_property_double(struct nk_context *ctx, const char *name, double min, double *val, double max, double step, double inc_per_pixel);
3647+ * nk_bool nk_property_double(struct nk_context *ctx, const char *name, double min, double *val, double max, double step, double inc_per_pixel);
36443648 * ```
36453649 *
36463650 * Parameter | Description
@@ -3652,8 +3656,10 @@ NK_API void nk_property_float(struct nk_context*, const char *name, float min, f
36523656 * \param[in] max | Maximum value not allowed to be overflown
36533657 * \param[in] step | Increment added and subtracted on increment and decrement button
36543658 * \param[in] inc_per_pixel | Value per pixel added or subtracted on dragging
3659+ *
3660+ * \returns `true(1)` if the value changed
36553661 */
3656- NK_API void nk_property_double(struct nk_context*, const char *name, double min, double *val, double max, double step, float inc_per_pixel);
3662+ 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);
36573663
36583664/**
36593665 * # # nk_propertyi
@@ -3795,10 +3801,10 @@ NK_API int nk_combo(struct nk_context*, const char *const *items, int count, int
37953801NK_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);
37963802NK_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);
37973803NK_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);
3798- NK_API void nk_combobox(struct nk_context*, const char *const *items, int count, int *selected, int item_height, struct nk_vec2 size);
3799- 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);
3800- 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);
3801- 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);
3804+ NK_API nk_bool nk_combobox(struct nk_context*, const char *const *items, int count, int *selected, int item_height, struct nk_vec2 size);
3805+ 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);
3806+ 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);
3807+ 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);
38023808/* =============================================================================
38033809 *
38043810 * ABSTRACT COMBOBOX
@@ -29179,47 +29185,56 @@ nk_property(struct nk_context *ctx, const char *name, struct nk_property_variant
2917929185 win->edit.active = nk_false;
2918029186 }
2918129187}
29182- NK_API void
29188+ NK_API nk_bool
2918329189nk_property_int(struct nk_context *ctx, const char *name,
2918429190 int min, int *val, int max, int step, float inc_per_pixel)
2918529191{
2918629192 struct nk_property_variant variant;
29193+ nk_bool changed;
2918729194 NK_ASSERT(ctx);
2918829195 NK_ASSERT(name);
2918929196 NK_ASSERT(val);
2919029197
29191- if (!ctx || !ctx->current || !name || !val) return;
29198+ if (!ctx || !ctx->current || !name || !val) return nk_false ;
2919229199 variant = nk_property_variant_int(*val, min, max, step);
2919329200 nk_property(ctx, name, &variant, inc_per_pixel, NK_FILTER_INT);
29201+ changed = variant.value.i != *val;
2919429202 *val = variant.value.i;
29203+ return changed;
2919529204}
29196- NK_API void
29205+ NK_API nk_bool
2919729206nk_property_float(struct nk_context *ctx, const char *name,
2919829207 float min, float *val, float max, float step, float inc_per_pixel)
2919929208{
2920029209 struct nk_property_variant variant;
29210+ nk_bool changed;
2920129211 NK_ASSERT(ctx);
2920229212 NK_ASSERT(name);
2920329213 NK_ASSERT(val);
2920429214
29205- if (!ctx || !ctx->current || !name || !val) return;
29215+ if (!ctx || !ctx->current || !name || !val) return nk_false ;
2920629216 variant = nk_property_variant_float(*val, min, max, step);
2920729217 nk_property(ctx, name, &variant, inc_per_pixel, NK_FILTER_FLOAT);
29218+ changed = variant.value.f != *val;
2920829219 *val = variant.value.f;
29220+ return changed;
2920929221}
29210- NK_API void
29222+ NK_API nk_bool
2921129223nk_property_double(struct nk_context *ctx, const char *name,
2921229224 double min, double *val, double max, double step, float inc_per_pixel)
2921329225{
2921429226 struct nk_property_variant variant;
29227+ nk_bool changed;
2921529228 NK_ASSERT(ctx);
2921629229 NK_ASSERT(name);
2921729230 NK_ASSERT(val);
2921829231
29219- if (!ctx || !ctx->current || !name || !val) return;
29232+ if (!ctx || !ctx->current || !name || !val) return nk_false ;
2922029233 variant = nk_property_variant_double(*val, min, max, step);
2922129234 nk_property(ctx, name, &variant, inc_per_pixel, NK_FILTER_FLOAT);
29235+ changed = variant.value.d != *val;
2922229236 *val = variant.value.d;
29237+ return changed;
2922329238}
2922429239NK_API int
2922529240nk_propertyi(struct nk_context *ctx, const char *name, int min, int val,
@@ -30624,31 +30639,39 @@ nk_combo_callback(struct nk_context *ctx, void(*item_getter)(void*, int, const c
3062430639 nk_combo_end(ctx);
3062530640 } return selected;
3062630641}
30627- NK_API void
30642+ NK_API nk_bool
3062830643nk_combobox(struct nk_context *ctx, const char *const *items, int count,
3062930644 int *selected, int item_height, struct nk_vec2 size)
3063030645{
30646+ int tmp = *selected;
3063130647 *selected = nk_combo(ctx, items, count, *selected, item_height, size);
30648+ return tmp != *selected;
3063230649}
30633- NK_API void
30650+ NK_API nk_bool
3063430651nk_combobox_string(struct nk_context *ctx, const char *items_separated_by_zeros,
3063530652 int *selected, int count, int item_height, struct nk_vec2 size)
3063630653{
30654+ int tmp = *selected;
3063730655 *selected = nk_combo_string(ctx, items_separated_by_zeros, *selected, count, item_height, size);
30656+ return tmp != *selected;
3063830657}
30639- NK_API void
30658+ NK_API nk_bool
3064030659nk_combobox_separator(struct nk_context *ctx, const char *items_separated_by_separator,
3064130660 int separator, int *selected, int count, int item_height, struct nk_vec2 size)
3064230661{
30662+ int tmp = *selected;
3064330663 *selected = nk_combo_separator(ctx, items_separated_by_separator, separator,
3064430664 *selected, count, item_height, size);
30665+ return tmp != *selected;
3064530666}
30646- NK_API void
30667+ NK_API nk_bool
3064730668nk_combobox_callback(struct nk_context *ctx,
3064830669 void(*item_getter)(void* data, int id, const char **out_text),
3064930670 void *userdata, int *selected, int count, int item_height, struct nk_vec2 size)
3065030671{
30672+ int tmp = *selected;
3065130673 *selected = nk_combo_callback(ctx, item_getter, userdata, *selected, count, item_height, size);
30674+ return tmp != *selected;
3065230675}
3065330676
3065430677
0 commit comments