X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=instimg;a=blobdiff_plain;f=src%2Fwidgets.c;fp=src%2Fwidgets.c;h=2c08856c53ac3241b296138f70594404b64270a8;hp=8ed6d890874cb823e8051feac3550e056bfbbd7a;hb=d9e1c38ba7dc1bb25604586a197b794983e28d78;hpb=40183e7838f192a20547366ed71f161c2f1a4292 diff --git a/src/widgets.c b/src/widgets.c index 8ed6d89..2c08856 100644 --- a/src/widgets.c +++ b/src/widgets.c @@ -59,7 +59,7 @@ struct wgt_window *wgt_window(const char *title, int width, int height) 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; @@ -232,6 +232,7 @@ struct wgt_widget *wgt_checkbox(struct wgt_window *win, const char *text, int on { 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"); @@ -239,9 +240,11 @@ struct wgt_widget *wgt_checkbox(struct wgt_window *win, const char *text, int on } 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; } @@ -257,7 +260,7 @@ struct wgt_widget *wgt_checkbox(struct wgt_window *win, const char *text, int on 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; @@ -383,7 +386,7 @@ static LRESULT WINAPI event_handler(HWND wnd, unsigned int msg, WPARAM wparam, L default: break; } - + default: return DefWindowProc(wnd, msg, wparam, lparam); }