XmStringFree (val_string);
}
+static void
+xm_safe_update_label (widget_instance* instance, Widget widget, widget_value* val)
+{
+ /* Don't clobber non-labels. */
+ if (XtIsSubclass (widget, xmLabelWidgetClass))
+ xm_update_label (instance, widget, val);
+}
+
#endif /* defined (LWLIB_DIALOGS_MOTIF) || defined (LWLIB_MENUBARS_MOTIF) */
\f/* update of list */
XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance);
}
+#ifdef LWLIB_WIDGETS_MOTIF
+static void
+xm_update_progress (widget_instance* instance, Widget scale,
+ widget_value* val)
+{
+ Arg al[20];
+ int ac = 0;
+ Dimension height = 0;
+ Dimension width = 0;
+ if (!val->call_data)
+ {
+ XtSetArg (al [ac], XmNeditable, False); ac++;
+ }
+ else
+ {
+ XtSetArg (al [ac], XmNeditable, val->enabled); 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++;
+ }
+
+ XtSetValues (scale, al, 1);
+}
+#endif /* LWLIB_WIDGETS_MOTIF */
+
#ifdef LWLIB_MENUBARS_MOTIF
static void
XtSetArg (al [ac], XmNsubMenuId, menu); ac++;
button = XmCreateCascadeButton (widget, cur->name, al, ac);
- xm_update_label (instance, button, cur);
+ xm_safe_update_label (instance, button, cur);
XtAddCallback (button, XmNcascadingCallback, xm_pull_down_callback,
(XtPointer)instance);
else
button = XmCreatePushButtonGadget (widget, cur->name, al, ac);
- xm_update_label (instance, button, cur);
+ xm_safe_update_label (instance, button, cur);
/* don't add a callback to a simple label */
if (cur->type == TOGGLE_TYPE || cur->type == RADIO_TYPE)
/* update the menu button as a label. */
if (val->change >= VISIBLE_CHANGE)
{
- xm_update_label (instance, widget, val);
+ xm_safe_update_label (instance, widget, val);
+
if (XtClass (widget) == xmToggleButtonWidgetClass
|| XtClass (widget) == xmToggleButtonGadgetClass)
{
#if defined (LWLIB_DIALOGS_MOTIF) || defined (LWLIB_MENUBARS_MOTIF) || defined (LWLIB_WIDGETS_MOTIF)
/* Common to all label like widgets */
- if (XtIsSubclass (widget, xmLabelWidgetClass))
- xm_update_label (instance, widget, val);
+ xm_safe_update_label (instance, widget, val);
#endif
class = XtClass (widget);
/* Class specific things */
xm_update_scrollbar (instance, widget, val);
}
#endif
+#ifdef LWLIB_WIDGETS_MOTIF
+ else if (class == xmScaleWidgetClass)
+ {
+ xm_update_progress (instance, widget, val);
+ }
+#endif
/* Lastly update our global arg values. */
if (val->args && val->args->nargs)
XtSetValues (widget, val->args->args, val->args->nargs);
else if (class == xmTextWidgetClass)
{
if (val->value)
- free (val->value);
+ XtFree (val->value);
val->value = XmTextGetString (widget);
val->edited = True;
}
else if (class == xmTextFieldWidgetClass)
{
if (val->value)
- free (val->value);
+ XtFree (val->value);
val->value = XmTextFieldGetString (widget);
val->edited = True;
}
if (radiobox)
{
CompositeWidget radio = (CompositeWidget)widget;
- int i;
+ unsigned int i;
for (i = 0; i < radio->composite.num_children; i++)
{
int set = False;
list activate the default button */
XtAddCallback (value, XmNdefaultActionCallback, activate_button, button);
}
+ /* else add nothing; it's a separator */
ac = 0;
XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
XtInstallAccelerators (value, button);
XmProcessTraversal(value, XmTRAVERSE_CURRENT);
}
- else
+ else if (radio_box)
{
XtInstallAccelerators (form, button);
XmProcessTraversal(value, XmTRAVERSE_CURRENT);
}
+ /* else we don' need no STEENKIN' assellerators. */
#ifdef DND_KLUDGE
XtFree ((char *) dnd_override);
{
Arg al[20];
int ac = 0;
+ Dimension height = 0;
+ Dimension width = 0;
Widget scale = 0;
widget_value* val = instance->info->val;
-#if 0 /* This looks too awful, although more correct. */
if (!val->call_data)
{
- XtSetArg (al [ac], XmNsensitive, False); ac++;
+ XtSetArg (al [ac], XmNeditable, False); ac++;
}
else
{
- XtSetArg (al [ac], XmNsensitive, val->enabled); ac++;
+ XtSetArg (al [ac], XmNeditable, val->enabled); ac++;
}
-#else
- XtSetArg (al [ac], XmNsensitive, True); ac++;
-#endif
XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
XtSetArg (al [ac], XmNuserData, val->call_data); ac++;
XtSetArg (al [ac], XmNmappedWhenManaged, FALSE); ac++;
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);
\f
/* Table of functions to create widgets */
-widget_creation_entry
+const widget_creation_entry
xm_creation_table [] =
{
#ifdef LWLIB_MENUBARS_MOTIF