7 static struct wgt_window *win;
8 static struct wgt_widget *lb_instto, *bn_inst, *bn_cancel, *cb_devs, *ck_usbonly;
9 static struct rawdisk_device rawdev[64];
10 static int num_rawdev;
12 static void onclick(struct wgt_widget *w);
13 static void onmodify(struct wgt_widget *w);
15 int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hprevinst, char *cmdline, int showcmd)
19 static const char *items[64];
21 if((num_rawdev = rawdisk_detect(rawdev, sizeof rawdev / sizeof *rawdev)) == -1) {
24 for(i=0; i<num_rawdev; i++) {
25 items[i] = rawdev[i].name;
28 if(!(win = wgt_window("256boss USB stick installer", 400, 300))) {
31 lb_instto = wgt_label(win, "Install to device:", 10, 10);
33 x = wgt_xpos_after(lb_instto, WGT_AUTO);
34 cb_devs = wgt_combo(win, items, num_rawdev, 0, x, 10, WGT_AUTOMIN(30), WGT_AUTO,
37 y = wgt_ypos_after(cb_devs, 16);
38 ck_usbonly = wgt_checkbox(win, "only show USB devices", 1, x, y,
39 WGT_AUTO, WGT_AUTO, 0);
41 y = wgt_ypos_after(ck_usbonly, 16);
42 bn_inst = wgt_button(win, "Install", 10, y, WGT_AUTO, WGT_AUTO, onclick);
44 x = wgt_xpos_after(bn_inst, WGT_AUTO);
45 bn_cancel = wgt_button(win, "Cancel", x, y, WGT_AUTO, WGT_AUTO, onclick);
48 wgt_disable_widget(cb_devs);
49 wgt_disable_widget(bn_inst);
52 while(GetMessage(&msg, 0, 0, 0)) {
53 TranslateMessage(&msg);
54 DispatchMessage(&msg);
57 wgt_destroy_window(win);
61 static void onclick(struct wgt_widget *w)
63 MessageBox(0, "clicked", "clicked", MB_OK);
66 static void onmodify(struct wgt_widget *w)
68 int sel = wgt_combo_selected(w);
70 const char *selstr = wgt_get_combo_item(w, sel);
71 MessageBox(0, selstr, "selected item", MB_OK);