+#ifdef LWLIB_WIDGETS_ATHENA
+/* glyph widgets */
+static Widget
+xaw_create_button (widget_instance *instance)
+{
+ Arg al[20];
+ int ac = 0;
+ Widget button = 0;
+ widget_value* val = instance->info->val;
+
+ XtSetArg (al [ac], XtNsensitive, val->enabled); ac++;
+ XtSetArg (al [ac], XtNmappedWhenManaged, FALSE); ac++;
+ XtSetArg (al [ac], XtNjustify, XtJustifyCenter); 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], XtNhighlightThickness, (Dimension)0);ac++;
+
+ /* add any args the user supplied for creation time */
+ lw_add_value_args_to_args (val, al, &ac);
+
+ if (!val->call_data)
+ button = XtCreateManagedWidget (val->name, labelWidgetClass,
+ instance->parent, al, ac);
+
+ else
+ {
+ if (val->type == TOGGLE_TYPE || val->type == RADIO_TYPE)
+ {
+ XtSetArg (al [ac], XtNstate, val->selected); ac++;
+ button = XtCreateManagedWidget
+ (val->name,
+ val->type == TOGGLE_TYPE ? checkboxWidgetClass : radioWidgetClass,
+ instance->parent, al, ac);
+ }
+ else
+ {
+ button = XtCreateManagedWidget (val->name, commandWidgetClass,
+ instance->parent, al, ac);
+ }
+ XtRemoveAllCallbacks (button, XtNcallback);
+ XtAddCallback (button, XtNcallback, xaw_generic_callback, (XtPointer)instance);
+ }
+
+ XtManageChild (button);
+
+ return button;
+}
+
+static Widget
+xaw_create_label_field (widget_instance *instance)
+{
+ return xaw_create_label (instance->parent, instance->info->val);
+}
+
+Widget
+xaw_create_label (Widget parent, widget_value* val)
+{
+ Arg al[20];
+ int ac = 0;
+ Widget label = 0;
+
+ XtSetArg (al [ac], XtNsensitive, val->enabled); ac++;
+ XtSetArg (al [ac], XtNmappedWhenManaged, FALSE); ac++;
+ XtSetArg (al [ac], XtNjustify, XtJustifyCenter); ac++;
+
+ /* add any args the user supplied for creation time */
+ lw_add_value_args_to_args (val, al, &ac);
+
+ label = XtCreateManagedWidget (val->name, labelWidgetClass,
+ parent, al, ac);
+
+ /* 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);
+ if (ac > 20)
+ abort (); /* #### need assert macro in lwlib */
+ XtSetValues (label, al, ac);
+
+ return label;
+}
+
+static Widget
+xaw_create_progress (widget_instance *instance)
+{
+ Arg al[20];
+ int ac = 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], XtNsensitive, False); ac++;
+ }
+ else
+ {
+ XtSetArg (al [ac], XtNsensitive, val->enabled); ac++;
+ }
+#else
+ XtSetArg (al [ac], XtNsensitive, True); ac++;
+#endif
+
+ XtSetArg (al [ac], XtNmappedWhenManaged, FALSE); ac++;
+ XtSetArg (al [ac], XtNorientation, XtorientHorizontal); ac++;
+ XtSetArg (al [ac], XtNhighlightThickness, (Dimension)0);ac++;
+ XtSetArg (al [ac], XtNntics, (Cardinal)10);ac++;
+
+ /* add any args the user supplied for creation time */
+ lw_add_value_args_to_args (val, al, &ac);
+
+ scale = XtCreateManagedWidget (val->name, gaugeWidgetClass,
+ instance->parent, al, ac);
+ /* add the callback */
+ if (val->call_data)
+ XtAddCallback (scale, XtNgetValue, xaw_generic_callback, (XtPointer)instance);
+
+ XtManageChild (scale);
+
+ return scale;
+}
+
+#if defined(LWLIB_WIDGETS_ATHENA)
+#define TEXT_BUFFER_SIZE 128
+static Widget
+xaw_create_text_field (widget_instance *instance)
+{
+ Arg al[20];
+ int ac = 0;
+ Widget text = 0;
+ widget_value* val = instance->info->val;
+
+ XtSetArg (al [ac], XtNsensitive, val->enabled); ac++;
+ XtSetArg (al [ac], XtNmappedWhenManaged, FALSE); ac++;
+ XtSetArg (al [ac], XtNhighlightThickness, (Dimension)0); ac++;
+ XtSetArg (al [ac], XtNtype, XawAsciiString); ac++;
+ XtSetArg (al [ac], XtNeditType, XawtextEdit); ac++;
+ XtSetArg (al [ac], XtNuseStringInPlace, False); ac++;
+#if 0
+ XtSetArg (al [ac], XtNlength, TEXT_BUFFER_SIZE); ac++;
+#endif
+ if (val->value)
+ {
+ XtSetArg (al [ac], XtNstring, val->value); ac++;
+ }
+
+ /* add any args the user supplied for creation time */
+ lw_add_value_args_to_args (val, al, &ac);
+
+ text = XtCreateManagedWidget (val->name, asciiTextWidgetClass,
+ instance->parent, al, ac);
+
+ /* add the callback */
+ if (val->call_data)
+ XtAddCallback (text, XtNgetValue, xaw_generic_callback, (XtPointer)instance);
+
+ XtManageChild (text);
+
+ return text;
+}
+#endif
+
+#endif /* LWLIB_WIDGETS_ATHENA */
+
+const widget_creation_entry