(A-IWDSU+271C4): New abstract node.
[chise/xemacs-chise.git.1] / lwlib / lwlib-Xlw.c
index e4e91d6..712a62b 100644 (file)
@@ -49,9 +49,15 @@ Boston, MA 02111-1307, USA.  */
 #include "../src/xmu.h"
 #include "xlwtabs.h"
 #endif
-
 \f
 
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+#include <X11/Shell.h>
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/Command.h>
+
+
 #ifdef LWLIB_MENUBARS_LUCID
 
 /* Menu callbacks */
@@ -142,9 +148,8 @@ xlw_create_popup_menu (widget_instance* instance)
   XtSetArg (al [0], XtNmenu, instance->info->val);
   XtSetArg (al [1], XtNhorizontal, False);
   widget = XtCreateManagedWidget ("popup", xlwMenuWidgetClass,
-                                 popup_shell, al, 2);
-  XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);
-
+                        popup_shell, al, 2);
+  XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);  
   return popup_shell;
 }
 #endif /* LWLIB_MENUBARS_LUCID */
@@ -158,13 +163,13 @@ xlw_scrollbar_callback (Widget widget, XtPointer closure, XtPointer call_data)
   XlwScrollBarCallbackStruct *data =
     (XlwScrollBarCallbackStruct *) call_data;
   scroll_event event_data;
-  scrollbar_values *val =
-    (scrollbar_values *) instance->info->val->scrollbar_data;
+  scrollbar_values *val;
   double percent;
 
   if (!instance || widget->core.being_destroyed)
     return;
 
+  val = (scrollbar_values *) instance->info->val->scrollbar_data;
   id = instance->info->id;
 
   percent = (double) (data->value - 1) / (double) (INT_MAX - 1);
@@ -319,13 +324,21 @@ xlw_update_scrollbar (widget_instance *instance, Widget widget,
 #ifdef LWLIB_TABS_LUCID
 /* tab control
    
-   lwlib is such an incredible hairy crock. I just cannot believe
+   [[ lwlib is such an incredible hairy crock. I just cannot believe
    it! There are random dependencies between functions, there is a
    total lack of genericity, even though it initially appears to be
    generic. It should all be junked and begun again. Building tabs are
    an example - in theory we should be able to reuse a lot of the
    general stuff because we want to put labels of whatever toolkit we
-   are using in the tab. Instead we have to hack it by hand. */
+   are using in the tab. Instead we have to hack it by hand. ]]
+   While lwlib is a hairy crock, whoever wrote that seems to misunderstand
+   Falk's tab control widget.  The tab control widget has *two* kinds of
+   children: *widgets*, which all occupy a *single* pane below the row of
+   tabs---this is where the labels created in build_tabs_in_widget go, and
+   *gadgets*, the tabs themselves, which do *not* draw themselves, but
+   rather are drawn by the control.  In fact, in XEmacs the true widget
+   children are *never* visible!  So this case is not a problem in the
+   design of lwlib, but rather of Falk's widget. -- sjt */
 static void
 xlw_tab_control_callback (Widget w, XtPointer client_data, XtPointer call_data)
 {
@@ -375,9 +388,8 @@ xlw_create_tab_control (widget_instance *instance)
   widget_value* val = instance->info->val;
 
   XtSetArg (al [ac], XtNsensitive, val->enabled);              ac++;
-  XtSetArg (al [ac], XtNmappedWhenManaged, FALSE);     ac++;
+  XtSetArg (al [ac], XtNmappedWhenManaged, False);             ac++;
   XtSetArg (al [ac], XtNorientation, XtorientHorizontal);      ac++;
-  XtSetArg (al [ac], XtNresizable, False);                     ac++;
 
   /* add any args the user supplied for creation time */
   lw_add_value_args_to_args (val, al, &ac);
@@ -396,15 +408,22 @@ static void build_tabs_in_widget (widget_instance* instance, Widget widget,
                                  widget_value* val)
 {
   widget_value* cur = val;
+  Arg al[1];
+
+  /* Children are always invisible, don't permit resizing. */
+  XtSetArg (al[0], XtNresizable, False);
+
   for (cur = val; cur; cur = cur->next)
     {
       if (cur->value)
        {
+         Widget w;
 #ifdef LWLIB_WIDGETS_MOTIF
-         xm_create_label (widget, cur);
+         w = xm_create_label (widget, cur);
 #else
-         xaw_create_label (widget, cur);
+         w = xaw_create_label (widget, cur);
 #endif
+         XtSetValues (w, al, 1);
        }
       cur->change = NO_CHANGE;
     }
@@ -482,7 +501,7 @@ xlw_create_clip_window (widget_instance *instance)
 }
 #endif
 
-widget_creation_entry 
+const widget_creation_entry 
 xlw_creation_table [] =
 {
 #ifdef LWLIB_MENUBARS_LUCID
@@ -536,9 +555,6 @@ xlw_update_one_widget (widget_instance* instance, Widget widget,
                       widget_value* val, Boolean deep_p)
 {
   WidgetClass class = XtClass (widget);
-  /* Update up global arg values. */
-  if (val->args && val->args->nargs)
-    XtSetValues (widget, val->args->args, val->args->nargs);
 
   if (0)
     ;
@@ -552,7 +568,7 @@ xlw_update_one_widget (widget_instance* instance, Widget widget,
       else
        mw = (XlwMenuWidget)widget;
       XtSetArg (al [0], XtNmenu, val);
-      XtSetValues (widget, al, 1);
+      XtSetValues (widget, al, 1); /* #### mw unused! */
     }
 #endif
 #ifdef LWLIB_SCROLLBARS_LUCID
@@ -567,6 +583,9 @@ xlw_update_one_widget (widget_instance* instance, Widget widget,
       xlw_update_tab_control (instance, widget, val);
     }
 #endif
+  /* Lastly update our global arg values. */
+  if (val->args && val->args->nargs)
+    XtSetValues (widget, val->args->args, val->args->nargs);
 }
 
 void