foo
[instimg] / src / widgets.h
1 #ifndef WIDGETS_H_
2 #define WIDGETS_H_
3
4 #include <windows.h>
5
6 #define WGT_AUTO                (-0x4242)
7 #define WGT_AUTOMIN(x)  (-x)
8
9 struct wgt_window;
10 struct wgt_widget;
11
12 struct wgt_rect {
13         int x, y;
14         int width, height;
15 };
16
17 typedef void (*wgt_callback)(struct wgt_widget*);
18
19 struct wgt_window *wgt_window(const char *title, int width, int height);
20 void wgt_destroy_window(struct wgt_window *win);
21 void wgt_destroy_widget(struct wgt_widget *w);
22
23 void wgt_enable_widget(struct wgt_widget *w);
24 void wgt_disable_widget(struct wgt_widget *w);
25 int wgt_widget_enabled(struct wgt_widget *w);
26 struct wgt_window *wgt_widget_window(struct wgt_widget *w);
27 struct wgt_rect *wgt_widget_rect(struct wgt_widget *w, struct wgt_rect *rect);
28 int wgt_xpos_after(struct wgt_widget *w, int pad);
29 int wgt_ypos_after(struct wgt_widget *w, int pad);
30 int wgt_string_size(struct wgt_window *win, const char *s, struct wgt_rect *rect);
31
32 struct wgt_widget *wgt_label(struct wgt_window *win, const char *text, int x, int y);
33 struct wgt_widget *wgt_button(struct wgt_window *win, const char *text, int x, int y,
34                         int width, int height, wgt_callback clickfunc);
35 struct wgt_widget *wgt_checkbox(struct wgt_window *win, const char *text, int on,
36                         int x, int y, int width, int height, wgt_callback modfunc);
37 struct wgt_widget *wgt_combo(struct wgt_window *win, const char **items, int num_items,
38                         int sel, int x, int y, int width, int height, wgt_callback modfunc);
39
40 void wgt_checkbox_check(struct wgt_widget *w);
41 void wgt_checkbox_uncheck(struct wgt_widget *w);
42 int wgt_checkbox_checked(struct wgt_widget *w);
43
44 int wgt_combo_setitems(struct wgt_widget *w, const char **items, int num_items);
45 int wgt_combo_selected(struct wgt_widget *w);
46 const char *wgt_get_combo_item(struct wgt_widget *w, int idx);
47
48 #endif  /* WIDGETS_H_ */