ui/common/context.c

branch
newapi
changeset 337
2904fba2708b
parent 335
91d4f0391282
child 341
c7427cadabd3
equal deleted inserted replaced
336:56c12f44c2d3 337:2904fba2708b
241 } 241 }
242 case UI_VAR_RANGE: { 242 case UI_VAR_RANGE: {
243 val = ui_range_new(ctx, NULL); 243 val = ui_range_new(ctx, NULL);
244 break; 244 break;
245 } 245 }
246 case UI_VAR_GENERIC: {
247 val = ui_generic_new(ctx, NULL);
248 }
246 } 249 }
247 return val; 250 return val;
248 } 251 }
249 252
250 253
341 t->setextent(t, t->extent); 344 t->setextent(t, t->extent);
342 t->setrange(t, t->min, t->max); 345 t->setrange(t, t->min, t->max);
343 t->set(t, t->value); 346 t->set(t, t->value);
344 break; 347 break;
345 } 348 }
349 case UI_VAR_GENERIC: {
350 UiGeneric *f = fromvalue;
351 UiGeneric *t = to->value;
352 if(!f->obj) break;
353 uic_generic_copy(f, t);
354 t->set(t, t->value, t->type);
355 break;
356 }
346 } 357 }
347 } 358 }
348 359
349 void uic_save_var2(UiVar *var) { 360 void uic_save_var2(UiVar *var) {
350 switch(var->type) { 361 switch(var->type) {
353 case UI_VAR_DOUBLE: uic_double_save(var->value); break; 364 case UI_VAR_DOUBLE: uic_double_save(var->value); break;
354 case UI_VAR_STRING: uic_string_save(var->value); break; 365 case UI_VAR_STRING: uic_string_save(var->value); break;
355 case UI_VAR_TEXT: uic_text_save(var->value); break; 366 case UI_VAR_TEXT: uic_text_save(var->value); break;
356 case UI_VAR_LIST: break; 367 case UI_VAR_LIST: break;
357 case UI_VAR_RANGE: uic_range_save(var->value); break; 368 case UI_VAR_RANGE: uic_range_save(var->value); break;
369 case UI_VAR_GENERIC: uic_generic_save(var->value); break;
358 } 370 }
359 } 371 }
360 372
361 void uic_unbind_var(UiVar *var) { 373 void uic_unbind_var(UiVar *var) {
362 switch(var->type) { 374 switch(var->type) {
365 case UI_VAR_DOUBLE: uic_double_unbind(var->value); break; 377 case UI_VAR_DOUBLE: uic_double_unbind(var->value); break;
366 case UI_VAR_STRING: uic_string_unbind(var->value); break; 378 case UI_VAR_STRING: uic_string_unbind(var->value); break;
367 case UI_VAR_TEXT: uic_text_unbind(var->value); break; 379 case UI_VAR_TEXT: uic_text_unbind(var->value); break;
368 case UI_VAR_LIST: uic_list_unbind(var->value); break; 380 case UI_VAR_LIST: uic_list_unbind(var->value); break;
369 case UI_VAR_RANGE: uic_range_unbind(var->value); break; 381 case UI_VAR_RANGE: uic_range_unbind(var->value); break;
382 case UI_VAR_GENERIC: uic_generic_unbind(var->value); break;
370 } 383 }
371 } 384 }
372 385
373 void uic_reg_var(UiContext *ctx, char *name, UiVarType type, void *value) { 386 void uic_reg_var(UiContext *ctx, char *name, UiVarType type, void *value) {
374 // TODO: do we need/want this? Why adding vars to a context after 387 // TODO: do we need/want this? Why adding vars to a context after

mercurial