memset(&wc, 0, sizeof wc);
wc.hInstance = hinst;
- wc.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
+ wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
wc.hCursor = LoadCursor(0, IDC_ARROW);
wc.hIcon = LoadIcon(0, IDI_APPLICATION);
wc.lpszClassName = win->cname;
{
struct wgt_widget *w;
struct wgt_rect textsz;
+ int check_width;
if(!(w = calloc(1, sizeof *w))) {
fprintf(stderr, "wgt_checkbox: failed to allocate widget structure\n");
}
w->win = win;
+ check_width = GetSystemMetrics(SM_CXMENUCHECK);
+
if(width < 0 || height < 0) {
wgt_string_size(win, text, &textsz);
- if(width < 0) width = textsz.width + 32; /* XXX */
+ if(width < 0) width = textsz.width + check_width + 10;
if(height < 0) height = textsz.height;
}
w->rect.width = width;
w->rect.height = height;
- w->cb_modify = modfunc;
+ w->cb_click = modfunc; /* BN_CLICKED is sent for checkbox state changes */
w->next = win->wlist;
win->wlist = w;
return w;
default:
break;
}
-
+
default:
return DefWindowProc(wnd, msg, wparam, lparam);
}