Mon, 13 Jan 2025 22:44:01 +0100
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__ })