| 106 if(!ctx) { |
106 if(!ctx) { |
| 107 return; |
107 return; |
| 108 } |
108 } |
| 109 |
109 |
| 110 UiEvent ev; |
110 UiEvent ev; |
| 111 ev.window = NULL; |
111 ev.obj = ctx->obj; |
| |
112 ev.window = ev.obj ? ev.obj->window : NULL; |
| 112 ev.document = document; |
113 ev.document = document; |
| 113 ev.obj = NULL; |
|
| 114 ev.eventdata = NULL; |
114 ev.eventdata = NULL; |
| 115 ev.eventdatatype = 0; |
115 ev.eventdatatype = 0; |
| 116 ev.intval = 0; |
116 ev.intval = 0; |
| |
117 ev.set = 0; |
| 117 |
118 |
| 118 if(ctx->close_callback) { |
119 if(ctx->close_callback) { |
| 119 ctx->close_callback(&ev, ctx->close_data); |
120 ctx->close_callback(&ev, ctx->close_data); |
| 120 } |
121 } |
| |
122 |
| |
123 CxIterator i = cxListIterator(ctx->destroy_handler); |
| |
124 cx_foreach(UiDestroyHandler *, h, i) { |
| |
125 h->destructor(h->data); |
| |
126 } |
| |
127 |
| 121 cxMempoolFree(ctx->mp); |
128 cxMempoolFree(ctx->mp); |
| 122 } |
129 } |
| 123 |
130 |
| 124 void uic_context_attach_document(UiContext *ctx, void *document) { |
131 void uic_context_attach_document(UiContext *ctx, void *document) { |
| 125 if(ctx->single_document_mode) { |
132 if(ctx->single_document_mode) { |
| 550 void ui_context_closefunc(UiContext *ctx, ui_callback fnc, void *udata) { |
557 void ui_context_closefunc(UiContext *ctx, ui_callback fnc, void *udata) { |
| 551 ctx->close_callback = fnc; |
558 ctx->close_callback = fnc; |
| 552 ctx->close_data = udata; |
559 ctx->close_data = udata; |
| 553 } |
560 } |
| 554 |
561 |
| 555 void ui_context_destroy(UiContext *ctx) { |
|
| 556 CxIterator i = cxListIterator(ctx->destroy_handler); |
|
| 557 cx_foreach(UiDestroyHandler *, h, i) { |
|
| 558 h->destructor(h->data); |
|
| 559 } |
|
| 560 cxMempoolFree(ctx->mp); |
|
| 561 } |
|
| 562 |
|
| 563 UiContext* ui_context_parent(UiContext *ctx) { |
562 UiContext* ui_context_parent(UiContext *ctx) { |
| 564 return ctx->parent; |
563 return ctx->parent; |
| 565 } |
564 } |
| 566 |
565 |
| 567 |
566 |
| 728 cxmutstr d = cx_strdup_a(ctx->allocator, s); |
727 cxmutstr d = cx_strdup_a(ctx->allocator, s); |
| 729 return d.ptr; |
728 return d.ptr; |
| 730 } |
729 } |
| 731 |
730 |
| 732 void ui_reg_destructor(UiContext *ctx, void *data, ui_destructor_func destr) { |
731 void ui_reg_destructor(UiContext *ctx, void *data, ui_destructor_func destr) { |
| 733 cxMempoolRegister(ctx->mp, data, (cx_destructor_func)destr); |
732 //cxMempoolRegister(ctx->mp, data, (cx_destructor_func)destr); |
| |
733 uic_context_add_destructor(ctx, destr, data); |
| 734 } |
734 } |
| 735 |
735 |
| 736 void ui_set_destructor(void *mem, ui_destructor_func destr) { |
736 void ui_set_destructor(void *mem, ui_destructor_func destr) { |
| 737 cxMempoolSetDestructor(mem, (cx_destructor_func)destr); |
737 cxMempoolSetDestructor(mem, (cx_destructor_func)destr); |
| 738 } |
738 } |