15 enum { RTK_NONE, RTK_VBOX, RTK_HBOX };
17 enum { RTK_PUSHBN, RTK_TOGGLEBN };
19 typedef struct rtk_screen rtk_screen;
20 typedef union rtk_widget rtk_widget;
21 typedef struct rtk_icon rtk_icon;
22 typedef struct rtk_iconsheet rtk_iconsheet;
24 typedef struct rtk_rect {
25 int x, y, width, height;
28 typedef struct rtk_icon {
30 int width, height, scanlen;
33 struct rtk_icon *next;
37 typedef struct rtk_draw_ops {
38 void (*fill)(rtk_rect *rect, uint32_t color);
39 void (*blit)(int x, int y, rtk_icon *icon);
40 void (*drawtext)(int x, int y, const char *str);
41 void (*textrect)(const char *str, rtk_rect *rect);
44 typedef void (*rtk_callback)(rtk_widget*, void*);
47 void rtk_setup(rtk_draw_ops *drawop);
49 /* widget functions */
50 rtk_widget *rtk_create_widget(void);
51 void rtk_free_widget(rtk_widget *w);
53 int rtk_type(rtk_widget *w);
54 rtk_widget *rtk_parent(rtk_widget *w);
56 void rtk_move(rtk_widget *w, int x, int y);
57 void rtk_pos(rtk_widget *w, int *xptr, int *yptr);
58 void rtk_resize(rtk_widget *w, int xsz, int ysz);
59 void rtk_size(rtk_widget *w, int *xptr, int *yptr);
61 int rtk_set_text(rtk_widget *w, const char *str);
62 const char *rtk_get_text(rtk_widget *w);
64 void rtk_set_value(rtk_widget *w, int val);
65 int rtk_get_value(rtk_widget *w);
67 void rtk_set_callback(rtk_widget *w, rtk_callback cbfunc, void *cls);
69 /* window functions */
70 void rtk_win_layout(rtk_widget *w, int layout);
71 void rtk_win_clear(rtk_widget *w);
72 void rtk_win_add(rtk_widget *par, rtk_widget *child);
73 void rtk_win_rm(rtk_widget *par, rtk_widget *child);
74 int rtk_win_has(rtk_widget *par, rtk_widget *child);
76 /* button functions */
77 void rtk_bn_mode(rtk_widget *w, int mode);
78 void rtk_bn_set_icon(rtk_widget *w, rtk_icon *icon);
79 rtk_icon *rtk_bn_get_icon(rtk_widget *w);
81 rtk_widget *rtk_create_window(rtk_widget *par, const char *title, int x, int y, int w, int h);
82 rtk_widget *rtk_create_button(rtk_widget *par, const char *str, rtk_callback cbfunc);
83 rtk_widget *rtk_create_iconbutton(rtk_widget *par, rtk_icon *icon, rtk_callback cbfunc);
84 rtk_widget *rtk_create_label(rtk_widget *par, const char *text);
85 rtk_widget *rtk_create_checkbox(rtk_widget *par, const char *text, int chk, rtk_callback cbfunc);
86 rtk_widget *rtk_create_separator(rtk_widget *par);
89 rtk_iconsheet *rtk_load_iconsheet(const char *fname);
90 void rtk_free_iconsheet(rtk_iconsheet *is);
92 rtk_icon *rtk_define_icon(rtk_iconsheet *is, const char *name, int x, int y, int w, int h);
93 rtk_icon *rtk_lookup_icon(rtk_iconsheet *is, const char *name);
96 void rtk_draw_widget(rtk_widget *w);
99 int rtk_input_key(rtk_widget *w, int key, int press);
100 int rtk_input_mbutton(rtk_widget *w, int bn, int press, int x, int y);
101 int rtk_input_mmotion(rtk_widget *w, int x, int y);