Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkbox Appearance #2 #733

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removes rounded corners from checkboxes
the rounded corners on the checkboxes looked terrible with the X11 and rawfb demos. This was also in-congruent with the previous look. Reverting to sharp corners keeps the previous look while also removing the issue of the X11 looking terrible. 

This commit also shrinks the select toggle box inside the checkbox by a couple pixels to better match the radio button's look and feel
  • Loading branch information
awschult002 authored Oct 18, 2024
commit 66c5d1166787922007ccd2a1b10bd37929bb8d62
10 changes: 8 additions & 2 deletions src/nuklear_toggle.c
Original file line number Diff line number Diff line change
@@ -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) {
@@ -55,12 +61,12 @@ nk_draw_checkbox(struct nk_command_buffer *out,

/* draw background and cursor */
if (background->type == NK_STYLE_ITEM_COLOR) {
nk_stroke_rect(out, *selector, 2, 2, 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, nk_rgb_factor(background->data.color, style->color_factor));
else nk_fill_rect(out, toggle_active_box, 0, nk_rgb_factor(background->data.color, style->color_factor));
}