@@ -28262,13 +28262,18 @@ nk_combo_begin_text(struct nk_context *ctx, const char *selected, int len,
2826228262 struct nk_rect label;
2826328263 struct nk_rect button;
2826428264 struct nk_rect content;
28265+ int draw_button_symbol;
2826528266
2826628267 enum nk_symbol_type sym;
2826728268 if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER)
2826828269 sym = style->combo.sym_hover;
2826928270 else if (is_clicked)
2827028271 sym = style->combo.sym_active;
28271- else sym = style->combo.sym_normal;
28272+ else
28273+ sym = style->combo.sym_normal;
28274+
28275+ /* represents whether or not the combo's button symbol should be drawn */
28276+ draw_button_symbol = sym != NK_SYMBOL_NONE;
2827228277
2827328278 /* calculate button */
2827428279 button.w = header.h - 2 * style->combo.button_padding.y;
@@ -28285,14 +28290,18 @@ nk_combo_begin_text(struct nk_context *ctx, const char *selected, int len,
2828528290 text.padding = nk_vec2(0,0);
2828628291 label.x = header.x + style->combo.content_padding.x;
2828728292 label.y = header.y + style->combo.content_padding.y;
28288- label.w = button.x - (style->combo.content_padding.x + style->combo.spacing.x) - label.x;;
2828928293 label.h = header.h - 2 * style->combo.content_padding.y;
28294+ if (draw_button_symbol)
28295+ label.w = button.x - (style->combo.content_padding.x + style->combo.spacing.x) - label.x;
28296+ else
28297+ label.w = header.w - 2 * style->combo.content_padding.x;
2829028298 nk_widget_text(&win->buffer, label, selected, len, &text,
2829128299 NK_TEXT_LEFT, ctx->style.font);
2829228300
2829328301 /* draw open/close button */
28294- nk_draw_button_symbol(&win->buffer, &button, &content, ctx->last_widget_state,
28295- &ctx->style.combo.button, sym, style->font);
28302+ if (draw_button_symbol)
28303+ nk_draw_button_symbol(&win->buffer, &button, &content, ctx->last_widget_state,
28304+ &ctx->style.combo.button, sym, style->font);
2829628305 }
2829728306 return nk_combo_begin(ctx, win, size, is_clicked, header);
2829828307}
@@ -28346,6 +28355,7 @@ nk_combo_begin_color(struct nk_context *ctx, struct nk_color color, struct nk_ve
2834628355 struct nk_rect content;
2834728356 struct nk_rect button;
2834828357 struct nk_rect bounds;
28358+ int draw_button_symbol;
2834928359
2835028360 enum nk_symbol_type sym;
2835128361 if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER)
@@ -28354,6 +28364,9 @@ nk_combo_begin_color(struct nk_context *ctx, struct nk_color color, struct nk_ve
2835428364 sym = style->combo.sym_active;
2835528365 else sym = style->combo.sym_normal;
2835628366
28367+ /* represents whether or not the combo's button symbol should be drawn */
28368+ draw_button_symbol = sym != NK_SYMBOL_NONE;
28369+
2835728370 /* calculate button */
2835828371 button.w = header.h - 2 * style->combo.button_padding.y;
2835928372 button.x = (header.x + header.w - header.h) - style->combo.button_padding.x;
@@ -28369,12 +28382,16 @@ nk_combo_begin_color(struct nk_context *ctx, struct nk_color color, struct nk_ve
2836928382 bounds.h = header.h - 4 * style->combo.content_padding.y;
2837028383 bounds.y = header.y + 2 * style->combo.content_padding.y;
2837128384 bounds.x = header.x + 2 * style->combo.content_padding.x;
28372- bounds.w = (button.x - (style->combo.content_padding.x + style->combo.spacing.x)) - bounds.x;
28385+ if (draw_button_symbol)
28386+ bounds.w = (button.x - (style->combo.content_padding.x + style->combo.spacing.x)) - bounds.x;
28387+ else
28388+ bounds.w = header.w - 4 * style->combo.content_padding.x;
2837328389 nk_fill_rect(&win->buffer, bounds, 0, color);
2837428390
2837528391 /* draw open/close button */
28376- nk_draw_button_symbol(&win->buffer, &button, &content, ctx->last_widget_state,
28377- &ctx->style.combo.button, sym, style->font);
28392+ if (draw_button_symbol)
28393+ nk_draw_button_symbol(&win->buffer, &button, &content, ctx->last_widget_state,
28394+ &ctx->style.combo.button, sym, style->font);
2837828395 }
2837928396 return nk_combo_begin(ctx, win, size, is_clicked, header);
2838028397}
@@ -28606,6 +28623,7 @@ nk_combo_begin_image(struct nk_context *ctx, struct nk_image img, struct nk_vec2
2860628623 struct nk_rect bounds = {0,0,0,0};
2860728624 struct nk_rect content;
2860828625 struct nk_rect button;
28626+ int draw_button_symbol;
2860928627
2861028628 enum nk_symbol_type sym;
2861128629 if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER)
@@ -28614,6 +28632,9 @@ nk_combo_begin_image(struct nk_context *ctx, struct nk_image img, struct nk_vec2
2861428632 sym = style->combo.sym_active;
2861528633 else sym = style->combo.sym_normal;
2861628634
28635+ /* represents whether or not the combo's button symbol should be drawn */
28636+ draw_button_symbol = sym != NK_SYMBOL_NONE;
28637+
2861728638 /* calculate button */
2861828639 button.w = header.h - 2 * style->combo.button_padding.y;
2861928640 button.x = (header.x + header.w - header.h) - style->combo.button_padding.y;
@@ -28629,12 +28650,16 @@ nk_combo_begin_image(struct nk_context *ctx, struct nk_image img, struct nk_vec2
2862928650 bounds.h = header.h - 2 * style->combo.content_padding.y;
2863028651 bounds.y = header.y + style->combo.content_padding.y;
2863128652 bounds.x = header.x + style->combo.content_padding.x;
28632- bounds.w = (button.x - style->combo.content_padding.y) - bounds.x;
28653+ if (draw_button_symbol)
28654+ bounds.w = (button.x - style->combo.content_padding.y) - bounds.x;
28655+ else
28656+ bounds.w = header.w - 2 * style->combo.content_padding.x;
2863328657 nk_draw_image(&win->buffer, bounds, &img, nk_white);
2863428658
2863528659 /* draw open/close button */
28636- nk_draw_button_symbol(&win->buffer, &bounds, &content, ctx->last_widget_state,
28637- &ctx->style.combo.button, sym, style->font);
28660+ if (draw_button_symbol)
28661+ nk_draw_button_symbol(&win->buffer, &bounds, &content, ctx->last_widget_state,
28662+ &ctx->style.combo.button, sym, style->font);
2863828663 }
2863928664 return nk_combo_begin(ctx, win, size, is_clicked, header);
2864028665}
@@ -28691,6 +28716,7 @@ nk_combo_begin_image_text(struct nk_context *ctx, const char *selected, int len,
2869128716 struct nk_rect button;
2869228717 struct nk_rect label;
2869328718 struct nk_rect image;
28719+ int draw_button_symbol;
2869428720
2869528721 enum nk_symbol_type sym;
2869628722 if (ctx->last_widget_state & NK_WIDGET_STATE_HOVER)
@@ -28699,6 +28725,9 @@ nk_combo_begin_image_text(struct nk_context *ctx, const char *selected, int len,
2869928725 sym = style->combo.sym_active;
2870028726 else sym = style->combo.sym_normal;
2870128727
28728+ /* represents whether or not the combo's button symbol should be drawn */
28729+ draw_button_symbol = sym != NK_SYMBOL_NONE;
28730+
2870228731 /* calculate button */
2870328732 button.w = header.h - 2 * style->combo.button_padding.y;
2870428733 button.x = (header.x + header.w - header.h) - style->combo.button_padding.x;
@@ -28709,8 +28738,9 @@ nk_combo_begin_image_text(struct nk_context *ctx, const char *selected, int len,
2870928738 content.y = button.y + style->combo.button.padding.y;
2871028739 content.w = button.w - 2 * style->combo.button.padding.x;
2871128740 content.h = button.h - 2 * style->combo.button.padding.y;
28712- nk_draw_button_symbol(&win->buffer, &button, &content, ctx->last_widget_state,
28713- &ctx->style.combo.button, sym, style->font);
28741+ if (draw_button_symbol)
28742+ nk_draw_button_symbol(&win->buffer, &button, &content, ctx->last_widget_state,
28743+ &ctx->style.combo.button, sym, style->font);
2871428744
2871528745 /* draw image */
2871628746 image.x = header.x + style->combo.content_padding.x;
@@ -28723,8 +28753,11 @@ nk_combo_begin_image_text(struct nk_context *ctx, const char *selected, int len,
2872328753 text.padding = nk_vec2(0,0);
2872428754 label.x = image.x + image.w + style->combo.spacing.x + style->combo.content_padding.x;
2872528755 label.y = header.y + style->combo.content_padding.y;
28726- label.w = (button.x - style->combo.content_padding.x) - label.x;
2872728756 label.h = header.h - 2 * style->combo.content_padding.y;
28757+ if (draw_button_symbol)
28758+ label.w = (button.x - style->combo.content_padding.x) - label.x;
28759+ else
28760+ label.w = (header.x + header.w - style->combo.content_padding.x) - label.x;
2872828761 nk_widget_text(&win->buffer, label, selected, len, &text, NK_TEXT_LEFT, style->font);
2872928762 }
2873028763 return nk_combo_begin(ctx, win, size, is_clicked, header);
@@ -29097,6 +29130,7 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args)
2909729130/// - [yy]: Minor version with non-breaking API and library changes
2909829131/// - [zz]: Bug fix version with no direct changes to API
2909929132///
29133+ /// - 2020/06/04 (4.03.0) - Made nk_combo header symbols optional.
2910029134/// - 2020/05/27 (4.02.5) - Fix nk_do_edit: Keep scroll position when re-activating edit widget.
2910129135/// - 2020/05/09 (4.02.4) - Fix nk_menubar height calculation bug
2910229136/// - 2020/05/08 (4.02.3) - Fix missing stdarg.h with NK_INCLUDE_STANDARD_VARARGS
0 commit comments