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