ui/common/context.c

changeset 131
774b741984a2
parent 128
c284c15509a8
child 140
c03c338a7dcf
equal deleted inserted replaced
130:212b63dd61be 131:774b741984a2
59 UiContext* uic_root_context(UiContext *ctx) { 59 UiContext* uic_root_context(UiContext *ctx) {
60 return ctx->parent ? uic_root_context(ctx->parent) : ctx; 60 return ctx->parent ? uic_root_context(ctx->parent) : ctx;
61 } 61 }
62 62
63 void uic_context_set_document(UiContext *ctx, void *document) { 63 void uic_context_set_document(UiContext *ctx, void *document) {
64 if(ctx->document == document) {
65 return;
66 }
67
64 UiContext *docctx = ui_document_context(document); 68 UiContext *docctx = ui_document_context(document);
65 if(!docctx) { 69 if(!docctx) {
66 return; 70 return;
67 } 71 }
68 docctx->obj = ctx->obj; 72 docctx->obj = ctx->obj;
226 t->set(t, tvalue); 230 t->set(t, tvalue);
227 t->setposition(t, tpos); 231 t->setposition(t, tpos);
228 } else { 232 } else {
229 f->value = f->get(f); 233 f->value = f->get(f);
230 f->pos = f->position(f); 234 f->pos = f->position(f);
235 f->set = NULL;
236 f->get = NULL;
237 f->setposition = NULL;
238 f->position = NULL;
231 } 239 }
232 break; 240 break;
233 } 241 }
234 case UI_VAR_LIST: { 242 case UI_VAR_LIST: {
235 UiListVar *f = from->value; 243 UiListVar *f = from->value;

mercurial