17 enum { RTK_NONE, RTK_VBOX, RTK_HBOX };
25 enum { RTK_PUSHBN, RTK_TOGGLEBN };
27 typedef struct rtk_screen rtk_screen;
28 typedef union rtk_widget rtk_widget;
29 typedef struct rtk_icon rtk_icon;
30 typedef struct rtk_iconsheet rtk_iconsheet;
32 typedef struct rtk_rect {
33 int x, y, width, height;
36 typedef struct rtk_icon {
38 int width, height, scanlen;
41 struct rtk_icon *next;
45 typedef struct rtk_draw_ops {
46 void (*fill)(rtk_rect *rect, uint32_t color);
47 void (*blit)(int x, int y, rtk_icon *icon);
48 void (*drawtext)(int x, int y, const char *str);
49 void (*textrect)(const char *str, rtk_rect *rect);
52 typedef void (*rtk_callback)(rtk_widget*, void*);
55 void rtk_setup(rtk_draw_ops *drawop);
57 /* widget functions */
58 rtk_widget *rtk_create_widget(void);
59 void rtk_free_widget(rtk_widget *w);
61 int rtk_type(rtk_widget *w);
62 rtk_widget *rtk_parent(rtk_widget *w);
64 void rtk_move(rtk_widget *w, int x, int y);
65 void rtk_pos(rtk_widget *w, int *xptr, int *yptr);
66 void rtk_resize(rtk_widget *w, int xsz, int ysz);
67 void rtk_size(rtk_widget *w, int *xptr, int *yptr);
68 void rtk_get_rect(rtk_widget *w, rtk_rect *r);
70 int rtk_set_text(rtk_widget *w, const char *str);
71 const char *rtk_get_text(rtk_widget *w);
73 void rtk_set_value(rtk_widget *w, int val);
74 int rtk_get_value(rtk_widget *w);
76 void rtk_set_callback(rtk_widget *w, rtk_callback cbfunc, void *cls);
78 void rtk_show(rtk_widget *w);
79 void rtk_hide(rtk_widget *w);
80 int rtk_visible(const rtk_widget *w);
82 void rtk_invalidate(rtk_widget *w);
83 void rtk_validate(rtk_widget *w);
85 /* window functions */
86 void rtk_win_layout(rtk_widget *w, int layout);
87 void rtk_win_clear(rtk_widget *w);
88 void rtk_win_add(rtk_widget *par, rtk_widget *child);
89 void rtk_win_rm(rtk_widget *par, rtk_widget *child);
90 int rtk_win_has(rtk_widget *par, rtk_widget *child);
92 /* button functions */
93 void rtk_bn_mode(rtk_widget *w, int mode);
94 void rtk_bn_set_icon(rtk_widget *w, rtk_icon *icon);
95 rtk_icon *rtk_bn_get_icon(rtk_widget *w);
97 rtk_widget *rtk_create_window(rtk_widget *par, const char *title, int x, int y,
98 int width, int height, unsigned int flags);
99 rtk_widget *rtk_create_button(rtk_widget *par, const char *str, rtk_callback cbfunc);
100 rtk_widget *rtk_create_iconbutton(rtk_widget *par, rtk_icon *icon, rtk_callback cbfunc);
101 rtk_widget *rtk_create_label(rtk_widget *par, const char *text);
102 rtk_widget *rtk_create_checkbox(rtk_widget *par, const char *text, int chk, rtk_callback cbfunc);
103 rtk_widget *rtk_create_separator(rtk_widget *par);
106 rtk_iconsheet *rtk_load_iconsheet(const char *fname);
107 void rtk_free_iconsheet(rtk_iconsheet *is);
109 rtk_icon *rtk_define_icon(rtk_iconsheet *is, const char *name, int x, int y, int w, int h);
110 rtk_icon *rtk_lookup_icon(rtk_iconsheet *is, const char *name);
113 void rtk_draw_widget(rtk_widget *w);
116 int rtk_input_key(rtk_widget *w, int key, int press);
117 int rtk_input_mbutton(rtk_widget *w, int bn, int press, int x, int y);
118 int rtk_input_mmotion(rtk_widget *w, int x, int y);
121 void rtk_fix_rect(rtk_rect *r);
122 void rtk_rect_union(rtk_rect *a, const rtk_rect *b);