X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fwidgets.h;h=d170966345e4170344fa98c66934f20a04339caf;hb=c81bf22901960cf05babbb157272d784f47a18f6;hp=a81da8f33afcabfa58a1e6fdfa9f4f7e8deb8d9e;hpb=4f312c9361b1f4c63d7697e58503cd0fb8b05fff;p=instimg diff --git a/src/widgets.h b/src/widgets.h index a81da8f..d170966 100644 --- a/src/widgets.h +++ b/src/widgets.h @@ -3,7 +3,8 @@ #include -#define WGT_AUTO (-0x4242) +#define WGT_AUTO (-0x4242) +#define WGT_AUTOMIN(x) (-x) struct wgt_window; struct wgt_widget; @@ -15,12 +16,31 @@ struct wgt_rect { typedef void (*wgt_callback)(struct wgt_widget*); +/* returns {win32: HWND, !win32: 0} */ +void *wgt_window_handle(struct wgt_window *win); +void *wgt_widget_handle(struct wgt_widget *w); +/* returns {UNIX: Window, !UNIX: 0} */ +unsigned int wgt_window_xid(struct wgt_window *win); +unsigned int wgt_widget_xid(struct wgt_widget *w); + + struct wgt_window *wgt_window(const char *title, int width, int height); void wgt_destroy_window(struct wgt_window *win); +void wgt_free_window(struct wgt_window *win); /* destroy and then free(win) */ void wgt_destroy_widget(struct wgt_widget *w); +void wgt_resize_window(struct wgt_window *win, int width, int height); + +void wgt_quit_on_close(struct wgt_window *win, int quit); +void wgt_close_action(struct wgt_window *win, int (*func)(struct wgt_window*)); + +void wgt_enable_widget(struct wgt_widget *w); +void wgt_disable_widget(struct wgt_widget *w); +int wgt_widget_enabled(struct wgt_widget *w); struct wgt_window *wgt_widget_window(struct wgt_widget *w); struct wgt_rect *wgt_widget_rect(struct wgt_widget *w, struct wgt_rect *rect); +void wgt_move_widget(struct wgt_widget *w, int x, int y); +void wgt_resize_widget(struct wgt_widget *w, int width, int height); int wgt_xpos_after(struct wgt_widget *w, int pad); int wgt_ypos_after(struct wgt_widget *w, int pad); int wgt_string_size(struct wgt_window *win, const char *s, struct wgt_rect *rect); @@ -32,8 +52,18 @@ struct wgt_widget *wgt_checkbox(struct wgt_window *win, const char *text, int on int x, int y, int width, int height, wgt_callback modfunc); struct wgt_widget *wgt_combo(struct wgt_window *win, const char **items, int num_items, int sel, int x, int y, int width, int height, wgt_callback modfunc); +struct wgt_widget *wgt_progbar(struct wgt_window *win, int x, int y, int width, int height, int p); +void wgt_set_text(struct wgt_widget *w, const char *text); + +void wgt_checkbox_check(struct wgt_widget *w); +void wgt_checkbox_uncheck(struct wgt_widget *w); +int wgt_checkbox_checked(struct wgt_widget *w); + +int wgt_combo_setitems(struct wgt_widget *w, const char **items, int num_items); int wgt_combo_selected(struct wgt_widget *w); const char *wgt_get_combo_item(struct wgt_widget *w, int idx); -#endif /* WIDGETS_H_ */ \ No newline at end of file +void wgt_set_progress(struct wgt_widget *w, int p); + +#endif /* WIDGETS_H_ */