annotate lwlib/lwlib-Xaw.c @ 105902:bd0956f17a92

*** empty log message ***
author Michael Albinus <michael.albinus@gmx.de>
date Sun, 08 Nov 2009 00:09:02 +0000
parents 68dd71358159
children 1d1d5d9bd884
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1 /* The lwlib interface to Athena widgets.
76177
a274050b67b1 Add FSF copyright.
Glenn Morris <rgm@gnu.org>
parents: 64083
diff changeset
2 Copyright (C) 1993 Chuck Thompson <cthomp@cs.uiuc.edu>
a274050b67b1 Add FSF copyright.
Glenn Morris <rgm@gnu.org>
parents: 64083
diff changeset
3 Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006,
100957
3c31d7653adf Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 87649
diff changeset
4 2007, 2008, 2009 Free Software Foundation, Inc.
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
5
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
6 This file is part of the Lucid Widget Library.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
7
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48488
diff changeset
8 The Lucid Widget Library is free software; you can redistribute it and/or
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
9 modify it under the terms of the GNU General Public License as published by
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
10 the Free Software Foundation; either version 1, or (at your option)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
11 any later version.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
12
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
13 The Lucid Widget Library is distributed in the hope that it will be useful,
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48488
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
16 GNU General Public License for more details.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
17
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
19 along with GNU Emacs; see the file COPYING. If not, write to
64083
23a17af379b1 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 59085
diff changeset
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23a17af379b1 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 59085
diff changeset
21 Boston, MA 02110-1301, USA. */
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
22
26087
e0d966fb548f Add support for large files, plus some locale improvements.
Paul Eggert <eggert@twinsun.com>
parents: 25754
diff changeset
23 #ifdef HAVE_CONFIG_H
e0d966fb548f Add support for large files, plus some locale improvements.
Paul Eggert <eggert@twinsun.com>
parents: 25754
diff changeset
24 #include <config.h>
e0d966fb548f Add support for large files, plus some locale improvements.
Paul Eggert <eggert@twinsun.com>
parents: 25754
diff changeset
25 #endif
e0d966fb548f Add support for large files, plus some locale improvements.
Paul Eggert <eggert@twinsun.com>
parents: 25754
diff changeset
26
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
27 #include <stdio.h>
105669
68dd71358159 * alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100957
diff changeset
28 #include <setjmp.h>
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
29
41767
7fb1caba0f51 Include ../src/lisp.h.
Richard M. Stallman <rms@gnu.org>
parents: 39721
diff changeset
30 #include "../src/lisp.h"
7fb1caba0f51 Include ../src/lisp.h.
Richard M. Stallman <rms@gnu.org>
parents: 39721
diff changeset
31
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
32 #include "lwlib-Xaw.h"
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
33
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
34 #include <X11/StringDefs.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
35 #include <X11/IntrinsicP.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
36 #include <X11/CoreP.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
37 #include <X11/Shell.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
38
81372
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
39 #ifdef HAVE_XAW3D
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
40 #include <X11/Xaw3d/Scrollbar.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
41 #include <X11/Xaw3d/Paned.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
42 #include <X11/Xaw3d/Dialog.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
43 #include <X11/Xaw3d/Form.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
44 #include <X11/Xaw3d/Command.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
45 #include <X11/Xaw3d/Label.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
46 #else /* !HAVE_XAW3D */
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
47 #include <X11/Xaw/Scrollbar.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
48 #include <X11/Xaw/Paned.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
49 #include <X11/Xaw/Dialog.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
50 #include <X11/Xaw/Form.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
51 #include <X11/Xaw/Command.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
52 #include <X11/Xaw/Label.h>
81372
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
53 #endif /* HAVE_XAW3D */
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
54
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
55 #include <X11/Xatom.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
56
6833
5a3216dd6b70 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6623
diff changeset
57 static void xaw_generic_callback (/*Widget, XtPointer, XtPointer*/);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
58
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
59
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
60 Boolean
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
61 lw_xaw_widget_p (widget)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
62 Widget widget;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
63 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
64 return (XtIsSubclass (widget, scrollbarWidgetClass) ||
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
65 XtIsSubclass (widget, dialogWidgetClass));
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
66 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
67
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
68 #if 0
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
69 static void
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
70 xaw_update_scrollbar (instance, widget, val)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
71 widget_instance *instance;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
72 Widget widget;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
73 widget_value *val;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
74 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
75 if (val->scrollbar_data)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
76 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
77 scrollbar_values *data = val->scrollbar_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
78 Dimension height, width;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
79 Dimension pos_x, pos_y;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
80 int widget_shown, widget_topOfThumb;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
81 float new_shown, new_topOfThumb;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
82
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
83 XtVaGetValues (widget,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
84 XtNheight, &height,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
85 XtNwidth, &width,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
86 XtNx, &pos_x,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
87 XtNy, &pos_y,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
88 XtNtopOfThumb, &widget_topOfThumb,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
89 XtNshown, &widget_shown,
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
90 NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
91
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
92 /*
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
93 * First size and position the scrollbar widget.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
94 * We need to position it to second-guess the Paned widget's notion
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
95 * of what should happen when the WMShell gets resized.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
96 */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
97 if (height != data->scrollbar_height || pos_y != data->scrollbar_pos)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
98 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
99 XtConfigureWidget (widget, pos_x, data->scrollbar_pos,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
100 width, data->scrollbar_height, 0);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
101
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
102 XtVaSetValues (widget,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
103 XtNlength, data->scrollbar_height,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
104 XtNthickness, width,
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
105 NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
106 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
107
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
108 /*
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
109 * Now the size the scrollbar's slider.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
110 */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
111 new_shown = (float) data->slider_size /
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
112 (float) (data->maximum - data->minimum);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
113
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
114 new_topOfThumb = (float) (data->slider_position - data->minimum) /
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
115 (float) (data->maximum - data->minimum);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
116
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
117 if (new_shown > 1.0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
118 new_shown = 1.0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
119 if (new_shown < 0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
120 new_shown = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
121
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
122 if (new_topOfThumb > 1.0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
123 new_topOfThumb = 1.0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
124 if (new_topOfThumb < 0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
125 new_topOfThumb = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
126
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
127 if (new_shown != widget_shown || new_topOfThumb != widget_topOfThumb)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
128 XawScrollbarSetThumb (widget, new_topOfThumb, new_shown);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
129 }
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
130 }
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
131 #endif
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
132
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
133 void
48488
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
134 #ifdef PROTOTYPES
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
135 xaw_update_one_widget (widget_instance *instance, Widget widget,
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
136 widget_value *val, Boolean deep_p)
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
137 #else
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
138 xaw_update_one_widget (instance, widget, val, deep_p)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
139 widget_instance *instance;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
140 Widget widget;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
141 widget_value *val;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
142 Boolean deep_p;
48488
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
143 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
144 {
6425
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
145 #if 0
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
146 if (XtIsSubclass (widget, scrollbarWidgetClass))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
147 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
148 xaw_update_scrollbar (instance, widget, val);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
149 }
6425
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
150 #endif
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
151 if (XtIsSubclass (widget, dialogWidgetClass))
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
152 {
6335
fe5cb6ca692a *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6333
diff changeset
153 Arg al[1];
fe5cb6ca692a *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6333
diff changeset
154 int ac = 0;
fe5cb6ca692a *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6333
diff changeset
155 XtSetArg (al[ac], XtNlabel, val->contents->value); ac++;
fe5cb6ca692a *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6333
diff changeset
156 XtSetValues (widget, al, ac);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
157 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
158 else if (XtIsSubclass (widget, commandWidgetClass))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
159 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
160 Dimension bw = 0;
6425
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
161 Arg al[3];
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
162
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
163 XtVaGetValues (widget, XtNborderWidth, &bw, NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
164 if (bw == 0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
165 /* Don't let buttons end up with 0 borderwidth, that's ugly...
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
166 Yeah, all this should really be done through app-defaults files
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
167 or fallback resources, but that's a whole different can of worms
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
168 that I don't feel like opening right now. Making Athena widgets
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
169 not look like shit is just entirely too much work.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
170 */
6425
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
171 {
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
172 XtSetArg (al[0], XtNborderWidth, 1);
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
173 XtSetValues (widget, al, 1);
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
174 }
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
175
36438
78f5e669dc5e (xaw_update_one_widget): Use XtSetSensitive instead
Gerd Moellmann <gerd@gnu.org>
parents: 30571
diff changeset
176 XtSetSensitive (widget, val->enabled);
6425
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
177 XtSetArg (al[0], XtNlabel, val->value);
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
178 /* Force centered button text. Se above. */
36438
78f5e669dc5e (xaw_update_one_widget): Use XtSetSensitive instead
Gerd Moellmann <gerd@gnu.org>
parents: 30571
diff changeset
179 XtSetArg (al[1], XtNjustify, XtJustifyCenter);
78f5e669dc5e (xaw_update_one_widget): Use XtSetSensitive instead
Gerd Moellmann <gerd@gnu.org>
parents: 30571
diff changeset
180 XtSetValues (widget, al, 2);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
181 XtRemoveAllCallbacks (widget, XtNcallback);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
182 XtAddCallback (widget, XtNcallback, xaw_generic_callback, instance);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
183 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
184 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
185
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
186 void
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
187 xaw_update_one_value (instance, widget, val)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
188 widget_instance *instance;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
189 Widget widget;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
190 widget_value *val;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
191 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
192 /* This function is not used by the scrollbars and those are the only
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
193 Athena widget implemented at the moment so do nothing. */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
194 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
195 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
196
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
197 void
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
198 xaw_destroy_instance (instance)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
199 widget_instance *instance;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
200 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
201 if (XtIsSubclass (instance->widget, dialogWidgetClass))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
202 /* Need to destroy the Shell too. */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
203 XtDestroyWidget (XtParent (instance->widget));
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
204 else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
205 XtDestroyWidget (instance->widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
206 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
207
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
208 void
29465
e1023a35920f (xaw_popup_menu): Add EVENT arg.
Dave Love <fx@gnu.org>
parents: 26087
diff changeset
209 xaw_popup_menu (widget, event)
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
210 Widget widget;
29465
e1023a35920f (xaw_popup_menu): Add EVENT arg.
Dave Love <fx@gnu.org>
parents: 26087
diff changeset
211 XEvent *event;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
212 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
213 /* An Athena menubar has not been implemented. */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
214 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
215 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
216
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
217 void
48488
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
218 #ifdef PROTOTYPES
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
219 xaw_pop_instance (widget_instance *instance, Boolean up)
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
220 #else
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
221 xaw_pop_instance (instance, up)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
222 widget_instance *instance;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
223 Boolean up;
48488
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
224 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
225 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
226 Widget widget = instance->widget;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
227
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
228 if (up)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
229 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
230 if (XtIsSubclass (widget, dialogWidgetClass))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
231 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
232 /* For dialogs, we need to call XtPopup on the parent instead
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
233 of calling XtManageChild on the widget.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
234 Also we need to hack the shell's WM_PROTOCOLS to get it to
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
235 understand what the close box is supposed to do!!
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
236 */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
237 Display *dpy = XtDisplay (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
238 Widget shell = XtParent (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
239 Atom props [2];
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
240 int i = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
241 props [i++] = XInternAtom (dpy, "WM_DELETE_WINDOW", False);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
242 XChangeProperty (dpy, XtWindow (shell),
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
243 XInternAtom (dpy, "WM_PROTOCOLS", False),
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
244 XA_ATOM, 32, PropModeAppend,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
245 (unsigned char *) props, i);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
246
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
247 /* Center the widget in its parent. Why isn't this kind of crap
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
248 done automatically? I thought toolkits were supposed to make
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
249 life easier?
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
250 */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
251 {
11462
b3c30d040767 (xaw_pop_instance): Make x, y, w, h unsigned.
Richard M. Stallman <rms@gnu.org>
parents: 8785
diff changeset
252 unsigned int x, y, w, h;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
253 Widget topmost = instance->parent;
8785
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
254 Arg args[2];
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
255
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
256 w = shell->core.width;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
257 h = shell->core.height;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
258 while (topmost->core.parent && XtIsRealized (topmost->core.parent))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
259 topmost = topmost->core.parent;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
260 if (topmost->core.width < w) x = topmost->core.x;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
261 else x = topmost->core.x + ((topmost->core.width - w) / 2);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
262 if (topmost->core.height < h) y = topmost->core.y;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
263 else y = topmost->core.y + ((topmost->core.height - h) / 2);
8785
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
264 /* Using XtMoveWidget caused the widget to come
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
265 out in the wrong place with vtwm.
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
266 Question of virtual vs real coords, perhaps. */
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
267 XtSetArg (args[0], XtNx, x);
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
268 XtSetArg (args[1], XtNy, y);
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
269 XtSetValues (shell, args, 2);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
270 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
271
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
272 /* Finally, pop it up. */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
273 XtPopup (shell, XtGrabNonexclusive);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
274 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
275 else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
276 XtManageChild (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
277 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
278 else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
279 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
280 if (XtIsSubclass (widget, dialogWidgetClass))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
281 XtUnmanageChild (XtParent (widget));
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
282 else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
283 XtUnmanageChild (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
284 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
285 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
286
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
287
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
288 /* Dialog boxes */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
289
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
290 static char overrideTrans[] =
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
291 "<Message>WM_PROTOCOLS: lwlib_delete_dialog()";
53564
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
292 /* Dialogs pop down on any key press */
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
293 static char dialogOverride[] =
59085
4ee3b3653b2e * lwlib-Xaw.c: Put <KeyPress>Escape in dialogOverride so dialogs only
Jan Djärv <jan.h.d@swipnet.se>
parents: 53564
diff changeset
294 "<KeyPress>Escape: lwlib_delete_dialog()";
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
295 static void wm_delete_window();
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
296 static XtActionsRec xaw_actions [] = {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
297 {"lwlib_delete_dialog", wm_delete_window}
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
298 };
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
299 static Boolean actions_initted = False;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
300
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
301 static Widget
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
302 make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, radio_box, list, left_buttons, right_buttons)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
303 char* name;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
304 Widget parent;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
305 Boolean pop_up_p;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
306 char* shell_title;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
307 char* icon_name;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
308 Boolean text_input_slot;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
309 Boolean radio_box;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
310 Boolean list;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
311 int left_buttons;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
312 int right_buttons;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
313 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
314 Arg av [20];
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
315 int ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
316 int i, bc;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
317 char button_name [255];
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
318 Widget shell;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
319 Widget dialog;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
320 Widget button;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
321 XtTranslations override;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
322
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
323 if (! pop_up_p) abort (); /* not implemented */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
324 if (text_input_slot) abort (); /* not implemented */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
325 if (radio_box) abort (); /* not implemented */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
326 if (list) abort (); /* not implemented */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
327
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
328 if (! actions_initted)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
329 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
330 XtAppContext app = XtWidgetToApplicationContext (parent);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
331 XtAppAddActions (app, xaw_actions,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
332 sizeof (xaw_actions) / sizeof (xaw_actions[0]));
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
333 actions_initted = True;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
334 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
335
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
336 override = XtParseTranslationTable (overrideTrans);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
337
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
338 ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
339 XtSetArg (av[ac], XtNtitle, shell_title); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
340 XtSetArg (av[ac], XtNallowShellResize, True); ac++;
6623
1d60a75efa87 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6425
diff changeset
341
1d60a75efa87 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6425
diff changeset
342 /* Don't allow any geometry request from the user. */
1d60a75efa87 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6425
diff changeset
343 XtSetArg (av[ac], XtNgeometry, 0); ac++;
1d60a75efa87 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6425
diff changeset
344
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
345 shell = XtCreatePopupShell ("dialog", transientShellWidgetClass,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
346 parent, av, ac);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
347 XtOverrideTranslations (shell, override);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
348
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
349 ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
350 dialog = XtCreateManagedWidget (name, dialogWidgetClass, shell, av, ac);
53564
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
351 override = XtParseTranslationTable (dialogOverride);
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
352 XtOverrideTranslations (dialog, override);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
353
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
354 bc = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
355 button = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
356 for (i = 0; i < left_buttons; i++)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
357 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
358 ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
359 XtSetArg (av [ac], XtNfromHoriz, button); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
360 XtSetArg (av [ac], XtNleft, XtChainLeft); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
361 XtSetArg (av [ac], XtNright, XtChainLeft); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
362 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
363 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
364 XtSetArg (av [ac], XtNresizable, True); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
365 sprintf (button_name, "button%d", ++bc);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
366 button = XtCreateManagedWidget (button_name, commandWidgetClass,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
367 dialog, av, ac);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
368 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
369 if (right_buttons)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
370 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
371 /* Create a separator
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
372
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
373 I want the separator to take up the slack between the buttons on
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
374 the right and the buttons on the left (that is I want the buttons
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
375 after the separator to be packed against the right edge of the
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48488
diff changeset
376 window) but I can't seem to make it do it.
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
377 */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
378 ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
379 XtSetArg (av [ac], XtNfromHoriz, button); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
380 /* XtSetArg (av [ac], XtNfromVert, XtNameToWidget (dialog, "label")); ac++; */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
381 XtSetArg (av [ac], XtNleft, XtChainLeft); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
382 XtSetArg (av [ac], XtNright, XtChainRight); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
383 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
384 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
385 XtSetArg (av [ac], XtNlabel, ""); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
386 XtSetArg (av [ac], XtNwidth, 30); ac++; /* #### aaack!! */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
387 XtSetArg (av [ac], XtNborderWidth, 0); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
388 XtSetArg (av [ac], XtNshapeStyle, XmuShapeRectangle); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
389 XtSetArg (av [ac], XtNresizable, False); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
390 XtSetArg (av [ac], XtNsensitive, False); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
391 button = XtCreateManagedWidget ("separator",
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
392 /* labelWidgetClass, */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
393 /* This has to be Command to fake out
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
394 the Dialog widget... */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
395 commandWidgetClass,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
396 dialog, av, ac);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
397 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
398 for (i = 0; i < right_buttons; i++)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
399 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
400 ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
401 XtSetArg (av [ac], XtNfromHoriz, button); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
402 XtSetArg (av [ac], XtNleft, XtChainRight); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
403 XtSetArg (av [ac], XtNright, XtChainRight); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
404 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
405 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
406 XtSetArg (av [ac], XtNresizable, True); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
407 sprintf (button_name, "button%d", ++bc);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
408 button = XtCreateManagedWidget (button_name, commandWidgetClass,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
409 dialog, av, ac);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
410 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
411
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
412 return dialog;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
413 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
414
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
415 Widget
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
416 xaw_create_dialog (instance)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
417 widget_instance* instance;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
418 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
419 char *name = instance->info->type;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
420 Widget parent = instance->parent;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
421 Widget widget;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
422 Boolean pop_up_p = instance->pop_up_p;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
423 char *shell_name = 0;
42630
cb6cc5b71c35 (xaw_create_dialog): Initialize icon_name to suppress compiler warnings.
Pavel Janík <Pavel@Janik.cz>
parents: 41767
diff changeset
424 char *icon_name = 0;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
425 Boolean text_input_slot = False;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
426 Boolean radio_box = False;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
427 Boolean list = False;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
428 int total_buttons;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
429 int left_buttons = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
430 int right_buttons = 1;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
431
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
432 switch (name [0]) {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
433 case 'E': case 'e':
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
434 icon_name = "dbox-error";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
435 shell_name = "Error";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
436 break;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
437
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
438 case 'I': case 'i':
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
439 icon_name = "dbox-info";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
440 shell_name = "Information";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
441 break;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
442
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
443 case 'L': case 'l':
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
444 list = True;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
445 icon_name = "dbox-question";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
446 shell_name = "Prompt";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
447 break;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
448
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
449 case 'P': case 'p':
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
450 text_input_slot = True;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
451 icon_name = "dbox-question";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
452 shell_name = "Prompt";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
453 break;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
454
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
455 case 'Q': case 'q':
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
456 icon_name = "dbox-question";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
457 shell_name = "Question";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
458 break;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
459 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48488
diff changeset
460
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
461 total_buttons = name [1] - '0';
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
462
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
463 if (name [3] == 'T' || name [3] == 't')
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
464 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
465 text_input_slot = False;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
466 radio_box = True;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
467 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
468 else if (name [3])
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
469 right_buttons = name [4] - '0';
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48488
diff changeset
470
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
471 left_buttons = total_buttons - right_buttons;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48488
diff changeset
472
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
473 widget = make_dialog (name, parent, pop_up_p,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
474 shell_name, icon_name, text_input_slot, radio_box,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
475 list, left_buttons, right_buttons);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
476
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
477 return widget;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
478 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
479
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
480
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
481 static void
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
482 xaw_generic_callback (widget, closure, call_data)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
483 Widget widget;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
484 XtPointer closure;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
485 XtPointer call_data;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
486 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
487 widget_instance *instance = (widget_instance *) closure;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
488 Widget instance_widget;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
489 LWLIB_ID id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
490 XtPointer user_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
491
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
492 lw_internal_update_other_instances (widget, closure, call_data);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
493
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
494 if (! instance)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
495 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
496 if (widget->core.being_destroyed)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
497 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
498
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
499 instance_widget = instance->widget;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
500 if (!instance_widget)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
501 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
502
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
503 id = instance->info->id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
504
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
505 #if 0
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
506 user_data = NULL;
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
507 XtVaGetValues (widget, XtNuserData, &user_data, NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
508 #else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
509 /* Damn! Athena doesn't give us a way to hang our own data on the
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
510 buttons, so we have to go find it... I guess this assumes that
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
511 all instances of a button have the same call data. */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
512 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
513 widget_value *val = instance->info->val->contents;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
514 char *name = XtName (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
515 while (val)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
516 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
517 if (val->name && !strcmp (val->name, name))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
518 break;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
519 val = val->next;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
520 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
521 if (! val) abort ();
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
522 user_data = val->call_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
523 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
524 #endif
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
525
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
526 if (instance->info->selection_cb)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
527 instance->info->selection_cb (widget, id, user_data);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
528 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
529
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
530 static void
53564
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
531 wm_delete_window (w, closure, call_data)
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
532 Widget w;
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
533 XtPointer closure;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
534 XtPointer call_data;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
535 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
536 LWLIB_ID id;
25754
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
537 Cardinal nkids;
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
538 int i;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
539 Widget *kids = 0;
53564
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
540 Widget widget, shell;
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
541
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
542 if (XtIsSubclass (w, dialogWidgetClass))
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
543 shell = XtParent (w);
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
544 else
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
545 shell = w;
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
546
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
547 if (! XtIsSubclass (shell, shellWidgetClass))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
548 abort ();
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
549 XtVaGetValues (shell, XtNnumChildren, &nkids, NULL);
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
550 XtVaGetValues (shell, XtNchildren, &kids, NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
551 if (!kids || !*kids)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
552 abort ();
25754
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
553 for (i = 0; i < nkids; i++)
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
554 {
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
555 widget = kids[i];
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
556 if (XtIsSubclass (widget, dialogWidgetClass))
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
557 break;
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
558 }
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
559 id = lw_get_widget_id (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
560 if (! id) abort ();
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
561
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
562 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
563 widget_info *info = lw_get_widget_info (id);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
564 if (! info) abort ();
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
565 if (info->selection_cb)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
566 info->selection_cb (widget, id, (XtPointer) -1);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
567 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
568
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
569 lw_destroy_all_widgets (id);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
570 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
571
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
572
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
573 /* Scrollbars */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
574
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
575 #if 0
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
576 static void
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
577 xaw_scrollbar_scroll (widget, closure, call_data)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
578 Widget widget;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
579 XtPointer closure;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
580 XtPointer call_data;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
581 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
582 widget_instance *instance = (widget_instance *) closure;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
583 LWLIB_ID id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
584 scroll_event event_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
585
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
586 if (!instance || widget->core.being_destroyed)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
587 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
588
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
589 id = instance->info->id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
590 event_data.slider_value = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
591 event_data.time = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
592
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
593 if ((int) call_data > 0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
594 event_data.action = SCROLLBAR_PAGE_DOWN;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
595 else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
596 event_data.action = SCROLLBAR_PAGE_UP;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
597
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
598 if (instance->info->pre_activate_cb)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
599 instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data);
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
600 }
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
601 #endif
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
602
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
603 #if 0
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
604 static void
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
605 xaw_scrollbar_jump (widget, closure, call_data)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
606 Widget widget;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
607 XtPointer closure;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
608 XtPointer call_data;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
609 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
610 widget_instance *instance = (widget_instance *) closure;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
611 LWLIB_ID id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
612 scroll_event event_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
613 scrollbar_values *val =
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
614 (scrollbar_values *) instance->info->val->scrollbar_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
615 float percent;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
616
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
617 if (!instance || widget->core.being_destroyed)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
618 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
619
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
620 id = instance->info->id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
621
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
622 percent = * (float *) call_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
623 event_data.slider_value =
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
624 (int) (percent * (float) (val->maximum - val->minimum)) + val->minimum;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
625
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
626 event_data.time = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
627 event_data.action = SCROLLBAR_DRAG;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
628
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
629 if (instance->info->pre_activate_cb)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
630 instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data);
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
631 }
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
632 #endif
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
633
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
634 static Widget
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
635 xaw_create_scrollbar (instance)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
636 widget_instance *instance;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
637 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
638 #if 0
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
639 Arg av[20];
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
640 int ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
641 Dimension width;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
642 Widget scrollbar;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
643
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
644 XtVaGetValues (instance->parent, XtNwidth, &width, NULL);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48488
diff changeset
645
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
646 XtSetArg (av[ac], XtNshowGrip, 0); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
647 XtSetArg (av[ac], XtNresizeToPreferred, 1); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
648 XtSetArg (av[ac], XtNallowResize, True); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
649 XtSetArg (av[ac], XtNskipAdjust, True); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
650 XtSetArg (av[ac], XtNwidth, width); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
651 XtSetArg (av[ac], XtNmappedWhenManaged, True); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
652
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
653 scrollbar =
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
654 XtCreateWidget (instance->info->name, scrollbarWidgetClass,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
655 instance->parent, av, ac);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
656
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
657 /* We have to force the border width to be 0 otherwise the
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
658 geometry manager likes to start looping for awhile... */
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
659 XtVaSetValues (scrollbar, XtNborderWidth, 0, NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
660
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
661 XtRemoveAllCallbacks (scrollbar, "jumpProc");
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
662 XtRemoveAllCallbacks (scrollbar, "scrollProc");
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
663
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
664 XtAddCallback (scrollbar, "jumpProc", xaw_scrollbar_jump,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
665 (XtPointer) instance);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
666 XtAddCallback (scrollbar, "scrollProc", xaw_scrollbar_scroll,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
667 (XtPointer) instance);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
668
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
669 return scrollbar;
39721
e33afc45e39d (xaw_create_scrollbar) [!0]: Return NULL.
Gerd Moellmann <gerd@gnu.org>
parents: 36438
diff changeset
670 #else
e33afc45e39d (xaw_create_scrollbar) [!0]: Return NULL.
Gerd Moellmann <gerd@gnu.org>
parents: 36438
diff changeset
671 return NULL;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
672 #endif
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
673 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
674
8785
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
675 static Widget
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
676 xaw_create_main (instance)
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
677 widget_instance *instance;
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
678 {
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
679 Arg al[1];
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
680 int ac;
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
681
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
682 /* Create a vertical Paned to hold menubar */
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
683 ac = 0;
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
684 XtSetArg (al[ac], XtNborderWidth, 0); ac++;
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
685 return XtCreateWidget (instance->info->name, panedWidgetClass,
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
686 instance->parent, al, ac);
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
687 }
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
688
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
689 widget_creation_entry
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
690 xaw_creation_table [] =
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
691 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
692 {"scrollbar", xaw_create_scrollbar},
8785
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
693 {"main", xaw_create_main},
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
694 {NULL, NULL}
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
695 };
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
696
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
697 /* arch-tag: fbbd3589-ae1c-41a0-9142-f628cfee6564
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
698 (do not change this comment) */