221 uic_reg_var(ctx, name, UI_VAR_INTEGER, i); |
221 uic_reg_var(ctx, name, UI_VAR_INTEGER, i); |
222 } |
222 } |
223 return i; |
223 return i; |
224 } |
224 } |
225 |
225 |
|
226 UiDouble* ui_double_new(UiContext *ctx, char *name) { |
|
227 UiDouble *d = ui_malloc(ctx, sizeof(UiDouble)); |
|
228 memset(d, 0, sizeof(UiDouble)); |
|
229 if(name) { |
|
230 uic_reg_var(ctx, name, UI_VAR_DOUBLE, d); |
|
231 } |
|
232 return d; |
|
233 } |
|
234 |
226 UiString* ui_string_new(UiContext *ctx, char *name) { |
235 UiString* ui_string_new(UiContext *ctx, char *name) { |
227 UiString *s = ui_malloc(ctx, sizeof(UiString)); |
236 UiString *s = ui_malloc(ctx, sizeof(UiString)); |
228 memset(s, 0, sizeof(UiString)); |
237 memset(s, 0, sizeof(UiString)); |
229 if(name) { |
238 if(name) { |
230 uic_reg_var(ctx, name, UI_VAR_STRING, s); |
239 uic_reg_var(ctx, name, UI_VAR_STRING, s); |
239 uic_reg_var(ctx, name, UI_VAR_TEXT, t); |
248 uic_reg_var(ctx, name, UI_VAR_TEXT, t); |
240 } |
249 } |
241 return t; |
250 return t; |
242 } |
251 } |
243 |
252 |
|
253 UiRange* ui_range_new(UiContext *ctx, char *name) { |
|
254 UiRange *r = ui_malloc(ctx, sizeof(UiRange)); |
|
255 memset(r, 0, sizeof(UiRange)); |
|
256 if(name) { |
|
257 uic_reg_var(ctx, name, UI_VAR_RANGE, r); |
|
258 } |
|
259 return r; |
|
260 } |
|
261 |
244 |
262 |
245 // private functions |
263 // private functions |
246 void uic_int_copy(UiInteger *from, UiInteger *to) { |
264 void uic_int_copy(UiInteger *from, UiInteger *to) { |
|
265 to->get = from->get; |
|
266 to->set = from->set; |
|
267 to->obj = from->obj; |
|
268 } |
|
269 |
|
270 void uic_double_copy(UiDouble *from, UiDouble *to) { |
247 to->get = from->get; |
271 to->get = from->get; |
248 to->set = from->set; |
272 to->set = from->set; |
249 to->obj = from->obj; |
273 to->obj = from->obj; |
250 } |
274 } |
251 |
275 |