6 #define WGT_AUTO (-0x4242)
7 #define WGT_AUTOMIN(x) (-x)
17 typedef void (*wgt_callback)(struct wgt_widget*);
19 /* returns {win32: HWND, !win32: 0} */
20 void *wgt_window_handle(struct wgt_window *win);
21 void *wgt_widget_handle(struct wgt_widget *w);
22 /* returns {UNIX: Window, !UNIX: 0} */
23 unsigned int wgt_window_xid(struct wgt_window *win);
24 unsigned int wgt_widget_xid(struct wgt_widget *w);
27 struct wgt_window *wgt_window(const char *title, int width, int height);
28 void wgt_destroy_window(struct wgt_window *win);
29 void wgt_free_window(struct wgt_window *win); /* destroy and then free(win) */
30 void wgt_destroy_widget(struct wgt_widget *w);
32 void wgt_resize_window(struct wgt_window *win, int width, int height);
34 void wgt_quit_on_close(struct wgt_window *win, int quit);
35 void wgt_close_action(struct wgt_window *win, int (*func)(struct wgt_window*));
37 void wgt_enable_widget(struct wgt_widget *w);
38 void wgt_disable_widget(struct wgt_widget *w);
39 int wgt_widget_enabled(struct wgt_widget *w);
40 struct wgt_window *wgt_widget_window(struct wgt_widget *w);
41 struct wgt_rect *wgt_widget_rect(struct wgt_widget *w, struct wgt_rect *rect);
42 void wgt_move_widget(struct wgt_widget *w, int x, int y);
43 void wgt_resize_widget(struct wgt_widget *w, int width, int height);
44 int wgt_xpos_after(struct wgt_widget *w, int pad);
45 int wgt_ypos_after(struct wgt_widget *w, int pad);
46 int wgt_string_size(struct wgt_window *win, const char *s, struct wgt_rect *rect);
48 struct wgt_widget *wgt_label(struct wgt_window *win, const char *text, int x, int y);
49 struct wgt_widget *wgt_button(struct wgt_window *win, const char *text, int x, int y,
50 int width, int height, wgt_callback clickfunc);
51 struct wgt_widget *wgt_checkbox(struct wgt_window *win, const char *text, int on,
52 int x, int y, int width, int height, wgt_callback modfunc);
53 struct wgt_widget *wgt_combo(struct wgt_window *win, const char **items, int num_items,
54 int sel, int x, int y, int width, int height, wgt_callback modfunc);
55 struct wgt_widget *wgt_progbar(struct wgt_window *win, int x, int y, int width, int height, int p);
57 void wgt_set_text(struct wgt_widget *w, const char *text);
59 void wgt_checkbox_check(struct wgt_widget *w);
60 void wgt_checkbox_uncheck(struct wgt_widget *w);
61 int wgt_checkbox_checked(struct wgt_widget *w);
63 int wgt_combo_setitems(struct wgt_widget *w, const char **items, int num_items);
64 int wgt_combo_selected(struct wgt_widget *w);
65 const char *wgt_get_combo_item(struct wgt_widget *w, int idx);
67 void wgt_set_progress(struct wgt_widget *w, int p);
69 #endif /* WIDGETS_H_ */