annotate lwlib/lwlib-Xlw.c @ 424:11054d720c21 r21-2-20

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