| 247 } |
247 } |
| 248 |
248 |
| 249 // types |
249 // types |
| 250 |
250 |
| 251 // public functions |
251 // public functions |
| 252 UiInteger* ui_int_new(UiContext *ctx, char *name) { |
252 UiInteger* ui_int_new(UiContext *ctx, const char *name) { |
| 253 UiInteger *i = ui_malloc(ctx, sizeof(UiInteger)); |
253 UiInteger *i = ui_malloc(ctx, sizeof(UiInteger)); |
| 254 memset(i, 0, sizeof(UiInteger)); |
254 memset(i, 0, sizeof(UiInteger)); |
| 255 if(name) { |
255 if(name) { |
| 256 uic_reg_var(ctx, name, UI_VAR_INTEGER, i); |
256 uic_reg_var(ctx, name, UI_VAR_INTEGER, i); |
| 257 } |
257 } |
| 258 return i; |
258 return i; |
| 259 } |
259 } |
| 260 |
260 |
| 261 UiDouble* ui_double_new(UiContext *ctx, char *name) { |
261 UiDouble* ui_double_new(UiContext *ctx, const char *name) { |
| 262 UiDouble *d = ui_malloc(ctx, sizeof(UiDouble)); |
262 UiDouble *d = ui_malloc(ctx, sizeof(UiDouble)); |
| 263 memset(d, 0, sizeof(UiDouble)); |
263 memset(d, 0, sizeof(UiDouble)); |
| 264 if(name) { |
264 if(name) { |
| 265 uic_reg_var(ctx, name, UI_VAR_DOUBLE, d); |
265 uic_reg_var(ctx, name, UI_VAR_DOUBLE, d); |
| 266 } |
266 } |
| 267 return d; |
267 return d; |
| 268 } |
268 } |
| 269 |
269 |
| 270 UiString* ui_string_new(UiContext *ctx, char *name) { |
270 UiString* ui_string_new(UiContext *ctx, const char *name) { |
| 271 UiString *s = ui_malloc(ctx, sizeof(UiString)); |
271 UiString *s = ui_malloc(ctx, sizeof(UiString)); |
| 272 memset(s, 0, sizeof(UiString)); |
272 memset(s, 0, sizeof(UiString)); |
| 273 if(name) { |
273 if(name) { |
| 274 uic_reg_var(ctx, name, UI_VAR_STRING, s); |
274 uic_reg_var(ctx, name, UI_VAR_STRING, s); |
| 275 } |
275 } |
| 276 return s; |
276 return s; |
| 277 } |
277 } |
| 278 |
278 |
| 279 UiText* ui_text_new(UiContext *ctx, char *name) { |
279 UiText* ui_text_new(UiContext *ctx, const char *name) { |
| 280 UiText *t = ui_malloc(ctx, sizeof(UiText)); |
280 UiText *t = ui_malloc(ctx, sizeof(UiText)); |
| 281 memset(t, 0, sizeof(UiText)); |
281 memset(t, 0, sizeof(UiText)); |
| 282 if(name) { |
282 if(name) { |
| 283 uic_reg_var(ctx, name, UI_VAR_TEXT, t); |
283 uic_reg_var(ctx, name, UI_VAR_TEXT, t); |
| 284 } |
284 } |
| 285 return t; |
285 return t; |
| 286 } |
286 } |
| 287 |
287 |
| 288 UiRange* ui_range_new(UiContext *ctx, char *name) { |
288 UiRange* ui_range_new(UiContext *ctx, const char *name) { |
| 289 UiRange *r = ui_malloc(ctx, sizeof(UiRange)); |
289 UiRange *r = ui_malloc(ctx, sizeof(UiRange)); |
| 290 memset(r, 0, sizeof(UiRange)); |
290 memset(r, 0, sizeof(UiRange)); |
| 291 if(name) { |
291 if(name) { |
| 292 uic_reg_var(ctx, name, UI_VAR_RANGE, r); |
292 uic_reg_var(ctx, name, UI_VAR_RANGE, r); |
| 293 } |
293 } |
| 294 return r; |
294 return r; |
| 295 } |
295 } |
| 296 |
296 |
| 297 UIEXPORT UiGeneric* ui_generic_new(UiContext *ctx, char *name) { |
297 UIEXPORT UiGeneric* ui_generic_new(UiContext *ctx, const char *name) { |
| 298 UiGeneric *g = ui_malloc(ctx, sizeof(UiGeneric)); |
298 UiGeneric *g = ui_malloc(ctx, sizeof(UiGeneric)); |
| 299 memset(g, 0, sizeof(UiGeneric)); |
299 memset(g, 0, sizeof(UiGeneric)); |
| 300 if(name) { |
300 if(name) { |
| 301 uic_reg_var(ctx, name, UI_VAR_GENERIC, g); |
301 uic_reg_var(ctx, name, UI_VAR_GENERIC, g); |
| 302 } |
302 } |