annotate lwlib/lwlib-Xaw.c @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents de805c49cfc1
children 11054d720c21
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 Athena widgets.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1993, 1994 Free Software Foundation, 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 1, 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: 82
diff changeset
21 #include <config.h>
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 #include <stdio.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
163
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
24 #ifdef STDC_HEADERS
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
25 #include <stdlib.h>
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
26 #endif
0132846995bd Import from CVS: tag r20-3b8
cvs
parents: 157
diff changeset
27
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 #include "lwlib-Xaw.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 #include <X11/StringDefs.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 #include <X11/IntrinsicP.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #include <X11/CoreP.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 #include <X11/Shell.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
35 #ifdef LWLIB_SCROLLBARS_ATHENA
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
36 #include <X11/Xaw/Scrollbar.h>
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #endif
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
38 #ifdef LWLIB_DIALOGS_ATHENA
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
39 #include <X11/Xaw/Dialog.h>
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
40 #include <X11/Xaw/Form.h>
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
41 #include <X11/Xaw/Command.h>
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
42 #include <X11/Xaw/Label.h>
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 #endif
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
44
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 #include <X11/Xatom.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 static void xaw_generic_callback (Widget, XtPointer, XtPointer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 Boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 lw_xaw_widget_p (Widget widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 return (0
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
54 #ifdef LWLIB_SCROLLBARS_ATHENA
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 || XtIsSubclass (widget, scrollbarWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 #endif
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
57 #ifdef LWLIB_DIALOGS_ATHENA
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 || XtIsSubclass (widget, dialogWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
63 #ifdef LWLIB_SCROLLBARS_ATHENA
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 xaw_update_scrollbar (widget_instance *instance, Widget widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 widget_value *val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 if (val->scrollbar_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 scrollbar_values *data = val->scrollbar_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 float widget_shown, widget_topOfThumb;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 float new_shown, new_topOfThumb;
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
73 Arg al [10];
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
75 /* First size and position the scrollbar widget. */
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
76 XtSetArg (al [0], XtNx, data->scrollbar_x);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
77 XtSetArg (al [1], XtNy, data->scrollbar_y);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
78 XtSetArg (al [2], XtNwidth, data->scrollbar_width);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
79 XtSetArg (al [3], XtNheight, data->scrollbar_height);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
80 XtSetValues (widget, al, 4);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
82 /* Now size the scrollbar's slider. */
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
83 XtSetArg (al [0], XtNtopOfThumb, &widget_topOfThumb);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
84 XtSetArg (al [1], XtNshown, &widget_shown);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
85 XtGetValues (widget, al, 2);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 new_shown = (double) data->slider_size /
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (double) (data->maximum - data->minimum);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 new_topOfThumb = (double) (data->slider_position - data->minimum) /
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (double) (data->maximum - data->minimum);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 if (new_shown > 1.0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 new_shown = 1.0;
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
95 else if (new_shown < 0)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 new_shown = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 if (new_topOfThumb > 1.0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 new_topOfThumb = 1.0;
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
100 else if (new_topOfThumb < 0)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 new_topOfThumb = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 if (new_shown != widget_shown || new_topOfThumb != widget_topOfThumb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 XawScrollbarSetThumb (widget, new_topOfThumb, new_shown);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 }
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
107 #endif /* LWLIB_SCROLLBARS_ATHENA */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 xaw_update_one_widget (widget_instance *instance, Widget widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 widget_value *val, Boolean deep_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 if (0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 ;
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
115 #ifdef LWLIB_SCROLLBARS_ATHENA
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 else if (XtIsSubclass (widget, scrollbarWidgetClass))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 xaw_update_scrollbar (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 #endif
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
121 #ifdef LWLIB_DIALOGS_ATHENA
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 else if (XtIsSubclass (widget, dialogWidgetClass))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 {
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
124 Arg al [1];
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
125 XtSetArg (al [0], XtNlabel, val->contents->value);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
126 XtSetValues (widget, al, 1);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 else if (XtIsSubclass (widget, commandWidgetClass))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 Dimension bw = 0;
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
131 Arg al [3];
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
132 XtSetArg (al [0], XtNborderWidth, &bw);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
133 XtGetValues (widget, al, 1);
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
134
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
135 #ifndef LWLIB_DIALOGS_ATHENA3D
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 if (bw == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 /* Don't let buttons end up with 0 borderwidth, that's ugly...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 Yeah, all this should really be done through app-defaults files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 or fallback resources, but that's a whole different can of worms
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 that I don't feel like opening right now. Making Athena widgets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 not look like shit is just entirely too much work.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 */
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
143 {
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
144 XtSetArg (al [0], XtNborderWidth, 1);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
145 XtSetValues (widget, al, 1);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
146 }
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
147 #endif /* ! LWLIB_DIALOGS_ATHENA3D */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
149 XtSetArg (al [0], XtNlabel, val->value);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
150 XtSetArg (al [1], XtNsensitive, val->enabled);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
151 /* Force centered button text. See above. */
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
152 XtSetArg (al [2], XtNjustify, XtJustifyCenter);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
153 XtSetValues (widget, al, 3);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 XtRemoveAllCallbacks (widget, XtNcallback);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 XtAddCallback (widget, XtNcallback, xaw_generic_callback, instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 }
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
158 #endif /* LWLIB_DIALOGS_ATHENA */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 xaw_update_one_value (widget_instance *instance, Widget widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 widget_value *val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 {
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
165 /* This function is not used by the scrollbars and those are the only
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
166 Athena widget implemented at the moment so do nothing. */
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
167 return;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 xaw_destroy_instance (widget_instance *instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 {
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
173 #ifdef LWLIB_DIALOGS_ATHENA
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 if (XtIsSubclass (instance->widget, dialogWidgetClass))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 /* Need to destroy the Shell too. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 XtDestroyWidget (XtParent (instance->widget));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 XtDestroyWidget (instance->widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 xaw_popup_menu (Widget widget, XEvent *event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 /* An Athena menubar has not been implemented. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 xaw_pop_instance (widget_instance *instance, Boolean up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 Widget widget = instance->widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 if (up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 {
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
196 #ifdef LWLIB_DIALOGS_ATHENA
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 if (XtIsSubclass (widget, dialogWidgetClass))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 /* For dialogs, we need to call XtPopup on the parent instead
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 of calling XtManageChild on the widget.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 Also we need to hack the shell's WM_PROTOCOLS to get it to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 understand what the close box is supposed to do!!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 Display *dpy = XtDisplay (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 Widget shell = XtParent (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 Atom props [2];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 int i = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 props [i++] = XInternAtom (dpy, "WM_DELETE_WINDOW", False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 XChangeProperty (dpy, XtWindow (shell),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 XInternAtom (dpy, "WM_PROTOCOLS", False),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 XA_ATOM, 32, PropModeAppend,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (unsigned char *) props, i);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 /* Center the widget in its parent. Why isn't this kind of crap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 done automatically? I thought toolkits were supposed to make
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 life easier?
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 unsigned int x, y, w, h;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 Widget topmost = instance->parent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 w = shell->core.width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 h = shell->core.height;
209
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 165
diff changeset
223 while (topmost->core.parent &&
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 165
diff changeset
224 XtIsRealized (topmost->core.parent) &&
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 165
diff changeset
225 /* HAVE_SESSION adds an unmapped parent widget that
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 165
diff changeset
226 we should ignore here. */
41ff10fd062f Import from CVS: tag r20-4b3
cvs
parents: 165
diff changeset
227 topmost->core.parent->core.mapped_when_managed)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 topmost = topmost->core.parent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 if (topmost->core.width < w) x = topmost->core.x;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 else x = topmost->core.x + ((topmost->core.width - w) / 2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 if (topmost->core.height < h) y = topmost->core.y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 else y = topmost->core.y + ((topmost->core.height - h) / 2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 XtMoveWidget (shell, x, y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 /* Finally, pop it up. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 XtPopup (shell, XtGrabNonexclusive);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 else
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
240 #endif /* LWLIB_DIALOGS_ATHENA */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 XtManageChild (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 {
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
245 #ifdef LWLIB_DIALOGS_ATHENA
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 if (XtIsSubclass (widget, dialogWidgetClass))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 XtUnmanageChild (XtParent (widget));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 XtUnmanageChild (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
255 #ifdef LWLIB_DIALOGS_ATHENA
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 /* Dialog boxes */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 static char overrideTrans[] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 "<Message>WM_PROTOCOLS: lwlib_delete_dialog()";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 static XtActionProc wm_delete_window (Widget shell, XtPointer closure,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 XtPointer call_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 static XtActionsRec xaw_actions [] = {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 {"lwlib_delete_dialog", (XtActionProc) wm_delete_window}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 static Boolean actions_initted = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 static Widget
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
268 make_dialog (CONST char* name, Widget parent, Boolean pop_up_p,
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
269 CONST char* shell_title, CONST char* icon_name,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 Boolean text_input_slot,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 Boolean radio_box, Boolean list,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 int left_buttons, int right_buttons)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 Arg av [20];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 int ac = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 int i, bc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 char button_name [255];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 Widget shell;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 Widget dialog;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 Widget button;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 XtTranslations override;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 if (! pop_up_p) abort (); /* not implemented */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 if (text_input_slot) abort (); /* not implemented */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 if (radio_box) abort (); /* not implemented */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 if (list) abort (); /* not implemented */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 if (! actions_initted)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 XtAppContext app = XtWidgetToApplicationContext (parent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 XtAppAddActions (app, xaw_actions,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 sizeof (xaw_actions) / sizeof (xaw_actions[0]));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 actions_initted = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 override = XtParseTranslationTable (overrideTrans);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 ac = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
299 XtSetArg (av[ac], XtNtitle, shell_title); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 XtSetArg (av[ac], XtNallowShellResize, True); ac++;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
301 XtSetArg (av[ac], XtNtransientFor, parent); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 shell = XtCreatePopupShell ("dialog", transientShellWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 parent, av, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 XtOverrideTranslations (shell, override);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 ac = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 dialog = XtCreateManagedWidget (name, dialogWidgetClass, shell, av, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 bc = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 button = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 for (i = 0; i < left_buttons; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 ac = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
314 XtSetArg (av [ac], XtNfromHoriz, button); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
315 XtSetArg (av [ac], XtNleft, XtChainLeft); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
316 XtSetArg (av [ac], XtNright, XtChainLeft); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
317 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
319 XtSetArg (av [ac], XtNresizable, True); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 sprintf (button_name, "button%d", ++bc);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 button = XtCreateManagedWidget (button_name, commandWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 dialog, av, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 if (right_buttons)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 /* Create a separator
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 I want the separator to take up the slack between the buttons on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 the right and the buttons on the left (that is I want the buttons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 after the separator to be packed against the right edge of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 window) but I can't seem to make it do it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 ac = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
334 XtSetArg (av [ac], XtNfromHoriz, button); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 /* XtSetArg (av [ac], XtNfromVert, XtNameToWidget (dialog, "label")); ac++; */
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
336 XtSetArg (av [ac], XtNleft, XtChainLeft); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
337 XtSetArg (av [ac], XtNright, XtChainRight); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
338 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 XtSetArg (av [ac], XtNlabel, ""); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 XtSetArg (av [ac], XtNwidth, 30); ac++; /* #### aaack!! */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 XtSetArg (av [ac], XtNborderWidth, 0); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 XtSetArg (av [ac], XtNshapeStyle, XmuShapeRectangle); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 XtSetArg (av [ac], XtNresizable, False); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 XtSetArg (av [ac], XtNsensitive, False); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 button = XtCreateManagedWidget ("separator",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 /* labelWidgetClass, */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 /* This has to be Command to fake out
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 the Dialog widget... */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 commandWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 dialog, av, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 for (i = 0; i < right_buttons; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 ac = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
356 XtSetArg (av [ac], XtNfromHoriz, button); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
357 XtSetArg (av [ac], XtNleft, XtChainRight); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
358 XtSetArg (av [ac], XtNright, XtChainRight); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
359 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
361 XtSetArg (av [ac], XtNresizable, True); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 sprintf (button_name, "button%d", ++bc);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 button = XtCreateManagedWidget (button_name, commandWidgetClass,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 dialog, av, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 return dialog;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 xaw_create_dialog (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 char *name = instance->info->type;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 Widget parent = instance->parent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 Widget widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 Boolean pop_up_p = instance->pop_up_p;
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
377 CONST char *shell_name = 0;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
378 CONST char *icon_name = 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 Boolean text_input_slot = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 Boolean radio_box = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 Boolean list = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 int total_buttons;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 int left_buttons = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 int right_buttons = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 switch (name [0]) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 case 'E': case 'e':
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 icon_name = "dbox-error";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 shell_name = "Error";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 case 'I': case 'i':
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 icon_name = "dbox-info";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 shell_name = "Information";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 case 'L': case 'l':
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 list = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 icon_name = "dbox-question";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 shell_name = "Prompt";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 case 'P': case 'p':
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 text_input_slot = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 icon_name = "dbox-question";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 shell_name = "Prompt";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 case 'Q': case 'q':
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 icon_name = "dbox-question";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 shell_name = "Question";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 total_buttons = name [1] - '0';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 if (name [3] == 'T' || name [3] == 't')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 text_input_slot = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 radio_box = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 else if (name [3])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 right_buttons = name [4] - '0';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 left_buttons = total_buttons - right_buttons;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 widget = make_dialog (name, parent, pop_up_p,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 shell_name, icon_name, text_input_slot, radio_box,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 list, left_buttons, right_buttons);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 return widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 }
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
433 #endif /* LWLIB_DIALOGS_ATHENA */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 xaw_generic_callback (Widget widget, XtPointer closure, XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 widget_instance *instance = (widget_instance *) closure;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 Widget instance_widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 LWLIB_ID id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 XtPointer user_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 lw_internal_update_other_instances (widget, closure, call_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 if (! instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 if (widget->core.being_destroyed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 instance_widget = instance->widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 if (!instance_widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 id = instance->info->id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 user_data = NULL;
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
459 {
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
460 Arg al [1];
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
461 XtSetArg (al [0], XtNuserData, &user_data);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
462 XtGetValues (widget, al, 1);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
463 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 /* Damn! Athena doesn't give us a way to hang our own data on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 buttons, so we have to go find it... I guess this assumes that
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
467 all instances of a button have the same call data. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 {
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
469 widget_value *val = instance->info->val->contents;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
470 char *name = XtName (widget);
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
471 while (val)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 {
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
473 if (val->name && !strcmp (val->name, name))
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
474 break;
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
475 val = val->next;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 }
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
477 if (! val) abort ();
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 user_data = val->call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 if (instance->info->selection_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 instance->info->selection_cb (widget, id, user_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
486 #ifdef LWLIB_DIALOGS_ATHENA
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 static XtActionProc
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 wm_delete_window (Widget shell, XtPointer closure, XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 LWLIB_ID id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 Widget *kids = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 Widget widget;
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
494 Arg al [1];
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 if (! XtIsSubclass (shell, shellWidgetClass))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 abort ();
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
497 XtSetArg (al [0], XtNchildren, &kids);
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 163
diff changeset
498 XtGetValues (shell, al, 1);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 if (!kids || !*kids)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 widget = kids [0];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 if (! XtIsSubclass (widget, dialogWidgetClass))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 id = lw_get_widget_id (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 if (! id) abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 widget_info *info = lw_get_widget_info (id);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 if (! info) abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 if (info->selection_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 info->selection_cb (widget, id, (XtPointer) -1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 lw_destroy_all_widgets (id);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
518 #endif /* LWLIB_DIALOGS_ATHENA */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 /* Scrollbars */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
523 #ifdef LWLIB_SCROLLBARS_ATHENA
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 xaw_scrollbar_scroll (Widget widget, XtPointer closure, XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 widget_instance *instance = (widget_instance *) closure;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 LWLIB_ID id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 scroll_event event_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 if (!instance || widget->core.being_destroyed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 id = instance->info->id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 event_data.slider_value = (int) call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 event_data.time = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 if ((int) call_data > 0)
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
539 /* event_data.action = SCROLLBAR_PAGE_DOWN;*/
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
540 event_data.action = SCROLLBAR_LINE_DOWN;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 else
82
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
542 /* event_data.action = SCROLLBAR_PAGE_UP;*/
6a378aca36af Import from CVS: tag r20-0b91
cvs
parents: 80
diff changeset
543 event_data.action = SCROLLBAR_LINE_UP;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 if (instance->info->pre_activate_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 xaw_scrollbar_jump (Widget widget, XtPointer closure, XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 widget_instance *instance = (widget_instance *) closure;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 LWLIB_ID id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 scroll_event event_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 scrollbar_values *val =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (scrollbar_values *) instance->info->val->scrollbar_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 float percent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 if (!instance || widget->core.being_destroyed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 id = instance->info->id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 percent = * (float *) call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 event_data.slider_value =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 (int) (percent * (float) (val->maximum - val->minimum)) + val->minimum;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 event_data.time = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 event_data.action = SCROLLBAR_DRAG;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 if (instance->info->pre_activate_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 xaw_create_scrollbar (widget_instance *instance, int vertical)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 {
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
578 Arg av[10];
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 int ac = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
580
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
581 static XtCallbackRec jumpCallbacks[2] =
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
582 { {xaw_scrollbar_jump, NULL}, {NULL, NULL} };
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
583
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
584 static XtCallbackRec scrollCallbacks[2] =
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
585 { {xaw_scrollbar_scroll, NULL}, {NULL, NULL} };
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
586
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
587 jumpCallbacks[0].closure = scrollCallbacks[0].closure = (XtPointer) instance;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 /* #### This is tacked onto the with and height and completely
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 screws our geometry management. We should probably make the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 top-level aware of this so that people could have a border but so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 few people use the Athena scrollbar now that it really isn't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 worth the effort, at least not at the moment. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 XtSetArg (av [ac], XtNborderWidth, 0); ac++;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
595 XtSetArg (av [ac], XtNorientation,
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
596 vertical ? XtorientVertical : XtorientHorizontal); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
597 XtSetArg (av [ac], "jumpProc", jumpCallbacks); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
598 XtSetArg (av [ac], "scrollProc", scrollCallbacks); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
600 return XtCreateWidget (instance->info->name, scrollbarWidgetClass,
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
601 instance->parent, av, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 xaw_create_vertical_scrollbar (widget_instance *instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 return xaw_create_scrollbar (instance, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 xaw_create_horizontal_scrollbar (widget_instance *instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 return xaw_create_scrollbar (instance, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 }
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
615 #endif /* LWLIB_SCROLLBARS_ATHENA */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 widget_creation_entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 xaw_creation_table [] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 {
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 209
diff changeset
620 #ifdef LWLIB_SCROLLBARS_ATHENA
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
621 {"vertical-scrollbar", xaw_create_vertical_scrollbar},
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
622 {"horizontal-scrollbar", xaw_create_horizontal_scrollbar},
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 {NULL, NULL}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 };