# HG changeset patch # User Olaf Wintermann # Date 1736804641 -3600 # Node ID 3379c8a5b6bb4d4885abb81960f7275f351aafb3 # Parent dc762a79e72dd4a3dabbfc9e0c46c019550050ba implement ui_customwidget_create for Motif diff -r dc762a79e72d -r 3379c8a5b6bb ui/motif/container.c --- 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) { diff -r dc762a79e72d -r 3379c8a5b6bb ui/ui/container.h --- 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__ }) diff -r dc762a79e72d -r 3379c8a5b6bb ui/ui/toolkit.h --- 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 #define UIWIDGET GtkWidget*