add function for getting the UiContext parent context

Sun, 15 Jun 2025 12:09:28 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 15 Jun 2025 12:09:28 +0200
changeset 624
8086681cabfb
parent 623
1ebc781c7d17
child 625
1726c5109ccd

add function for getting the UiContext parent context

ui/common/context.c file | annotate | diff | comparison | revisions
ui/ui/toolkit.h file | annotate | diff | comparison | revisions
--- a/ui/common/context.c	Sun Jun 15 11:21:48 2025 +0200
+++ b/ui/common/context.c	Sun Jun 15 12:09:28 2025 +0200
@@ -476,7 +476,7 @@
     ctx->close_data = udata;
 }
 
-UIEXPORT void ui_context_destroy(UiContext *ctx) {
+void ui_context_destroy(UiContext *ctx) {
     CxIterator i = cxListIterator(ctx->destroy_handler);
     cx_foreach(UiDestroyHandler *, h, i) {
         h->destructor(h->data);
@@ -484,6 +484,10 @@
     cxMempoolFree(ctx->mp);
 }
 
+UiContext* ui_context_parent(UiContext *ctx) {
+    return ctx->parent;
+}
+
 
 void ui_set_group(UiContext *ctx, int group) {
     if(!cxListIndexValid(ctx->groups, cxListFind(ctx->groups, &group))) {
--- a/ui/ui/toolkit.h	Sun Jun 15 11:21:48 2025 +0200
+++ b/ui/ui/toolkit.h	Sun Jun 15 12:09:28 2025 +0200
@@ -482,6 +482,8 @@
 
 UIEXPORT void ui_context_destroy(UiContext *ctx);
 
+UIEXPORT UiContext* ui_context_parent(UiContext *ctx);
+
 UIEXPORT void ui_object_ref(UiObject *obj);
 UIEXPORT int ui_object_unref(UiObject *obj);
 

mercurial