X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=instimg;a=blobdiff_plain;f=src%2Fwidgets.h;fp=src%2Fwidgets.h;h=d170966345e4170344fa98c66934f20a04339caf;hp=caf4a4ef4f4f1c3fe65f953c4dccbeb09a94c349;hb=4f2abaf24d97f5d6fc253cca51ec87a8a95ab048;hpb=b1499ac7c1fce954a3f79e9a059466de3554e8d6 diff --git a/src/widgets.h b/src/widgets.h index caf4a4e..d170966 100644 --- a/src/widgets.h +++ b/src/widgets.h @@ -16,15 +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); @@ -36,6 +52,9 @@ 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); @@ -45,4 +64,6 @@ 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); +void wgt_set_progress(struct wgt_widget *w, int p); + #endif /* WIDGETS_H_ */