annotate lwlib/lwlib-Xlw.c @ 450:98528da0b7fc r21-2-40

Import from CVS: tag r21-2-40
author cvs
date Mon, 13 Aug 2007 11:39:20 +0200
parents 1ccc32a20af4
children 4b7d425dd3c2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* The lwlib interface to "xlwmenu" menus.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1992, 1994 Lucid, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 This file is part of the Lucid Widget Library.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 The Lucid Widget Library is free software; you can redistribute it and/or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 modify it under the terms of the GNU General Public License as published by
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 any later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 The Lucid Widget Library is distributed in the hope that it will be useful,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 GNU General Public License for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 #include <stdlib.h> /* for abort () */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 #include <stdio.h> /* for abort () */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 #include <limits.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 #include "lwlib-Xlw.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #include "lwlib-utils.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 #include <X11/StringDefs.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #include <X11/IntrinsicP.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #include <X11/ObjectP.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 #include <X11/CompositeP.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #include <X11/Shell.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #ifdef HAVE_WIDGETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #include "../src/EmacsManager.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #ifdef LWLIB_MENUBARS_LUCID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 #include "xlwmenu.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #ifdef LWLIB_SCROLLBARS_LUCID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #include "xlwscrollbar.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 #ifdef LWLIB_TABS_LUCID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 #ifdef NEED_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 #include "lwlib-Xm.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 #ifdef NEED_ATHENA
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 #include "lwlib-Xaw.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 #include "../src/xmu.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 #include "xlwtabs.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 #ifdef LWLIB_MENUBARS_LUCID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 /* Menu callbacks */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 pre_hook (Widget w, XtPointer client_data, XtPointer call_data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 widget_instance* instance = (widget_instance*)client_data;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 widget_value* val;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 if (w->core.being_destroyed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 val = lw_get_widget_value_for_widget (instance, w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 /* #### - this code used to (for some random back_asswards reason) pass
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 the expression below in the call_data slot. For incremental menu
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 construction, this needs to go. I can't even figure out why it was done
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 this way in the first place...it's just a historical weirdism. --Stig */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 call_data = (val ? val->call_data : NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 if (val && val->call_data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 abort(); /* #### - the call_data for the top_level
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 "menubar" widget_value used to be passed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 back to the pre_hook. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 if (instance->info->pre_activate_cb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 instance->info->pre_activate_cb (w, instance->info->id, call_data);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 pick_hook (Widget w, XtPointer client_data, XtPointer call_data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 widget_instance* instance = (widget_instance*)client_data;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 widget_value* contents_val = (widget_value*)call_data;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 widget_value* widget_val;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 XtPointer widget_arg;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 LWLIB_ID id;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 lw_callback post_activate_cb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 if (w->core.being_destroyed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 /* Grab these values before running any functions, in case running
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 the selection_cb causes the widget to be destroyed. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 id = instance->info->id;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 post_activate_cb = instance->info->post_activate_cb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 widget_val = lw_get_widget_value_for_widget (instance, w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 widget_arg = widget_val ? widget_val->call_data : NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 if (instance->info->selection_cb &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 contents_val &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 contents_val->enabled &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 !contents_val->contents)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 instance->info->selection_cb (w, id, contents_val->call_data);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 if (post_activate_cb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 post_activate_cb (w, id, widget_arg);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 /* creation functions */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 static Widget
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 xlw_create_menubar (widget_instance* instance)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 Arg al [1];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 Widget widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 XtSetArg (al [0], XtNmenu, instance->info->val);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 widget = XtCreateWidget (instance->info->name, xlwMenuWidgetClass,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 instance->parent, al, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 XtAddCallback (widget, XtNopen, pre_hook, (XtPointer)instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 return widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 static Widget
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 xlw_create_popup_menu (widget_instance* instance)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 Arg al [2];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 Widget popup_shell, widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 popup_shell = XtCreatePopupShell (instance->info->name,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 overrideShellWidgetClass,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 instance->parent, NULL, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 XtSetArg (al [0], XtNmenu, instance->info->val);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 XtSetArg (al [1], XtNhorizontal, False);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 widget = XtCreateManagedWidget ("popup", xlwMenuWidgetClass,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 popup_shell, al, 2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 return popup_shell;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 #endif /* LWLIB_MENUBARS_LUCID */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 #ifdef LWLIB_SCROLLBARS_LUCID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 xlw_scrollbar_callback (Widget widget, XtPointer closure, XtPointer call_data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 widget_instance *instance = (widget_instance *) closure;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 LWLIB_ID id;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 XlwScrollBarCallbackStruct *data =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 (XlwScrollBarCallbackStruct *) call_data;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 scroll_event event_data;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 scrollbar_values *val =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 (scrollbar_values *) instance->info->val->scrollbar_data;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 double percent;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 if (!instance || widget->core.being_destroyed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 id = instance->info->id;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 percent = (double) (data->value - 1) / (double) (INT_MAX - 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 event_data.slider_value =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 (int) (percent * (double) (val->maximum - val->minimum)) + val->minimum;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 if (event_data.slider_value > val->maximum - val->slider_size)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 event_data.slider_value = val->maximum - val->slider_size;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 else if (event_data.slider_value < val->minimum)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 event_data.slider_value = val->minimum;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 if (data->event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 switch (data->event->type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 case KeyPress:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 case KeyRelease:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 event_data.time = data->event->xkey.time;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 case ButtonPress:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 case ButtonRelease:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 event_data.time = data->event->xbutton.time;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 case MotionNotify:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 event_data.time = data->event->xmotion.time;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 case EnterNotify:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 case LeaveNotify:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 event_data.time = data->event->xcrossing.time;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 event_data.time = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 event_data.time = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 switch (data->reason)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 case XmCR_DECREMENT: event_data.action = SCROLLBAR_LINE_UP; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 case XmCR_INCREMENT: event_data.action = SCROLLBAR_LINE_DOWN; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 case XmCR_PAGE_DECREMENT: event_data.action = SCROLLBAR_PAGE_UP; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 case XmCR_PAGE_INCREMENT: event_data.action = SCROLLBAR_PAGE_DOWN; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 case XmCR_TO_TOP: event_data.action = SCROLLBAR_TOP; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 case XmCR_TO_BOTTOM: event_data.action = SCROLLBAR_BOTTOM; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 case XmCR_DRAG: event_data.action = SCROLLBAR_DRAG; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 case XmCR_VALUE_CHANGED: event_data.action = SCROLLBAR_CHANGE; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 default: event_data.action = SCROLLBAR_CHANGE; break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 if (instance->info->pre_activate_cb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 #define add_scrollbar_callback(resource) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 XtAddCallback (scrollbar, resource, xlw_scrollbar_callback, (XtPointer) instance)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 /* #### Does not yet support horizontal scrollbars. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 static Widget
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 xlw_create_scrollbar (widget_instance *instance, int vertical)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 Arg al[20];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 int ac = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 static XtCallbackRec callbacks[2] =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 { {xlw_scrollbar_callback, NULL}, {NULL, NULL} };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 callbacks[0].closure = (XtPointer) instance;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 XtSetArg (al[ac], XmNminimum, 1); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 XtSetArg (al[ac], XmNmaximum, INT_MAX); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 XtSetArg (al[ac], XmNincrement, 1); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 XtSetArg (al[ac], XmNpageIncrement, 1); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 XtSetArg (al[ac], XmNorientation, (vertical ? XmVERTICAL : XmHORIZONTAL)); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 XtSetArg (al[ac], XmNdecrementCallback, callbacks); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 XtSetArg (al[ac], XmNdragCallback, callbacks); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 XtSetArg (al[ac], XmNincrementCallback, callbacks); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 XtSetArg (al[ac], XmNpageDecrementCallback, callbacks); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 XtSetArg (al[ac], XmNpageIncrementCallback, callbacks); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 XtSetArg (al[ac], XmNtoBottomCallback, callbacks); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 XtSetArg (al[ac], XmNtoTopCallback, callbacks); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 XtSetArg (al[ac], XmNvalueChangedCallback, callbacks); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 return XtCreateWidget (instance->info->name, xlwScrollBarWidgetClass,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 instance->parent, al, ac);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 static Widget
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 xlw_create_vertical_scrollbar (widget_instance *instance)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 return xlw_create_scrollbar (instance, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 static Widget
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 xlw_create_horizontal_scrollbar (widget_instance *instance)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 return xlw_create_scrollbar (instance, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 xlw_update_scrollbar (widget_instance *instance, Widget widget,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 widget_value *val)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 if (val->scrollbar_data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 scrollbar_values *data = val->scrollbar_data;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 int widget_sliderSize, widget_val;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 int new_sliderSize, new_value;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 double percent;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 Arg al [4];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 /* First size and position the scrollbar widget. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 XtSetArg (al [0], XtNx, data->scrollbar_x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 XtSetArg (al [1], XtNy, data->scrollbar_y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 XtSetArg (al [2], XtNwidth, data->scrollbar_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 XtSetArg (al [3], XtNheight, data->scrollbar_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 XtSetValues (widget, al, 4);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 /* Now size the scrollbar's slider. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 XtSetArg (al [0], XmNsliderSize, &widget_sliderSize);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 XtSetArg (al [1], XmNvalue, &widget_val);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 XtGetValues (widget, al, 2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 percent = (double) data->slider_size /
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 (double) (data->maximum - data->minimum);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 percent = (percent > 1.0 ? 1.0 : percent);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 new_sliderSize = (int) ((double) (INT_MAX - 1) * percent);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 percent = (double) (data->slider_position - data->minimum) /
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 (double) (data->maximum - data->minimum);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 percent = (percent > 1.0 ? 1.0 : percent);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 new_value = (int) ((double) (INT_MAX - 1) * percent);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 if (new_sliderSize > INT_MAX - 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 new_sliderSize = INT_MAX - 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 else if (new_sliderSize < 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 new_sliderSize = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 if (new_value > (INT_MAX - new_sliderSize))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 new_value = INT_MAX - new_sliderSize;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 else if (new_value < 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 new_value = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 if (new_sliderSize != widget_sliderSize || new_value != widget_val)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 XlwScrollBarSetValues (widget, new_value, new_sliderSize, 1, 1, False);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 #endif /* LWLIB_SCROLLBARS_LUCID */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 #ifdef LWLIB_TABS_LUCID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 /* tab control
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 lwlib is such an incredible hairy crock. I just cannot believe
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 it! There are random dependencies between functions, there is a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 total lack of genericity, even though it initially appears to be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 generic. It should all be junked and begun again. Building tabs are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 an example - in theory we should be able to reuse a lot of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 general stuff because we want to put labels of whatever toolkit we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 are using in the tab. Instead we have to hack it by hand. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 xlw_tab_control_callback (Widget w, XtPointer client_data, XtPointer call_data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 /* call data is the topmost widget */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 widget_instance* instance = (widget_instance*)client_data;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 Widget top = (Widget)call_data;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 char *name = XtName (top);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 widget_value* widget_val;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 XtPointer widget_arg;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 LWLIB_ID id;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 lw_callback post_activate_cb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 if (w->core.being_destroyed)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 /* Grab these values before running any functions, in case running
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 the selection_cb causes the widget to be destroyed. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 id = instance->info->id;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 post_activate_cb = instance->info->post_activate_cb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 /* search for the widget_val for the selected tab */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 for (widget_val = instance->info->val->contents; widget_val;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 widget_val = widget_val->next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 if (!strcmp (widget_val->name, name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 widget_arg = widget_val ? widget_val->call_data : NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 if (instance->info->selection_cb &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 widget_val &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 widget_val->enabled &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 !widget_val->contents)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 instance->info->selection_cb (w, id, widget_arg);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 if (post_activate_cb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 post_activate_cb (w, id, widget_arg);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 static Widget
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 xlw_create_tab_control (widget_instance *instance)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 Arg al[20];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 int ac = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 Widget tab = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 widget_value* val = instance->info->val;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 XtSetArg (al [ac], XtNsensitive, val->enabled); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 XtSetArg (al [ac], XtNmappedWhenManaged, FALSE); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 XtSetArg (al [ac], XtNorientation, XtorientHorizontal); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 XtSetArg (al [ac], XtNresizable, False); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 /* add any args the user supplied for creation time */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 lw_add_value_args_to_args (val, al, &ac);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 tab = XtCreateManagedWidget (val->name, tabsWidgetClass,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 instance->parent, al, ac);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 XtRemoveAllCallbacks (tab, XtNcallback);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 XtAddCallback (tab, XtNcallback, xlw_tab_control_callback, (XtPointer)instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 XtManageChild (tab);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 return tab;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 static void build_tabs_in_widget (widget_instance* instance, Widget widget,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 widget_value* val)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 widget_value* cur = val;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 for (cur = val; cur; cur = cur->next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 if (cur->value)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 #ifdef LWLIB_WIDGETS_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 xm_create_label (widget, cur);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 xaw_create_label (widget, cur);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 cur->change = NO_CHANGE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 xlw_update_tab_control (widget_instance* instance, Widget widget, widget_value* val)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 Widget* children;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 unsigned int num_children;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 widget_value *cur = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 XtRemoveAllCallbacks (widget, XtNcallback);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 XtAddCallback (widget, XtNcallback, xlw_tab_control_callback, (XtPointer)instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 if (val->change == STRUCTURAL_CHANGE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 ||
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 (val->contents && val->contents->change == STRUCTURAL_CHANGE))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 destroy_all_children (widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 build_tabs_in_widget (instance, widget, val->contents);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 children = XtCompositeChildren (widget, &num_children);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 if (children)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 for (i = 0, cur = val->contents; i < num_children; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 if (!cur)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 if (children [i]->core.being_destroyed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 || strcmp (XtName (children [i]), cur->name))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 #ifdef NEED_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 if (lw_motif_widget_p (children [i]))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 xm_update_one_widget (instance, children [i], cur, False);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 #ifdef NEED_ATHENA
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 if (lw_xaw_widget_p (children [i]))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 xaw_update_one_widget (instance, children [i], cur, False);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 cur = cur->next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 XtFree ((char *) children);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 if (cur)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 #endif /* LWLIB_TABS_LUCID */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 #ifdef HAVE_WIDGETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 static Widget
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 xlw_create_clip_window (widget_instance *instance)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 Arg al[20];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 int ac = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 Widget clip = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 widget_value* val = instance->info->val;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 XtSetArg (al [ac], XtNmappedWhenManaged, FALSE); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 XtSetArg (al [ac], XtNsensitive, TRUE); ac++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 /* add any args the user supplied for creation time */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 lw_add_value_args_to_args (val, al, &ac);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 /* Create a clip window to contain the subwidget. Incredibly the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 XEmacs manager seems to be the most appropriate widget for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 this. Nothing else is simple enough and yet does what is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 required. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 clip = XtCreateManagedWidget (val->name,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 emacsManagerWidgetClass,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 instance->parent, al, ac);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 return clip;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484
450
98528da0b7fc Import from CVS: tag r21-2-40
cvs
parents: 446
diff changeset
485 const widget_creation_entry
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 xlw_creation_table [] =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 #ifdef LWLIB_MENUBARS_LUCID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 {"menubar", xlw_create_menubar},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 {"popup", xlw_create_popup_menu},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 #ifdef LWLIB_SCROLLBARS_LUCID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 {"vertical-scrollbar", xlw_create_vertical_scrollbar},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 {"horizontal-scrollbar", xlw_create_horizontal_scrollbar},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 #ifdef LWLIB_TABS_LUCID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 {"tab-control", xlw_create_tab_control},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 #ifdef HAVE_WIDGETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 {"clip-window", xlw_create_clip_window},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 {NULL, NULL}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 Boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 lw_lucid_widget_p (Widget widget)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 WidgetClass the_class = XtClass (widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 #ifdef LWLIB_MENUBARS_LUCID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 if (the_class == xlwMenuWidgetClass)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 return True;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 #ifdef LWLIB_SCROLLBARS_LUCID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 if (the_class == xlwScrollBarWidgetClass)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 return True;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 #ifdef LWLIB_TABS_LUCID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 if (the_class == tabsWidgetClass)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 return True;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 #ifdef LWLIB_MENUBARS_LUCID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 if (the_class == overrideShellWidgetClass)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 return
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 XtClass (((CompositeWidget)widget)->composite.children [0])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 == xlwMenuWidgetClass;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 #endif
432
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
527 #ifdef HAVE_WIDGETS
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
528 if (the_class == emacsManagerWidgetClass)
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
529 return True;
3a7e78e1142d Import from CVS: tag r21-2-24
cvs
parents: 428
diff changeset
530 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 return False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 xlw_update_one_widget (widget_instance* instance, Widget widget,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 widget_value* val, Boolean deep_p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 WidgetClass class = XtClass (widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 if (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 #ifdef LWLIB_MENUBARS_LUCID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 else if (class == xlwMenuWidgetClass)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 XlwMenuWidget mw;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 Arg al [1];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 if (XtIsShell (widget))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 mw = (XlwMenuWidget)((CompositeWidget)widget)->composite.children [0];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 mw = (XlwMenuWidget)widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 XtSetArg (al [0], XtNmenu, val);
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents: 442
diff changeset
552 XtSetValues (widget, al, 1); /* #### mw unused! */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 #ifdef LWLIB_SCROLLBARS_LUCID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 else if (class == xlwScrollBarWidgetClass)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 xlw_update_scrollbar (instance, widget, val);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 #ifdef LWLIB_TABS_LUCID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 else if (class == tabsWidgetClass)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 xlw_update_tab_control (instance, widget, val);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 #endif
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 438
diff changeset
567 /* Lastly update our global arg values. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 438
diff changeset
568 if (val->args && val->args->nargs)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 438
diff changeset
569 XtSetValues (widget, val->args->args, val->args->nargs);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 xlw_update_one_value (widget_instance* instance, Widget widget,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574 widget_value* val)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 xlw_pop_instance (widget_instance* instance, Boolean up)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 #ifdef LWLIB_MENUBARS_LUCID
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 xlw_popup_menu (Widget widget, XEvent *event)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 XlwMenuWidget mw;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 if (!XtIsShell (widget))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 if (event->type == ButtonPress || event->type == ButtonRelease)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 mw = (XlwMenuWidget)((CompositeWidget)widget)->composite.children [0];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 xlw_pop_up_menu (mw, (XButtonPressedEvent *)event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 #endif /* LWLIB_MENUBARS_LUCID */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603 /* Destruction of instances */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 xlw_destroy_instance (widget_instance* instance)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 if (instance->widget)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 XtDestroyWidget (instance->widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 }