ui/motif/menu.c

branch
newapi
changeset 419
7d15cad351fc
parent 418
a57268d20ed9
child 420
28a5920bebe0
equal deleted inserted replaced
418:a57268d20ed9 419:7d15cad351fc
145 mitem, 145 mitem,
146 XmNdestroyCallback, 146 XmNdestroyCallback,
147 (XtCallbackProc)ui_destroy_eventdata, 147 (XtCallbackProc)ui_destroy_eventdata,
148 eventdata); 148 eventdata);
149 } 149 }
150
151 ui_set_widget_groups(obj->ctx, mitem, it->groups);
150 } 152 }
151 153
152 void add_menuseparator_widget(Widget p, int i, UiMenuItemI *item, UiObject *obj) { 154 void add_menuseparator_widget(Widget p, int i, UiMenuItemI *item, UiObject *obj) {
153 Widget s = XmCreateSeparatorGadget (p, "menuseparator", NULL, 0); 155 Widget s = XmCreateSeparatorGadget (p, "menuseparator", NULL, 0);
154 XtManageChild(s); 156 XtManageChild(s);
155 } 157 }
156 158
157 void add_checkitem_widget(Widget p, int i, UiMenuItemI *item, UiObject *obj) { 159 void add_checkitem_widget(Widget p, int i, UiMenuItemI *item, UiObject *obj) {
158 160 UiMenuCheckItem *it = (UiMenuCheckItem*)item;
161
162 Arg args[4];
163 int n = 0;
164 XmString s = NULL;
165 if(it->label) {
166 s = XmStringCreateLocalized(it->label);
167 XtSetArg(args[n], XmNlabelString, s); n++;
168 }
169
170 //XtSetArg(args[n], XmNvisibleWhenOff, 0); n++;
171 Widget checkbox = XtCreateManagedWidget(
172 "menutogglebutton",
173 xmToggleButtonWidgetClass,
174 p,
175 args,
176 n);
177 if(s) {
178 XmStringFree(s);
179 }
180
181 ui_bind_togglebutton(obj, checkbox, it->varname, NULL, it->callback, it->userdata, 0);
182
183 ui_set_widget_groups(obj->ctx, checkbox, it->groups);
159 } 184 }
160 185
161 void add_radioitem_widget(Widget p, int index, UiMenuItemI *item, UiObject *obj) { 186 void add_radioitem_widget(Widget p, int index, UiMenuItemI *item, UiObject *obj) {
162 187 UiMenuRadioItem *it = (UiMenuRadioItem*)item;
188
189 Arg args[4];
190 int n = 0;
191 XmString s = NULL;
192 if(it->label) {
193 s = XmStringCreateLocalized(it->label);
194 XtSetArg(args[n], XmNlabelString, s); n++;
195 }
196 XtSetArg(args[n], XmNindicatorType, XmONE_OF_MANY_ROUND); n++;
197
198 Widget button = XmCreateToggleButton(p, "menuradiobutton", args, n);
199 XtManageChild(button);
200
201 ui_bind_radiobutton(obj, button, NULL, it->varname, it->callback, it->userdata, 0);
163 } 202 }
164 203
165 void add_checkitemnv_widget(Widget p, int i, UiMenuItemI *item, UiObject *obj) { 204 void add_checkitemnv_widget(Widget p, int i, UiMenuItemI *item, UiObject *obj) {
166 205
167 } 206 }

mercurial