annotate lwlib/lwlib-Xlw.c @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 9ee227acff29
children c7528f8e288d
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
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 #include <stdlib.h> /* for abort () */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 #include <limits.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 #include "lwlib-Xlw.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 #include <X11/StringDefs.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 #include <X11/IntrinsicP.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 #include <X11/ObjectP.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 #include <X11/CompositeP.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 #include <X11/Shell.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 #ifdef MENUBARS_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 #include "xlwmenu.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #ifdef SCROLLBARS_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 #include "xlwscrollbar.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 #ifdef MENUBARS_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 /* Menu callbacks */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 pre_hook (Widget w, XtPointer client_data, XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 widget_instance* instance = (widget_instance*)client_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 widget_value* val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 if (w->core.being_destroyed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 val = lw_get_widget_value_for_widget (instance, w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 /* #### - this code used to (for some random back_asswards reason) pass
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 the expression below in the call_data slot. For incremental menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 construction, this needs to go. I can't even figure out why it was done
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
56 this way in the first place...it's just a historical wierdism. --Stig */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 call_data = (val ? val->call_data : NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 if (val && val->call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 abort(); /* #### - the call_data for the top_level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 "menubar" widget_value used to be passed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 back to the pre_hook. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 if (instance->info->pre_activate_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 instance->info->pre_activate_cb (w, instance->info->id, call_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 pick_hook (Widget w, XtPointer client_data, XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 widget_instance* instance = (widget_instance*)client_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 widget_value* contents_val = (widget_value*)call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 widget_value* widget_val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 XtPointer widget_arg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 LWLIB_ID id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 lw_callback post_activate_cb;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 if (w->core.being_destroyed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 /* Grab these values before running any functions, in case running
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 the selection_cb causes the widget to be destroyed. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 id = instance->info->id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 post_activate_cb = instance->info->post_activate_cb;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 widget_val = lw_get_widget_value_for_widget (instance, w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 widget_arg = widget_val ? widget_val->call_data : NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 if (instance->info->selection_cb &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 contents_val &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 contents_val->enabled &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 !contents_val->contents)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 instance->info->selection_cb (w, id, contents_val->call_data);
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 (post_activate_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 post_activate_cb (w, id, widget_arg);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 /* creation functions */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 xlw_create_menubar (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 Widget widget =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 XtVaCreateWidget (instance->info->name, xlwMenuWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 instance->parent,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 XtNmenu, instance->info->val,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 0);
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
110 XtAddCallback (widget, XtNopen, pre_hook, (XtPointer)instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 XtAddCallback (widget, XtNselect, pick_hook, (XtPointer)instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 return widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 xlw_create_popup_menu (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 Widget popup_shell =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 XtCreatePopupShell (instance->info->name, overrideShellWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 instance->parent, NULL, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 Widget widget =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 XtVaCreateManagedWidget ("popup", xlwMenuWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 popup_shell,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 XtNmenu, instance->info->val,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 XtNhorizontal, False,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 return popup_shell;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 #endif /* MENUBARS_LUCID */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 #ifdef SCROLLBARS_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 xlw_scrollbar_callback (Widget widget, XtPointer closure, XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 widget_instance *instance = (widget_instance *) closure;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 LWLIB_ID id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 XlwScrollBarCallbackStruct *data =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (XlwScrollBarCallbackStruct *) call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 scroll_event event_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 scrollbar_values *val =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (scrollbar_values *) instance->info->val->scrollbar_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 double percent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 if (!instance || widget->core.being_destroyed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 id = instance->info->id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 percent = (double) (data->value - 1) / (double) (INT_MAX - 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 event_data.slider_value =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (int) (percent * (double) (val->maximum - val->minimum)) + val->minimum;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
157 if (event_data.slider_value > (val->maximum - val->slider_size))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
158 event_data.slider_value = val->maximum - val->slider_size;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 else if (event_data.slider_value < val->minimum)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
160 event_data.slider_value = val->minimum;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 if (data->event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 {
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
164 switch (data->event->xany.type)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 case KeyPress:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 case KeyRelease:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 event_data.time = data->event->xkey.time;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 case ButtonPress:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 case ButtonRelease:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 event_data.time = data->event->xbutton.time;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 case MotionNotify:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 event_data.time = data->event->xmotion.time;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 case EnterNotify:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 case LeaveNotify:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 event_data.time = data->event->xcrossing.time;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 event_data.time = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 event_data.time = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 switch (data->reason)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 {
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
191 case XmCR_DECREMENT:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
192 event_data.action = SCROLLBAR_LINE_UP;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
193 break;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
194 case XmCR_INCREMENT:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
195 event_data.action = SCROLLBAR_LINE_DOWN;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
196 break;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
197 case XmCR_PAGE_DECREMENT:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
198 event_data.action = SCROLLBAR_PAGE_UP;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
199 break;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
200 case XmCR_PAGE_INCREMENT:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
201 event_data.action = SCROLLBAR_PAGE_DOWN;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
202 break;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
203 case XmCR_TO_TOP:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
204 event_data.action = SCROLLBAR_TOP;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
205 break;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
206 case XmCR_TO_BOTTOM:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
207 event_data.action = SCROLLBAR_BOTTOM;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
208 break;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
209 case XmCR_DRAG:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
210 event_data.action = SCROLLBAR_DRAG;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
211 break;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
212 case XmCR_VALUE_CHANGED:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
213 event_data.action = SCROLLBAR_CHANGE;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
214 break;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
215 default:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
216 event_data.action = SCROLLBAR_CHANGE;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
217 break;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 if (instance->info->pre_activate_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 /* #### Does not yet support horizontal scrollbars. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 xlw_create_scrollbar (widget_instance *instance, int vertical)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 Arg al[20];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 int ac = 0;
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
230 Widget scrollbar;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
232 XtSetArg (al[ac], (String) XmNminimum, 1); ac++;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
233 XtSetArg (al[ac], (String) XmNmaximum, INT_MAX); ac++;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
234 XtSetArg (al[ac], (String) XmNincrement, 1); ac++;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
235 XtSetArg (al[ac], (String) XmNpageIncrement, 1); ac++;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
236 if (vertical)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
237 {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
238 XtSetArg (al[ac], (String) XmNorientation, XmVERTICAL); ac++;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
239 }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
240 else
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
241 {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
242 XtSetArg (al[ac], (String) XmNorientation, XmHORIZONTAL); ac++;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
243 }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
244
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
245 scrollbar =
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
246 XtCreateWidget (instance->info->name, xlwScrollBarWidgetClass, instance->parent, al, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
248 XtAddCallback(scrollbar, XmNdecrementCallback, xlw_scrollbar_callback,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
249 (XtPointer) instance);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
250 XtAddCallback(scrollbar, XmNdragCallback, xlw_scrollbar_callback,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
251 (XtPointer) instance);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
252 XtAddCallback(scrollbar, XmNincrementCallback, xlw_scrollbar_callback,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
253 (XtPointer) instance);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
254 XtAddCallback(scrollbar, XmNpageDecrementCallback, xlw_scrollbar_callback,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
255 (XtPointer) instance);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
256 XtAddCallback(scrollbar, XmNpageIncrementCallback, xlw_scrollbar_callback,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
257 (XtPointer) instance);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
258 XtAddCallback(scrollbar, XmNtoBottomCallback, xlw_scrollbar_callback,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
259 (XtPointer) instance);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
260 XtAddCallback(scrollbar, XmNtoTopCallback, xlw_scrollbar_callback,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
261 (XtPointer) instance);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
262 XtAddCallback(scrollbar, XmNvalueChangedCallback, xlw_scrollbar_callback,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
263 (XtPointer) instance);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
265 return scrollbar;
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 Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 xlw_create_vertical_scrollbar (widget_instance *instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 return xlw_create_scrollbar (instance, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 xlw_create_horizontal_scrollbar (widget_instance *instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 return xlw_create_scrollbar (instance, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 xlw_update_scrollbar (widget_instance *instance, Widget widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 widget_value *val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 if (val->scrollbar_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 scrollbar_values *data = val->scrollbar_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 int widget_sliderSize, widget_val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 int new_sliderSize, new_value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 double percent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
291 /*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
292 * First size and position the scrollbar widget.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
293 */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 XtVaSetValues (widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 XtNx, data->scrollbar_x,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 XtNy, data->scrollbar_y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 XtNwidth, data->scrollbar_width,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 XtNheight, data->scrollbar_height,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
301 /*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
302 * Now the size the scrollbar's slider.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
303 */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
304
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 XtVaGetValues (widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 XmNsliderSize, &widget_sliderSize,
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
307 XmNvalue, &widget_val,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 percent = (double) data->slider_size /
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (double) (data->maximum - data->minimum);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 percent = (percent > 1.0 ? 1.0 : percent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 new_sliderSize = (int) ((double) (INT_MAX - 1) * percent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 percent = (double) (data->slider_position - data->minimum) /
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (double) (data->maximum - data->minimum);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 percent = (percent > 1.0 ? 1.0 : percent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 new_value = (int) ((double) (INT_MAX - 1) * percent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
320 if (new_sliderSize > (INT_MAX - 1))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
321 new_sliderSize = INT_MAX - 1;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 if (new_sliderSize < 1)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
323 new_sliderSize = 1;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 if (new_value > (INT_MAX - new_sliderSize))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
326 new_value = INT_MAX - new_sliderSize;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 else if (new_value < 1)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
328 new_value = 1;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 if (new_sliderSize != widget_sliderSize || new_value != widget_val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 XlwScrollBarSetValues (widget, new_value, new_sliderSize, 1, 1, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 #endif /* SCROLLBARS_LUCID */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 widget_creation_entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 xlw_creation_table [] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 #ifdef MENUBARS_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 {"menubar", xlw_create_menubar},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 {"popup", xlw_create_popup_menu},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 #ifdef SCROLLBARS_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 {"vertical-scrollbar", xlw_create_vertical_scrollbar},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 {"horizontal-scrollbar", xlw_create_horizontal_scrollbar},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 {NULL, NULL}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 Boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 lw_lucid_widget_p (Widget widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 WidgetClass the_class = XtClass (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 #ifdef MENUBARS_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 if (the_class == xlwMenuWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 return True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 #ifdef SCROLLBARS_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 if (the_class == xlwScrollBarWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 return True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 #ifdef MENUBARS_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 if (the_class == overrideShellWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 return
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 XtClass (((CompositeWidget)widget)->composite.children [0])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 == xlwMenuWidgetClass;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 return False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 xlw_update_one_widget (widget_instance* instance, Widget widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 widget_value* val, Boolean deep_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 WidgetClass class;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 class = XtClass (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 if (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 #ifdef MENUBARS_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 else if (class == xlwMenuWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 XlwMenuWidget mw;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 if (XtIsShell (widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 mw = (XlwMenuWidget)((CompositeWidget)widget)->composite.children [0];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 mw = (XlwMenuWidget)widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 XtVaSetValues (widget, XtNmenu, val, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 #ifdef SCROLLBARS_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 else if (class == xlwScrollBarWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 xlw_update_scrollbar (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 xlw_update_one_value (widget_instance* instance, Widget widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 widget_value* val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 xlw_pop_instance (widget_instance* instance, Boolean up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 #ifdef MENUBARS_LUCID
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 xlw_popup_menu (Widget widget, XEvent *event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 XlwMenuWidget mw;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 if (!XtIsShell (widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 if (event->type == ButtonPress || event->type == ButtonRelease)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 mw = (XlwMenuWidget)((CompositeWidget)widget)->composite.children [0];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 xlw_pop_up_menu (mw, (XButtonPressedEvent *)event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 /* Destruction of instances */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 xlw_destroy_instance (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 if (instance->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 XtDestroyWidget (instance->widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 }
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
439