6 static struct wgt_window *win;
7 static struct wgt_widget *lb_instto, *bn_inst, *bn_cancel, *cb_devs, *ck_usbonly;
9 static void onclick(struct wgt_widget *w);
10 static void onmodify(struct wgt_widget *w);
12 int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hprevinst, char *cmdline, int showcmd)
16 static const char *items[] = {
23 if(!(win = wgt_window("256boss USB stick installer", 400, 300))) {
26 lb_instto = wgt_label(win, "Install to device:", 10, 10);
28 x = wgt_xpos_after(lb_instto, WGT_AUTO);
29 cb_devs = wgt_combo(win, items, sizeof items / sizeof *items, 0,
30 x, 10, WGT_AUTO, WGT_AUTO, onmodify);
32 y = wgt_ypos_after(cb_devs, 16);
33 ck_usbonly = wgt_checkbox(win, "only show USB devices", 1, x, y,
34 WGT_AUTO, WGT_AUTO, 0);
36 y = wgt_ypos_after(ck_usbonly, 16);
37 bn_inst = wgt_button(win, "Install", 10, y, WGT_AUTO, WGT_AUTO, onclick);
39 x = wgt_xpos_after(bn_inst, WGT_AUTO);
40 bn_cancel = wgt_button(win, "Cancel", x, y, WGT_AUTO, WGT_AUTO, onclick);
42 while(GetMessage(&msg, 0, 0, 0)) {
43 TranslateMessage(&msg);
44 DispatchMessage(&msg);
47 wgt_destroy_window(win);
51 static void onclick(struct wgt_widget *w)
53 MessageBox(0, "clicked", "clicked", MB_OK);
56 static void onmodify(struct wgt_widget *w)
58 int sel = wgt_combo_selected(w);
60 const char *selstr = wgt_get_combo_item(w, sel);
61 MessageBox(0, selstr, "selected item", MB_OK);