ui/common/document.c

changeset 33
458831c574f4
parent 3
c1a75454b444
child 37
56016468753d
equal deleted inserted replaced
32:9a5f47fbc5c3 33:458831c574f4
246 //t->value = 0; 246 //t->value = 0;
247 } 247 }
248 break; 248 break;
249 } 249 }
250 case UI_VAR_STRING: { 250 case UI_VAR_STRING: {
251 // TODO
252 break;
253 }
254 case UI_VAR_TEXT: {
255 UiText *f = from->value;
256 UiText *t = to->value;
257 char *tvalue = t->value;
258 memcpy(t, f, sizeof(UiText));
259 if(set) {
260 t->set(t, tvalue);
261 } else {
262 f->value = f->get(f);
263 }
264 break;
265 }
266 case UI_VAR_LIST: {
267 UiListVar *f = from->value;
268 UiListVar *t = to->value;
269 UiList *list = t->listptr->list;
270 UiObserver *observers = f->listptr->list->observers;
271 t->listptr = f->listptr;
272 if(set) {
273 t->listptr->list = list;
274 list->observers = observers;
275 ui_notify(observers, list);
276 }
251 break; 277 break;
252 } 278 }
253 } 279 }
254 } 280 }
255 281
259 285
260 void ui_document_regint(void *doc, char *name, UiInteger *i) { 286 void ui_document_regint(void *doc, char *name, UiInteger *i) {
261 uic_document_regvar(doc, name, UI_VAR_INTEGER, sizeof(UiInteger), i); 287 uic_document_regvar(doc, name, UI_VAR_INTEGER, sizeof(UiInteger), i);
262 } 288 }
263 289
290 void ui_document_regtext(void *doc, char *name, UiText *text) {
291 uic_document_regvar(doc, name, UI_VAR_TEXT, sizeof(UiText), text);
292 }
293
294 void ui_document_reglist(void *doc, char *name, UiList *list) {
295 UiListVar *lv = ui_document_malloc(doc, sizeof(UiListVar));
296 UiListPtr *lp = ui_document_malloc(doc, sizeof(UiListPtr));
297 lv->listptr = lp;
298 lp->list = list;
299 uic_document_regvar(doc, name, UI_VAR_LIST, sizeof(UiListPtr), lv);
300 }

mercurial