ui/common/context.c

changeset 1197
4bbf0487509f
parent 1195
6ec3c71ba298
child 1198
5bb4366b0c32
equal deleted inserted replaced
1196:296b8b6eaae6 1197:4bbf0487509f
941 941
942 UiGeneric* ui_get_generic_var(UiContext *ctx, const char *name) { 942 UiGeneric* ui_get_generic_var(UiContext *ctx, const char *name) {
943 UiVar *var = uic_get_var_t(ctx, name, UI_VAR_GENERIC); 943 UiVar *var = uic_get_var_t(ctx, name, UI_VAR_GENERIC);
944 return var ? var->value : NULL; 944 return var ? var->value : NULL;
945 } 945 }
946
947
948 static void attachment_action_callback(UiEvent *event, void *action) {
949 if(event->document) {
950 UiContext *ctx = ui_document_context(event->document);
951 ui_call_action_on(ctx, action);
952 }
953 }
954
955 void ui_context_onattach_action(UiContext *ctx, const char *action) {
956 ctx->onattach = attachment_action_callback;
957 ctx->onattachdata = ui_strdup(ctx, action);
958 }
959
960 void ui_context_ondetach_action(UiContext *ctx, const char *action) {
961 ctx->ondetach = attachment_action_callback;
962 ctx->ondetachdata = ui_strdup(ctx, action);
963 }

mercurial