projects
/
instimg
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
correct window background color, and checkbox horizontal size
[instimg]
/
src
/
widgets.c
diff --git
a/src/widgets.c
b/src/widgets.c
index
8ed6d89
..
2c08856
100644
(file)
--- 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;
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;
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;
{
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");
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;
}
w->win = win;
+ check_width = GetSystemMetrics(SM_CXMENUCHECK);
+
if(width < 0 || height < 0) {
wgt_string_size(win, text, &textsz);
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;
}
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->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;
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:
break;
}
-
+
default:
return DefWindowProc(wnd, msg, wparam, lparam);
}
default:
return DefWindowProc(wnd, msg, wparam, lparam);
}