3 weeks ago
add separator (Motif)
application/main.c | file | annotate | diff | comparison | revisions | |
ui/motif/widget.c | file | annotate | diff | comparison | revisions | |
ui/ui/ui.h | file | annotate | diff | comparison | revisions | |
ui/ui/widget.h | file | annotate | diff | comparison | revisions |
--- a/application/main.c Wed Feb 26 21:14:24 2025 +0100 +++ b/application/main.c Wed Feb 26 21:19:54 2025 +0100 @@ -691,6 +691,8 @@ ui_tab(obj, "Tab 2") { ui_combobox(obj, .list = wdata->list); + ui_label(obj, .label = "Test"); + ui_separator(obj, .name = "s1"); } ui_tab(obj, "Tab 3") {
--- a/ui/motif/widget.c Wed Feb 26 21:14:24 2025 +0100 +++ b/ui/motif/widget.c Wed Feb 26 21:19:54 2025 +0100 @@ -52,3 +52,20 @@ return widget; } + +UIEXPORT UIWIDGET ui_separator_create(UiObject *obj, UiWidgetArgs *args) { + Arg xargs[64]; + int n = 0; + UiWidgetArgs a = *args; + + UiContainerPrivate *ctn = ui_obj_container(obj); + UI_APPLY_LAYOUT(ctn->layout, a); + + char *name = a.name ? (char*)a.name : "separator"; + Widget parent = ctn->prepare(ctn, xargs, &n); + Widget widget = XmCreateSeparator(parent, name, xargs, n); + XtManageChild(widget); + ctn->add(ctn, widget); + + return widget; +}
--- a/ui/ui/ui.h Wed Feb 26 21:14:24 2025 +0100 +++ b/ui/ui/ui.h Wed Feb 26 21:19:54 2025 +0100 @@ -30,6 +30,7 @@ #define UI_H #include "toolkit.h" +#include "widget.h" #include "container.h" #include "menu.h" #include "toolbar.h"
--- a/ui/ui/widget.h Wed Feb 26 21:14:24 2025 +0100 +++ b/ui/ui/widget.h Wed Feb 26 21:19:54 2025 +0100 @@ -61,7 +61,9 @@ #define ui_customwidget(obj, create_widget, userdata, ...) ui_customwidget_create(obj, create_widget, userdata, (UiWidgetArgs) { __VA_ARGS__ }) +UIEXPORT UIWIDGET ui_separator_create(UiObject *obj, UiWidgetArgs *args); +#define ui_separator(obj, ...) ui_separator_create(obj, &(UiWidgetArgs){ __VA_ARGS__ } ) #ifdef __cplusplus