implement ui_customwidget_create for Motif

Mon, 13 Jan 2025 22:44:01 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Mon, 13 Jan 2025 22:44:01 +0100
changeset 443
3379c8a5b6bb
parent 442
dc762a79e72d
child 444
0a52c26bba1a

implement ui_customwidget_create for Motif

ui/motif/container.c file | annotate | diff | comparison | revisions
ui/ui/container.h file | annotate | diff | comparison | revisions
ui/ui/toolkit.h file | annotate | diff | comparison | revisions
--- a/ui/motif/container.c	Mon Jan 13 22:36:57 2025 +0100
+++ b/ui/motif/container.c	Mon Jan 13 22:44:01 2025 +0100
@@ -36,6 +36,22 @@
 
 #include "Grid.h"
 
+
+UIWIDGET ui_customwidget_create(UiObject *obj, ui_createwidget_func create_widget, void *userdata, UiWidgetArgs args) {
+    Arg xargs[64];
+    int n = 0;
+    
+    UiContainerPrivate *ctn = ui_obj_container(obj);
+    UI_APPLY_LAYOUT(ctn->layout, args);
+    
+    Widget parent = ctn->prepare(ctn, xargs, &n);
+    Widget widget = create_widget(obj, args, userdata, parent, xargs, n);
+    XtManageChild(widget);
+    ctn->add(ctn, widget);
+    
+    return widget;
+}
+
 /* ---------------------------- Box Container ---------------------------- */
 
 static UIWIDGET box_create(UiObject *obj, UiContainerArgs args, UiBoxOrientation orientation) { 
--- a/ui/ui/container.h	Mon Jan 13 22:36:57 2025 +0100
+++ b/ui/ui/container.h	Mon Jan 13 22:44:01 2025 +0100
@@ -289,7 +289,11 @@
 UIEXPORT UiObject* ui_document_tab(UiTabbedPane *view);
 
 
+#ifdef UI_GTK
 typedef UIWIDGET (*ui_createwidget_func)(UiObject *obj, UiWidgetArgs args, void *userdata);
+#elif defined(UI_MOTIF)
+typedef UIWIDGET (*ui_createwidget_func)(UiObject *obj, UiWidgetArgs args, void *userdata, Widget parent, Arg *a, int n);
+#endif
 UIEXPORT UIWIDGET ui_customwidget_create(UiObject *obj, ui_createwidget_func create_widget, void *userdata, UiWidgetArgs args);
 
 #define ui_customwidget(obj, create_widget, userdata, ...) ui_customwidget_create(obj, create_widget, userdata, (UiWidgetArgs) { __VA_ARGS__ })
--- a/ui/ui/toolkit.h	Mon Jan 13 22:36:57 2025 +0100
+++ b/ui/ui/toolkit.h	Mon Jan 13 22:44:01 2025 +0100
@@ -42,6 +42,7 @@
 typedef void* UIMENU;   // NSMenu*
 
 #elif UI_GTK2 || UI_GTK3 || UI_GTK4
+#define UI_GTK
 
 #include <gtk/gtk.h>
 #define UIWIDGET GtkWidget*

mercurial