ui/motif/menu.c

branch
newapi
changeset 421
3b969399f962
parent 420
28a5920bebe0
--- a/ui/motif/menu.c	Sun Dec 22 11:49:59 2024 +0100
+++ b/ui/motif/menu.c	Mon Dec 30 12:50:52 2024 +0100
@@ -216,7 +216,7 @@
     ls->getvalue = il->getvalue;
     ls->callback = il->callback;
     ls->userdata = il->userdata;
-    ls->addseparator = TRUE;
+    ls->addseparator = il->addseparator;
     
     ls->var = uic_create_var(ui_global_context(), il->varname, UI_VAR_LIST); //uic_widget_var(obj->ctx, obj->ctx, NULL, il->varname, UI_VAR_LIST);
     UiList *list = ls->var->value;
@@ -260,12 +260,14 @@
     void* elm = ui_list_first(ls);
     int i = 0;
     if(elm && list->addseparator) {
-        Widget s = XmCreateSeparatorGadget(list->menu, "menuseparator", NULL, 0);
+        XtSetArg(args[0], XmNpositionIndex, list->index);
+        Widget s = XmCreateSeparatorGadget(list->menu, "menuseparator", args, 1);
         XtManageChild(s);
         i++;
     }
     
     ui_getvaluefunc getvalue = list->getvalue;
+    int pos = list->index;
     while(elm) {
         n = 0;
         char *label = (char*) (getvalue ? getvalue(elm, 0) : elm);
@@ -273,7 +275,8 @@
             s = XmStringCreateLocalized(label);
             XtSetArg(args[n], XmNlabelString, s); n++;
         }
-
+        XtSetArg(args[n], XmNpositionIndex, pos+i); n++;
+        
         Widget mitem = XtCreateManagedWidget(
                 "menubutton",
                 xmPushButtonWidgetClass,

mercurial