Skip to content
Open
4 changes: 2 additions & 2 deletions demo/x11/nuklear_xlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -927,8 +927,8 @@ nk_xlib_render(Drawable screen, struct nk_color clear)
} break;
case NK_COMMAND_RECT: {
const struct nk_command_rect *r = (const struct nk_command_rect *)cmd;
nk_xsurf_stroke_rect(surf, r->x, r->y, NK_MAX(r->w -r->line_thickness, 0),
NK_MAX(r->h - r->line_thickness, 0), (unsigned short)r->rounding,
nk_xsurf_stroke_rect(surf, r->x, r->y, r->w,
r->h, (unsigned short)r->rounding,
r->line_thickness, r->color);
} break;
case NK_COMMAND_RECT_FILLED: {
Expand Down
4 changes: 2 additions & 2 deletions demo/x11_xft/nuklear_xlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -1012,8 +1012,8 @@ nk_xlib_render(Drawable screen, struct nk_color clear)
} break;
case NK_COMMAND_RECT: {
const struct nk_command_rect *r = (const struct nk_command_rect *)cmd;
nk_xsurf_stroke_rect(surf, r->x, r->y, NK_MAX(r->w -r->line_thickness, 0),
NK_MAX(r->h - r->line_thickness, 0), (unsigned short)r->rounding,
nk_xsurf_stroke_rect(surf, r->x, r->y, r->w,
r->h, (unsigned short)r->rounding,
r->line_thickness, r->color);
} break;
case NK_COMMAND_RECT_FILLED: {
Expand Down
15 changes: 8 additions & 7 deletions nuklear.h
Original file line number Diff line number Diff line change
Expand Up @@ -24907,17 +24907,18 @@ nk_draw_checkbox(struct nk_command_buffer *out,
text.padding.y = 0;
text.background = style->text_background;
nk_widget_text(out, *label, string, len, &text, text_alignment, font);

/* draw background and cursor */
if (background->type == NK_STYLE_ITEM_COLOR) {
nk_fill_rect(out, *selector, 0, nk_rgb_factor(style->border_color, style->color_factor));
nk_fill_rect(out, nk_shrink_rect(*selector, style->border), 0, nk_rgb_factor(background->data.color, style->color_factor));
nk_stroke_rect(out, *selector, 2, 2, nk_rgb_factor(background->data.color, style->color_factor));
} else nk_draw_image(out, *selector, &background->data.image, nk_rgb_factor(nk_white, style->color_factor));
if (active) {
if (cursor->type == NK_STYLE_ITEM_IMAGE)
nk_draw_image(out, *cursors, &cursor->data.image, nk_rgb_factor(nk_white, style->color_factor));
else nk_fill_rect(out, *cursors, 0, cursor->data.color);
else nk_fill_rect(out, *cursors, 0, nk_rgb_factor(background->data.color, style->color_factor));
}


}
NK_LIB void
nk_draw_option(struct nk_command_buffer *out,
Expand Down Expand Up @@ -24953,13 +24954,12 @@ nk_draw_option(struct nk_command_buffer *out,

/* draw background and cursor */
if (background->type == NK_STYLE_ITEM_COLOR) {
nk_fill_circle(out, *selector, nk_rgb_factor(style->border_color, style->color_factor));
nk_fill_circle(out, nk_shrink_rect(*selector, style->border), nk_rgb_factor(background->data.color, style->color_factor));
nk_stroke_circle(out, *selector, 2, nk_rgb_factor(background->data.color, style->color_factor));
} else nk_draw_image(out, *selector, &background->data.image, nk_rgb_factor(nk_white, style->color_factor));
if (active) {
if (cursor->type == NK_STYLE_ITEM_IMAGE)
nk_draw_image(out, *cursors, &cursor->data.image, nk_rgb_factor(nk_white, style->color_factor));
else nk_fill_circle(out, *cursors, cursor->data.color);
else nk_fill_circle(out, *cursors, background->data.color);
}
}
NK_LIB nk_bool
Expand Down Expand Up @@ -30542,6 +30542,7 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args)
/// - 2022/12/23 (4.10.6) - Fix incorrect glyph index in nk_font_bake()
/// - 2022/12/17 (4.10.5) - Fix nk_font_bake_pack() using TTC font offset incorrectly
/// - 2022/10/24 (4.10.4) - Fix nk_str_{append,insert}_str_utf8 always returning 0
/// - 2022/10/03 (4.10.4) - Updated the look and feel of checkboxes and radio buttons to be more distinguishable
/// - 2022/09/03 (4.10.3) - Renamed the `null` texture variable to `tex_null`
/// - 2022/08/01 (4.10.2) - Fix Apple Silicon with incorrect NK_SITE_TYPE and NK_POINTER_TYPE
/// - 2022/08/01 (4.10.1) - Fix cursor jumping back to beginning of text when typing more than
Expand Down
1 change: 1 addition & 0 deletions src/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
/// - 2022/12/23 (4.10.6) - Fix incorrect glyph index in nk_font_bake()
/// - 2022/12/17 (4.10.5) - Fix nk_font_bake_pack() using TTC font offset incorrectly
/// - 2022/10/24 (4.10.4) - Fix nk_str_{append,insert}_str_utf8 always returning 0
/// - 2022/10/03 (4.10.4) - Updated the look and feel of checkboxes and radio buttons to be more distinguishable
/// - 2022/09/03 (4.10.3) - Renamed the `null` texture variable to `tex_null`
/// - 2022/08/01 (4.10.2) - Fix Apple Silicon with incorrect NK_SITE_TYPE and NK_POINTER_TYPE
/// - 2022/08/01 (4.10.1) - Fix cursor jumping back to beginning of text when typing more than
Expand Down
20 changes: 13 additions & 7 deletions src/nuklear_toggle.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ nk_draw_checkbox(struct nk_command_buffer *out,
const struct nk_style_item *background;
const struct nk_style_item *cursor;
struct nk_text text;
struct nk_rect toggle_active_box = *cursors;
toggle_active_box.x += 1;
toggle_active_box.y += 1;
toggle_active_box.w -= 2;
toggle_active_box.h -= 2;


/* select correct colors/images */
if (state & NK_WIDGET_STATE_HOVER) {
Expand All @@ -52,17 +58,18 @@ nk_draw_checkbox(struct nk_command_buffer *out,
text.padding.y = 0;
text.background = style->text_background;
nk_widget_text(out, *label, string, len, &text, text_alignment, font);

/* draw background and cursor */
if (background->type == NK_STYLE_ITEM_COLOR) {
nk_fill_rect(out, *selector, 0, nk_rgb_factor(style->border_color, style->color_factor));
nk_fill_rect(out, nk_shrink_rect(*selector, style->border), 0, nk_rgb_factor(background->data.color, style->color_factor));
nk_stroke_rect(out, *selector, 2, 0, nk_rgb_factor(background->data.color, style->color_factor));
} else nk_draw_image(out, *selector, &background->data.image, nk_rgb_factor(nk_white, style->color_factor));
if (active) {
if (cursor->type == NK_STYLE_ITEM_IMAGE)
nk_draw_image(out, *cursors, &cursor->data.image, nk_rgb_factor(nk_white, style->color_factor));
else nk_fill_rect(out, *cursors, 0, cursor->data.color);
else nk_fill_rect(out, toggle_active_box, 0, nk_rgb_factor(background->data.color, style->color_factor));
}


}
NK_LIB void
nk_draw_option(struct nk_command_buffer *out,
Expand Down Expand Up @@ -98,13 +105,12 @@ nk_draw_option(struct nk_command_buffer *out,

/* draw background and cursor */
if (background->type == NK_STYLE_ITEM_COLOR) {
nk_fill_circle(out, *selector, nk_rgb_factor(style->border_color, style->color_factor));
nk_fill_circle(out, nk_shrink_rect(*selector, style->border), nk_rgb_factor(background->data.color, style->color_factor));
nk_stroke_circle(out, *selector, 2, nk_rgb_factor(background->data.color, style->color_factor));
} else nk_draw_image(out, *selector, &background->data.image, nk_rgb_factor(nk_white, style->color_factor));
if (active) {
if (cursor->type == NK_STYLE_ITEM_IMAGE)
nk_draw_image(out, *cursors, &cursor->data.image, nk_rgb_factor(nk_white, style->color_factor));
else nk_fill_circle(out, *cursors, cursor->data.color);
else nk_fill_circle(out, *cursors, background->data.color);
}
}
NK_LIB nk_bool
Expand Down