+ else if (val->type == TOGGLE_TYPE || val->type == RADIO_TYPE)
+ {
+ XtSetArg (al [ac], XmNset, val->selected); ac++;
+ XtSetArg (al [ac], XmNindicatorType,
+ (val->type == TOGGLE_TYPE ?
+ XmN_OF_MANY : XmONE_OF_MANY)); ac++;
+ XtSetArg (al [ac], XmNvisibleWhenOff, True); ac++;
+ button = XmCreateToggleButton (instance->parent, val->name, al, ac);
+ XtRemoveAllCallbacks (button, XmNvalueChangedCallback);
+ XtAddCallback (button, XmNvalueChangedCallback, xm_generic_callback,
+ (XtPointer)instance);
+ }
+ else
+ {
+ button = XmCreatePushButton (instance->parent, val->name, al, ac);
+ XtAddCallback (button, XmNactivateCallback, xm_generic_callback,
+ (XtPointer)instance);
+ }
+
+ XtManageChild (button);
+
+ return button;
+}
+
+static Widget
+xm_create_progress (widget_instance *instance)
+{
+ Arg al[20];
+ int ac = 0;
+ Dimension height = 0;
+ Dimension width = 0;
+ Widget scale = 0;
+ widget_value* val = instance->info->val;
+ if (!val->call_data)
+ {
+ XtSetArg (al [ac], XmNeditable, False); ac++;
+ }
+ else
+ {
+ XtSetArg (al [ac], XmNeditable, val->enabled); ac++;
+ }
+ XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
+ XtSetArg (al [ac], XmNuserData, val->call_data); ac++;
+ XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++;
+ XtSetArg (al [ac], XmNorientation, XmHORIZONTAL); ac++;
+ /* The highlight doesn't appear to be dynamically set which makes it
+ look ugly. I think this may be a LessTif bug but for now we just
+ get rid of it. */
+ XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
+
+ height = (Dimension)lw_get_value_arg (val, XtNheight);
+ width = (Dimension)lw_get_value_arg (val, XtNwidth);
+ if (height > 0)
+ {
+ XtSetArg (al [ac], XmNscaleHeight, height); ac++;
+ }
+ if (width > 0)
+ {
+ XtSetArg (al [ac], XmNscaleWidth, width); ac++;
+ }
+
+ /* add any args the user supplied for creation time */
+ lw_add_value_args_to_args (val, al, &ac);
+
+ scale = XmCreateScale (instance->parent, val->name, al, ac);
+ if (val->call_data)
+ XtAddCallback (scale, XmNvalueChangedCallback, xm_generic_callback,
+ (XtPointer)instance);
+
+ XtManageChild (scale);
+
+ return scale;
+}
+
+static Widget
+xm_create_text_field (widget_instance *instance)
+{
+ Arg al[20];
+ int ac = 0;
+ Widget text = 0;
+ widget_value* val = instance->info->val;
+
+ XtSetArg (al [ac], XmNsensitive, val->enabled); ac++;
+ XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
+ XtSetArg (al [ac], XmNuserData, val->call_data); ac++;
+ XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++;
+ /* The highlight doesn't appear to be dynamically set which makes it
+ look ugly. I think this may be a LessTif bug but for now we just
+ get rid of it. */
+ XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
+
+ /* add any args the user supplied for creation time */
+ lw_add_value_args_to_args (val, al, &ac);
+
+ text = XmCreateTextField (instance->parent, val->name, al, ac);
+ if (val->call_data)
+ XtAddCallback (text, XmNvalueChangedCallback, xm_generic_callback,
+ (XtPointer)instance);
+
+ XtManageChild (text);
+
+ return text;
+}
+
+static Widget
+xm_create_label_field (widget_instance *instance)
+{
+ return xm_create_label (instance->parent, instance->info->val);
+}
+
+Widget
+xm_create_label (Widget parent, widget_value* val)
+{
+ Arg al[20];
+ int ac = 0;
+ Widget label = 0;
+
+ XtSetArg (al [ac], XmNsensitive, val->enabled); ac++;
+ XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
+ XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++;
+ /* The highlight doesn't appear to be dynamically set which makes it
+ look ugly. I think this may be a LessTif bug but for now we just
+ get rid of it. */
+ XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
+
+ /* add any args the user supplied for creation time */
+ lw_add_value_args_to_args (val, al, &ac);
+
+ label = XmCreateLabel (parent, val->name, al, ac);
+
+ XtManageChild (label);
+
+ /* Do it again for arguments that have no effect until the widget is realized. */
+ ac = 0;
+ lw_add_value_args_to_args (val, al, &ac);
+ XtSetValues (label, al, ac);
+
+ return label;
+}
+
+#if XmVERSION > 1
+static Widget
+xm_create_combo_box (widget_instance *instance)
+{
+ Arg al[20];
+ int ac = 0;
+ Widget combo = 0;
+ widget_value* val = instance->info->val;
+
+ XtSetArg (al [ac], XmNsensitive, val->enabled); ac++;
+ XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
+ XtSetArg (al [ac], XmNuserData, val->call_data); ac++;
+ XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++;
+ /* The highlight doesn't appear to be dynamically set which makes it
+ look ugly. I think this may be a LessTif bug but for now we just
+ get rid of it. */
+ XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
+
+ /* add any args the user supplied for creation time */
+ lw_add_value_args_to_args (val, al, &ac);
+
+ combo = XmCreateDropDownComboBox (instance->parent, val->name, al, ac);
+ if (val->call_data)
+ XtAddCallback (combo, XmNselectionCallback, xm_generic_callback,
+ (XtPointer)instance);
+
+ XtManageChild (combo);
+
+ return combo;
+}
+#endif
+#endif /* LWLIB_WIDGETS_MOTIF */
+
+\f
+/* Table of functions to create widgets */
+
+const widget_creation_entry
+xm_creation_table [] =