comparison lwlib/lwlib-Xm.c @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 84b14dcb0985
children 1ccc32a20af4
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
253 } 253 }
254 else 254 else
255 { 255 {
256 name_string = 256 name_string =
257 XmStringCreateLtoR (res_name, XmSTRING_DEFAULT_CHARSET); 257 XmStringCreateLtoR (res_name, XmSTRING_DEFAULT_CHARSET);
258 258
259 value_name = XtMalloc (strlen (val->value) + 2); 259 value_name = XtMalloc (strlen (val->value) + 2);
260 *value_name = 0; 260 *value_name = 0;
261 strcat (value_name, " "); 261 strcat (value_name, " ");
262 strcat (value_name, val->value); 262 strcat (value_name, val->value);
263 263
264 val_string = 264 val_string =
265 XmStringCreateLtoR (value_name, XmSTRING_DEFAULT_CHARSET); 265 XmStringCreateLtoR (value_name, XmSTRING_DEFAULT_CHARSET);
266 266
267 built_string = 267 built_string =
268 XmStringConcat (name_string, val_string); 268 XmStringConcat (name_string, val_string);
269 269
270 XtFree (value_name); 270 XtFree (value_name);
271 } 271 }
272 } 272 }
273 273
274 XtSetArg (al [ac], XmNlabelString, built_string); ac++; 274 XtSetArg (al [ac], XmNlabelString, built_string); ac++;
789 val->edited = False; 789 val->edited = False;
790 790
791 /* Common to all widget types */ 791 /* Common to all widget types */
792 XtSetArg (al [ac], XmNsensitive, val->enabled); ac++; 792 XtSetArg (al [ac], XmNsensitive, val->enabled); ac++;
793 XtSetArg (al [ac], XmNuserData, val->call_data); ac++; 793 XtSetArg (al [ac], XmNuserData, val->call_data); ac++;
794 lw_add_value_args_to_args (val, al, &ac);
795
796 XtSetValues (widget, al, ac); 794 XtSetValues (widget, al, ac);
797 795
798 #if defined (LWLIB_DIALOGS_MOTIF) || defined (LWLIB_MENUBARS_MOTIF) || defined (LWLIB_WIDGETS_MOTIF) 796 #if defined (LWLIB_DIALOGS_MOTIF) || defined (LWLIB_MENUBARS_MOTIF) || defined (LWLIB_WIDGETS_MOTIF)
799 /* Common to all label like widgets */ 797 /* Common to all label like widgets */
800 if (XtIsSubclass (widget, xmLabelWidgetClass)) 798 if (XtIsSubclass (widget, xmLabelWidgetClass))
854 else if (class == xmScrollBarWidgetClass) 852 else if (class == xmScrollBarWidgetClass)
855 { 853 {
856 xm_update_scrollbar (instance, widget, val); 854 xm_update_scrollbar (instance, widget, val);
857 } 855 }
858 #endif 856 #endif
857 /* Lastly update our global arg values. */
858 if (val->args && val->args->nargs)
859 XtSetValues (widget, val->args->args, val->args->nargs);
859 } 860 }
860 861
861 /* getting the value back */ 862 /* getting the value back */
862 void 863 void
863 xm_update_one_value (widget_instance* instance, Widget widget, 864 xm_update_one_value (widget_instance* instance, Widget widget,
924 } 925 }
925 } 926 }
926 val->edited = True; 927 val->edited = True;
927 } 928 }
928 } 929 }
929 else if (class == xmListWidgetClass 930 else if (class == xmListWidgetClass
930 #if defined (LWLIB_WIDGETS_MOTIF) && XmVERSION > 1 931 #if defined (LWLIB_WIDGETS_MOTIF) && XmVERSION > 1
931 || class == xmComboBoxWidgetClass 932 || class == xmComboBoxWidgetClass
932 #endif 933 #endif
933 ) 934 )
934 { 935 {
1036 #endif /* DND_KLUDGE */ 1037 #endif /* DND_KLUDGE */
1037 1038
1038 1039
1039 static Widget 1040 static Widget
1040 make_dialog (char* name, Widget parent, Boolean pop_up_p, 1041 make_dialog (char* name, Widget parent, Boolean pop_up_p,
1041 CONST char* shell_title, CONST char* icon_name, 1042 const char* shell_title, const char* icon_name,
1042 Boolean text_input_slot, Boolean radio_box, Boolean list, 1043 Boolean text_input_slot, Boolean radio_box, Boolean list,
1043 int left_buttons, int right_buttons) 1044 int left_buttons, int right_buttons)
1044 { 1045 {
1045 Widget result; 1046 Widget result;
1046 Widget form; 1047 Widget form;
1137 } 1138 }
1138 1139
1139 n_children++; 1140 n_children++;
1140 } 1141 }
1141 1142
1142 /* invisible seperator button */ 1143 /* invisible separator button */
1143 ac = 0; 1144 ac = 0;
1144 XtSetArg (al[ac], XmNmappedWhenManaged, FALSE); ac++; 1145 XtSetArg (al[ac], XmNmappedWhenManaged, FALSE); ac++;
1145 children [n_children] = XmCreateLabel (row, "separator_button", 1146 children [n_children] = XmCreateLabel (row, "separator_button",
1146 al, ac); 1147 al, ac);
1147 DO_DND_KLUDGE (children [n_children]); 1148 DO_DND_KLUDGE (children [n_children]);
1253 XtSetArg(al[ac], XmNleftWidget, icon); ac++; 1254 XtSetArg(al[ac], XmNleftWidget, icon); ac++;
1254 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; 1255 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
1255 XtSetArg(al[ac], XmNrightOffset, 13); ac++; 1256 XtSetArg(al[ac], XmNrightOffset, 13); ac++;
1256 value = XmCreateScrolledList (form, "list", al, ac); 1257 value = XmCreateScrolledList (form, "list", al, ac);
1257 1258
1258 /* this is the easiest way I found to have the dble click in the 1259 /* this is the easiest way I found to have the double click in the
1259 list activate the default button */ 1260 list activate the default button */
1260 XtAddCallback (value, XmNdefaultActionCallback, activate_button, button); 1261 XtAddCallback (value, XmNdefaultActionCallback, activate_button, button);
1261 } 1262 }
1262 1263
1263 ac = 0; 1264 ac = 0;
1436 { 1437 {
1437 char* name = instance->info->type; 1438 char* name = instance->info->type;
1438 Widget parent = instance->parent; 1439 Widget parent = instance->parent;
1439 Widget widget; 1440 Widget widget;
1440 Boolean pop_up_p = instance->pop_up_p; 1441 Boolean pop_up_p = instance->pop_up_p;
1441 CONST char* shell_name = 0; 1442 const char* shell_name = 0;
1442 CONST char* icon_name = 0; 1443 const char* icon_name = 0;
1443 Boolean text_input_slot = False; 1444 Boolean text_input_slot = False;
1444 Boolean radio_box = False; 1445 Boolean radio_box = False;
1445 Boolean list = False; 1446 Boolean list = False;
1446 int total_buttons; 1447 int total_buttons;
1447 int left_buttons = 0; 1448 int left_buttons = 0;
1644 { 1645 {
1645 Arg al[20]; 1646 Arg al[20];
1646 int ac = 0; 1647 int ac = 0;
1647 Widget scale = 0; 1648 Widget scale = 0;
1648 widget_value* val = instance->info->val; 1649 widget_value* val = instance->info->val;
1649 1650 #if 0 /* This looks too awful, although more correct. */
1650 if (!val->call_data) 1651 if (!val->call_data)
1651 { 1652 {
1652 XtSetArg (al [ac], XmNsensitive, False); ac++; 1653 XtSetArg (al [ac], XmNsensitive, False); ac++;
1653 } 1654 }
1654 else 1655 else
1655 { 1656 {
1656 XtSetArg (al [ac], XmNsensitive, val->enabled); ac++; 1657 XtSetArg (al [ac], XmNsensitive, val->enabled); ac++;
1657 } 1658 }
1659 #else
1660 XtSetArg (al [ac], XmNsensitive, True); ac++;
1661 #endif
1658 XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; 1662 XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
1659 XtSetArg (al [ac], XmNuserData, val->call_data); ac++; 1663 XtSetArg (al [ac], XmNuserData, val->call_data); ac++;
1660 XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++; 1664 XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++;
1661 XtSetArg (al [ac], XmNorientation, XmHORIZONTAL); ac++; 1665 XtSetArg (al [ac], XmNorientation, XmHORIZONTAL); ac++;
1662 /* The highlight doesn't appear to be dynamically set which makes it 1666 /* The highlight doesn't appear to be dynamically set which makes it
1682 Arg al[20]; 1686 Arg al[20];
1683 int ac = 0; 1687 int ac = 0;
1684 Widget text = 0; 1688 Widget text = 0;
1685 widget_value* val = instance->info->val; 1689 widget_value* val = instance->info->val;
1686 1690
1687 XtSetArg (al [ac], XmNsensitive, val->enabled && val->call_data); ac++; 1691 XtSetArg (al [ac], XmNsensitive, val->enabled); ac++;
1688 XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; 1692 XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
1689 XtSetArg (al [ac], XmNuserData, val->call_data); ac++; 1693 XtSetArg (al [ac], XmNuserData, val->call_data); ac++;
1690 XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++; 1694 XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++;
1691 /* The highlight doesn't appear to be dynamically set which makes it 1695 /* The highlight doesn't appear to be dynamically set which makes it
1692 look ugly. I think this may be a LessTif bug but for now we just 1696 look ugly. I think this may be a LessTif bug but for now we just