... | ... |
@@ -14,6 +14,17 @@ |
14 | 14 |
|
15 | 15 |
#include <stdarg.h> |
16 | 16 |
|
17 |
+#include "SDL.h" |
|
18 |
+#include "SDL_rwops.h" |
|
19 |
+#include "SDL_image.h" |
|
20 |
+#include "SDL_ttf.h" |
|
21 |
+ |
|
22 |
+/* widget names */ |
|
23 |
+#define WI_LABEL "label" |
|
24 |
+#define WI_FRAME "frame" |
|
25 |
+#define WI_IMAGE "image" |
|
26 |
+ |
|
27 |
+/* structs */ |
|
17 | 28 |
typedef struct xywh_t { |
18 | 29 |
int x; |
19 | 30 |
int y; |
... | ... |
@@ -86,6 +97,9 @@ typedef struct widget_t { |
86 | 97 |
int sizeconfs; |
87 | 98 |
int usedconfs; |
88 | 99 |
wiconf_t **confs; |
100 |
+ SDL_Surface *surface; |
|
101 |
+ SDL_Texture *texture; |
|
102 |
+ int dirty; |
|
89 | 103 |
} widget_t; |
90 | 104 |
|
91 | 105 |
typedef struct witoplevel_t { |
... | ... |
@@ -100,6 +114,9 @@ typedef struct witoplevel_t { |
100 | 114 |
int sizeconfs; |
101 | 115 |
int usedconfs; |
102 | 116 |
wiconf_t **confs; |
117 |
+ SDL_Window *win; |
|
118 |
+ SDL_Renderer *renderer; |
|
119 |
+ int dirty; |
|
103 | 120 |
} witoplevel_t; |
104 | 121 |
|
105 | 122 |
typedef struct wialias_t { |
... | ... |
@@ -135,6 +152,21 @@ typedef struct wiclass_t { |
135 | 152 |
void (*classcallback)(void *wi, struct wiclass_t *cl, widget_t *widget, wiclassop_t *op); |
136 | 153 |
} wiclass_t; |
137 | 154 |
|
155 |
+typedef struct wifontinstance_t { |
|
156 |
+ int size; |
|
157 |
+ TTF_Font *font; |
|
158 |
+} wifontinstance_t; |
|
159 |
+ |
|
160 |
+typedef struct wifont_t { |
|
161 |
+ char *name; |
|
162 |
+ int sizedata; |
|
163 |
+ char *data; |
|
164 |
+ SDL_RWops *rwops; |
|
165 |
+ int sizefontinstances; |
|
166 |
+ int usedfontinstances; |
|
167 |
+ wifontinstance_t *fontinstances; |
|
168 |
+} wifont_t; |
|
169 |
+ |
|
138 | 170 |
typedef struct wi_t { |
139 | 171 |
int sizeclasses; |
140 | 172 |
int usedclasses; |
... | ... |
@@ -149,6 +181,9 @@ typedef struct wi_t { |
149 | 181 |
int sizevars; |
150 | 182 |
int usedvars; |
151 | 183 |
wivar_t **vars; |
184 |
+ int sizefonts; |
|
185 |
+ int usedfonts; |
|
186 |
+ wifont_t *fonts; |
|
152 | 187 |
} wi_t; |
153 | 188 |
|
154 | 189 |
wi_t wi_init(void); |
... | ... |
@@ -173,5 +208,11 @@ int wi_tree_move(wi_t *wi, char *path, char *newparent); |
173 | 208 |
int wi_var_updated(wi_t *wi, char *vardata, int sizevardata); |
174 | 209 |
int wi_var_destroy(wi_t *wi, char *vardata, int sizevardata); |
175 | 210 |
|
211 |
+int wi_font_load(wi_t *wi, char *filename, char *fontname); |
|
212 |
+ |
|
213 |
+/* default widgets */ |
|
214 |
+void wi_classcallback_frame(void *wi, wiclass_t *cl, widget_t *widget, wiclassop_t *op); |
|
215 |
+void wi_classcallback_label(void *wi, wiclass_t *cl, widget_t *widget, wiclassop_t *op); |
|
216 |
+void wi_classcallback_image(void *wi, wiclass_t *cl, widget_t *widget, wiclassop_t *op); |
|
176 | 217 |
#endif |
177 | 218 |
|