Mercurial > emacs
annotate lwlib/lwlib-Xaw.c @ 110717:60a469b3a72c
* lisp/gnus/gnus-art.el (gnus-next-page-map): Drop Emacs 20 compat cruft.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 02 Oct 2010 19:07:11 -0700 |
parents | 33021b778d4d |
children | 417b1e4d63cd |
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 | 2 Copyright (C) 1993 Chuck Thompson <cthomp@cs.uiuc.edu> |
3 Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, | |
106815 | 4 2007, 2008, 2009, 2010 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 | 20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
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> |
109141
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109123
diff
changeset
|
29 #include <ctype.h> |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
30 |
41767 | 31 #include "../src/lisp.h" |
32 | |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
33 #include "lwlib-Xaw.h" |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
34 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
35 #include <X11/StringDefs.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
36 #include <X11/IntrinsicP.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
37 #include <X11/CoreP.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
38 #include <X11/Shell.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
39 |
81372
66f8afbd03d5
Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents:
76177
diff
changeset
|
40 #ifdef HAVE_XAW3D |
66f8afbd03d5
Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents:
76177
diff
changeset
|
41 #include <X11/Xaw3d/Scrollbar.h> |
66f8afbd03d5
Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents:
76177
diff
changeset
|
42 #include <X11/Xaw3d/Paned.h> |
66f8afbd03d5
Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents:
76177
diff
changeset
|
43 #include <X11/Xaw3d/Dialog.h> |
66f8afbd03d5
Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents:
76177
diff
changeset
|
44 #include <X11/Xaw3d/Form.h> |
66f8afbd03d5
Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents:
76177
diff
changeset
|
45 #include <X11/Xaw3d/Command.h> |
66f8afbd03d5
Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents:
76177
diff
changeset
|
46 #include <X11/Xaw3d/Label.h> |
66f8afbd03d5
Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents:
76177
diff
changeset
|
47 #else /* !HAVE_XAW3D */ |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
48 #include <X11/Xaw/Scrollbar.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
49 #include <X11/Xaw/Paned.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
50 #include <X11/Xaw/Dialog.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
51 #include <X11/Xaw/Form.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
52 #include <X11/Xaw/Command.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
53 #include <X11/Xaw/Label.h> |
81372
66f8afbd03d5
Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents:
76177
diff
changeset
|
54 #endif /* HAVE_XAW3D */ |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
55 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
56 #include <X11/Xatom.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
57 |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
58 #ifdef HAVE_XFT |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
59 #include <X11/Xft/Xft.h> |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
60 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
61 struct widget_xft_data |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
62 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
63 Widget widget; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
64 XftFont *xft_font; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
65 XftDraw *xft_draw; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
66 XftColor xft_fg, xft_bg; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
67 int p_width, p_height; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
68 Pixmap p; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
69 }; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
70 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
71 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
72 #endif |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
73 |
109173
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
74 static void xaw_generic_callback (Widget widget, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
75 XtPointer closure, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
76 XtPointer call_data); |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
77 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
78 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
79 Boolean |
109123
384b3408c143
Convert function definitions in lwlib files to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108539
diff
changeset
|
80 lw_xaw_widget_p (Widget widget) |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
81 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
82 return (XtIsSubclass (widget, scrollbarWidgetClass) || |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
83 XtIsSubclass (widget, dialogWidgetClass)); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
84 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
85 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
86 |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
87 #ifdef HAVE_XFT |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
88 static void |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
89 fill_xft_data (struct widget_xft_data *data, Widget widget, XftFont *font) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
90 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
91 Pixel bg, fg; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
92 XColor colors[2]; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
93 |
108023
150fd3d78f5a
Declarations before code (Bug#5993).
Jan D. <jan.h.d@swipnet.se>
parents:
107827
diff
changeset
|
94 data->widget = widget; |
150fd3d78f5a
Declarations before code (Bug#5993).
Jan D. <jan.h.d@swipnet.se>
parents:
107827
diff
changeset
|
95 data->xft_font = font; |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
96 XtVaGetValues (widget, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
97 XtNbackground, &bg, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
98 XtNforeground, &fg, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
99 NULL); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
100 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
101 colors[0].pixel = data->xft_fg.pixel = fg; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
102 colors[1].pixel = data->xft_bg.pixel = bg; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
103 XQueryColors (XtDisplay (widget), |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
104 DefaultColormapOfScreen (XtScreen (widget)), |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
105 colors, 2); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
106 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
107 data->xft_fg.color.alpha = 0xFFFF; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
108 data->xft_fg.color.red = colors[0].red; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
109 data->xft_fg.color.green = colors[0].green; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
110 data->xft_fg.color.blue = colors[0].blue; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
111 data->xft_bg.color.alpha = 0xFFFF; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
112 data->xft_bg.color.red = colors[1].red; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
113 data->xft_bg.color.green = colors[1].green; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
114 data->xft_bg.color.blue = colors[1].blue; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
115 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
116 data->p = None; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
117 data->xft_draw = 0; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
118 data->p_width = data->p_height = 0; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
119 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
120 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
121 static XftFont* |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
122 openFont (Widget widget, char *name) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
123 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
124 char *fname = name; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
125 int screen = XScreenNumberOfScreen (XtScreen (widget)); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
126 int len = strlen (fname), i = len-1; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
127 XftFont *fn; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
128 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
129 /* Try to convert Gtk-syntax (Sans 9) to Xft syntax Sans-9. */ |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
130 while (i > 0 && isdigit (fname[i])) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
131 --i; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
132 if (fname[i] == ' ') |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
133 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
134 fname = xstrdup (name); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
135 fname[i] = '-'; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
136 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
137 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
138 fn = XftFontOpenName (XtDisplay (widget), screen, fname); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
139 if (fname != name) free (fname); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
140 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
141 return fn; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
142 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
143 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
144 static int |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
145 get_text_width_and_height (Widget widget, char *text, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
146 XftFont *xft_font, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
147 int *height) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
148 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
149 int w = 0, h = 0; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
150 char *bp = text; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
151 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
152 while (bp && *bp != '\0') |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
153 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
154 XGlyphInfo gi; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
155 char *cp = strchr (bp, '\n'); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
156 XftTextExtentsUtf8 (XtDisplay (widget), xft_font, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
157 (FcChar8 *) bp, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
158 cp ? cp - bp : strlen (bp), |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
159 &gi); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
160 bp = cp ? cp + 1 : NULL; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
161 h += xft_font->height; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
162 if (w < gi.width) w = gi.width; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
163 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
164 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
165 *height = h; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
166 return w; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
167 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
168 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
169 static void |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
170 draw_text (struct widget_xft_data *data, char *lbl, int inverse) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
171 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
172 Screen *sc = XtScreen (data->widget); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
173 int screen = XScreenNumberOfScreen (sc); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
174 int y = data->xft_font->ascent; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
175 int x = inverse ? 0 : 2; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
176 char *bp = lbl; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
177 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
178 data->xft_draw = XftDrawCreate (XtDisplay (data->widget), |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
179 data->p, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
180 DefaultVisual (XtDisplay (data->widget), |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
181 screen), |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
182 DefaultColormapOfScreen (sc)); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
183 XftDrawRect (data->xft_draw, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
184 inverse ? &data->xft_fg : &data->xft_bg, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
185 0, 0, data->p_width, data->p_height); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
186 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
187 if (!inverse) y += 2; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
188 while (bp && *bp != '\0') |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
189 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
190 char *cp = strchr (bp, '\n'); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
191 XftDrawStringUtf8 (data->xft_draw, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
192 inverse ? &data->xft_bg : &data->xft_fg, |
109141
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109123
diff
changeset
|
193 data->xft_font, x, y, |
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109123
diff
changeset
|
194 (FcChar8 *) bp, |
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109123
diff
changeset
|
195 cp ? cp - bp : strlen (bp)); |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
196 bp = cp ? cp + 1 : NULL; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
197 /* 1.2 gives reasonable line spacing. */ |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
198 y += data->xft_font->height * 1.2; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
199 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
200 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
201 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
202 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
203 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
204 static void |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
205 set_text (struct widget_xft_data *data, Widget toplevel, char *lbl, int margin) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
206 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
207 int width, height; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
208 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
209 width = get_text_width_and_height (data->widget, lbl, data->xft_font, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
210 &height); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
211 data->p_width = width + margin; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
212 data->p_height = height + margin; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
213 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
214 data->p = XCreatePixmap (XtDisplay (data->widget), |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
215 XtWindow (toplevel), |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
216 data->p_width, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
217 data->p_height, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
218 DefaultDepthOfScreen (XtScreen (data->widget))); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
219 draw_text (data, lbl, 0); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
220 XtVaSetValues (data->widget, XtNbitmap, data->p, NULL); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
221 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
222 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
223 static struct widget_xft_data * |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
224 find_xft_data (Widget widget) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
225 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
226 widget_instance *inst = NULL; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
227 Widget parent = XtParent (widget); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
228 struct widget_xft_data *data = NULL; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
229 int nr; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
230 while (parent && !inst) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
231 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
232 inst = lw_get_widget_instance (parent); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
233 parent = XtParent (parent); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
234 } |
109141
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109123
diff
changeset
|
235 if (!inst || !inst->xft_data || !inst->xft_data[0].xft_font) return 0; |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
236 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
237 for (nr = 0; data == NULL && nr < inst->nr_xft_data; ++nr) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
238 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
239 if (inst->xft_data[nr].widget == widget) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
240 data = &inst->xft_data[nr]; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
241 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
242 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
243 return data; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
244 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
245 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
246 static void |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
247 command_press (Widget widget, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
248 XEvent* event, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
249 String *params, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
250 Cardinal *num_params) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
251 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
252 struct widget_xft_data *data = find_xft_data (widget); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
253 if (data) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
254 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
255 char *lbl; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
256 /* Since this isn't used for rectangle buttons, use it to for armed. */ |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
257 XtVaSetValues (widget, XtNcornerRoundPercent, 1, NULL); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
258 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
259 XtVaGetValues (widget, XtNlabel, &lbl, NULL); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
260 draw_text (data, lbl, 1); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
261 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
262 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
263 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
264 static void |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
265 command_reset (Widget widget, |
109173
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
266 XEvent* event, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
267 String *params, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
268 Cardinal *num_params) |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
269 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
270 struct widget_xft_data *data = find_xft_data (widget); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
271 if (data) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
272 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
273 Dimension cr; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
274 XtVaGetValues (widget, XtNcornerRoundPercent, &cr, NULL); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
275 if (cr == 1) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
276 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
277 char *lbl; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
278 XtVaSetValues (widget, XtNcornerRoundPercent, 0, NULL); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
279 XtVaGetValues (widget, XtNlabel, &lbl, NULL); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
280 draw_text (data, lbl, 0); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
281 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
282 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
283 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
284 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
285 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
286 #endif |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
287 |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
288 void |
109173
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
289 xaw_update_one_widget (widget_instance *instance, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
290 Widget widget, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
291 widget_value *val, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
292 Boolean deep_p) |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
293 { |
6425
e884cf1153d7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6335
diff
changeset
|
294 if (XtIsSubclass (widget, dialogWidgetClass)) |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
295 { |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
296 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
297 #ifdef HAVE_XFT |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
298 if (instance->xft_data && instance->xft_data[0].xft_font) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
299 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
300 set_text (&instance->xft_data[0], instance->parent, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
301 val->contents->value, 10); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
302 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
303 #endif |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
304 XtVaSetValues (widget, XtNlabel, val->contents->value, NULL); |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
305 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
306 else if (XtIsSubclass (widget, commandWidgetClass)) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
307 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
308 Dimension bw = 0; |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
309 Arg al[10]; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
310 int ac = 0; |
6425
e884cf1153d7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6335
diff
changeset
|
311 |
30571 | 312 XtVaGetValues (widget, XtNborderWidth, &bw, NULL); |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
313 if (bw == 0) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
314 /* 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
|
315 Yeah, all this should really be done through app-defaults files |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
316 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
|
317 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
|
318 not look like shit is just entirely too much work. |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
319 */ |
6425
e884cf1153d7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6335
diff
changeset
|
320 { |
e884cf1153d7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6335
diff
changeset
|
321 XtSetArg (al[0], XtNborderWidth, 1); |
e884cf1153d7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6335
diff
changeset
|
322 XtSetValues (widget, al, 1); |
e884cf1153d7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6335
diff
changeset
|
323 } |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
324 |
36438
78f5e669dc5e
(xaw_update_one_widget): Use XtSetSensitive instead
Gerd Moellmann <gerd@gnu.org>
parents:
30571
diff
changeset
|
325 XtSetSensitive (widget, val->enabled); |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
326 XtSetArg (al[ac], XtNlabel, val->value);ac++; |
6425
e884cf1153d7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6335
diff
changeset
|
327 /* Force centered button text. Se above. */ |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
328 XtSetArg (al[ac], XtNjustify, XtJustifyCenter);ac++; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
329 #ifdef HAVE_XFT |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
330 if (instance->xft_data && instance->xft_data[0].xft_font) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
331 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
332 int th; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
333 int nr; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
334 for (nr = 0; nr < instance->nr_xft_data; ++nr) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
335 if (instance->xft_data[nr].widget == widget) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
336 break; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
337 if (nr < instance->nr_xft_data) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
338 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
339 set_text (&instance->xft_data[nr], instance->parent, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
340 val->value, 6); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
341 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
342 /* Must set internalHeight to twice the highlight thickness, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
343 or else it gets overwritten by our pixmap. Probably a bug. */ |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
344 XtVaGetValues (widget, XtNhighlightThickness, &th, NULL); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
345 XtSetArg (al[ac], XtNinternalHeight, 2*th);ac++; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
346 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
347 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
348 #endif |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
349 XtSetValues (widget, al, ac); |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
350 XtRemoveAllCallbacks (widget, XtNcallback); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
351 XtAddCallback (widget, XtNcallback, xaw_generic_callback, instance); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
352 } |
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 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
355 void |
109173
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
356 xaw_update_one_value (widget_instance *instance, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
357 Widget widget, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
358 widget_value *val) |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
359 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
360 /* 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
|
361 Athena widget implemented at the moment so do nothing. */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
362 return; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
363 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
364 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
365 void |
109123
384b3408c143
Convert function definitions in lwlib files to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108539
diff
changeset
|
366 xaw_destroy_instance (widget_instance *instance) |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
367 { |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
368 #ifdef HAVE_XFT |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
369 if (instance->xft_data) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
370 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
371 int i; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
372 for (i = 0; i < instance->nr_xft_data; ++i) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
373 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
374 if (instance->xft_data[i].xft_draw) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
375 XftDrawDestroy (instance->xft_data[i].xft_draw); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
376 if (instance->xft_data[i].p != None) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
377 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
378 XtVaSetValues (instance->xft_data[i].widget, XtNbitmap, None, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
379 NULL); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
380 XFreePixmap (XtDisplay (instance->widget), |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
381 instance->xft_data[i].p); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
382 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
383 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
384 if (instance->xft_data[0].xft_font) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
385 XftFontClose (XtDisplay (instance->widget), |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
386 instance->xft_data[0].xft_font); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
387 free (instance->xft_data); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
388 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
389 #endif |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
390 if (XtIsSubclass (instance->widget, dialogWidgetClass)) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
391 /* Need to destroy the Shell too. */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
392 XtDestroyWidget (XtParent (instance->widget)); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
393 else |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
394 XtDestroyWidget (instance->widget); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
395 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
396 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
397 void |
109123
384b3408c143
Convert function definitions in lwlib files to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108539
diff
changeset
|
398 xaw_popup_menu (Widget widget, XEvent *event) |
6302
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 /* An Athena menubar has not been implemented. */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
401 return; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
402 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
403 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
404 void |
48488
3336a76643ef
Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents:
42999
diff
changeset
|
405 xaw_pop_instance (widget_instance *instance, Boolean up) |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
406 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
407 Widget widget = instance->widget; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
408 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
409 if (up) |
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 if (XtIsSubclass (widget, dialogWidgetClass)) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
412 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
413 /* For dialogs, we need to call XtPopup on the parent instead |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
414 of calling XtManageChild on the widget. |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
415 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
|
416 understand what the close box is supposed to do!! |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
417 */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
418 Display *dpy = XtDisplay (widget); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
419 Widget shell = XtParent (widget); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
420 Atom props [2]; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
421 int i = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
422 props [i++] = XInternAtom (dpy, "WM_DELETE_WINDOW", False); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
423 XChangeProperty (dpy, XtWindow (shell), |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
424 XInternAtom (dpy, "WM_PROTOCOLS", False), |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
425 XA_ATOM, 32, PropModeAppend, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
426 (unsigned char *) props, i); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
427 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
428 /* 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
|
429 done automatically? I thought toolkits were supposed to make |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
430 life easier? |
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 { |
11462
b3c30d040767
(xaw_pop_instance): Make x, y, w, h unsigned.
Richard M. Stallman <rms@gnu.org>
parents:
8785
diff
changeset
|
433 unsigned int x, y, w, h; |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
434 Widget topmost = instance->parent; |
8785 | 435 Arg args[2]; |
436 | |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
437 w = shell->core.width; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
438 h = shell->core.height; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
439 while (topmost->core.parent && XtIsRealized (topmost->core.parent)) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
440 topmost = topmost->core.parent; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
441 if (topmost->core.width < w) x = topmost->core.x; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
442 else x = topmost->core.x + ((topmost->core.width - w) / 2); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
443 if (topmost->core.height < h) y = topmost->core.y; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
444 else y = topmost->core.y + ((topmost->core.height - h) / 2); |
8785 | 445 /* Using XtMoveWidget caused the widget to come |
446 out in the wrong place with vtwm. | |
447 Question of virtual vs real coords, perhaps. */ | |
448 XtSetArg (args[0], XtNx, x); | |
449 XtSetArg (args[1], XtNy, y); | |
450 XtSetValues (shell, args, 2); | |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
451 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
452 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
453 /* Finally, pop it up. */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
454 XtPopup (shell, XtGrabNonexclusive); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
455 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
456 else |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
457 XtManageChild (widget); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
458 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
459 else |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
460 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
461 if (XtIsSubclass (widget, dialogWidgetClass)) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
462 XtUnmanageChild (XtParent (widget)); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
463 else |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
464 XtUnmanageChild (widget); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
465 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
466 } |
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 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
469 /* Dialog boxes */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
470 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
471 static char overrideTrans[] = |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
472 "<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
|
473 /* 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
|
474 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
|
475 "<KeyPress>Escape: lwlib_delete_dialog()"; |
109141
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109123
diff
changeset
|
476 static void wm_delete_window (Widget w, |
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109123
diff
changeset
|
477 XEvent *event, |
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109123
diff
changeset
|
478 String *params, |
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109123
diff
changeset
|
479 Cardinal *num_params); |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
480 static XtActionsRec xaw_actions [] = { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
481 {"lwlib_delete_dialog", wm_delete_window} |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
482 }; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
483 static Boolean actions_initted = False; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
484 |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
485 #ifdef HAVE_XFT |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
486 static XtActionsRec button_actions[] = |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
487 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
488 { "my_reset", command_reset }, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
489 { "my_press", command_press }, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
490 }; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
491 char buttonTrans[] = |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
492 "<Leave>: reset() my_reset()\n" |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
493 "<Btn1Down>: set() my_press()\n" |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
494 "<Btn1Up>: my_reset() notify() unset()\n"; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
495 #endif |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
496 |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
497 static Widget |
109173
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
498 make_dialog (char* name, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
499 Widget parent, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
500 Boolean pop_up_p, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
501 char* shell_title, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
502 char* icon_name, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
503 Boolean text_input_slot, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
504 Boolean radio_box, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
505 Boolean list, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
506 int left_buttons, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
507 int right_buttons, |
33021b778d4d
Change function definition from K&R to prototype. Fix prototype warnings.
Jan D <jan.h.d@swipnet.se>
parents:
109171
diff
changeset
|
508 widget_instance *instance) |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
509 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
510 Arg av [20]; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
511 int ac = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
512 int i, bc; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
513 char button_name [255]; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
514 Widget shell; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
515 Widget dialog; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
516 Widget button; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
517 XtTranslations override; |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
518 #ifdef HAVE_XFT |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
519 XftFont *xft_font = 0; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
520 XtTranslations button_override; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
521 #endif |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
522 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
523 if (! pop_up_p) abort (); /* not implemented */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
524 if (text_input_slot) abort (); /* not implemented */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
525 if (radio_box) abort (); /* not implemented */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
526 if (list) abort (); /* not implemented */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
527 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
528 if (! actions_initted) |
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 XtAppContext app = XtWidgetToApplicationContext (parent); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
531 XtAppAddActions (app, xaw_actions, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
532 sizeof (xaw_actions) / sizeof (xaw_actions[0])); |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
533 #ifdef HAVE_XFT |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
534 XtAppAddActions (app, button_actions, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
535 sizeof (button_actions) / sizeof (button_actions[0])); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
536 #endif |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
537 actions_initted = True; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
538 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
539 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
540 override = XtParseTranslationTable (overrideTrans); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
541 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
542 ac = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
543 XtSetArg (av[ac], XtNtitle, shell_title); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
544 XtSetArg (av[ac], XtNallowShellResize, True); ac++; |
6623
1d60a75efa87
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6425
diff
changeset
|
545 |
1d60a75efa87
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6425
diff
changeset
|
546 /* Don't allow any geometry request from the user. */ |
1d60a75efa87
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6425
diff
changeset
|
547 XtSetArg (av[ac], XtNgeometry, 0); ac++; |
1d60a75efa87
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6425
diff
changeset
|
548 |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
549 shell = XtCreatePopupShell ("dialog", transientShellWidgetClass, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
550 parent, av, ac); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
551 XtOverrideTranslations (shell, override); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
552 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
553 ac = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
554 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
|
555 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
|
556 XtOverrideTranslations (dialog, override); |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
557 |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
558 #ifdef HAVE_XFT |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
559 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
560 int num; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
561 Widget *ch = NULL; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
562 Widget w = 0; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
563 XtVaGetValues (dialog, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
564 XtNnumChildren, &num, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
565 XtNchildren, &ch, NULL); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
566 for (i = 0; i < num; ++i) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
567 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
568 if (!XtIsSubclass (ch[i], commandWidgetClass) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
569 && XtIsSubclass (ch[i], labelWidgetClass)) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
570 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
571 w = ch[i]; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
572 break; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
573 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
574 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
575 instance->xft_data = 0; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
576 instance->nr_xft_data = 0; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
577 if (w) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
578 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
579 XtResource rec[] = |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
580 { { "faceName", "FaceName", XtRString, sizeof(String), 0, XtRString, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
581 (XtPointer)"Sans-14" }}; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
582 char *faceName; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
583 XtVaGetSubresources (dialog, &faceName, "Dialog", "dialog", |
108539
247a650c5ccd
lwlib-Xaw.c (make_dialog): Remove extra arg to XtVaGetSubresources.
Jan D <jan.h.d@swipnet.se>
parents:
108023
diff
changeset
|
584 rec, 1, (String)NULL); |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
585 if (strcmp ("none", faceName) != 0) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
586 xft_font = openFont (dialog, faceName); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
587 if (xft_font) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
588 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
589 instance->nr_xft_data = left_buttons + right_buttons + 1; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
590 instance->xft_data = calloc (instance->nr_xft_data, |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
591 sizeof(*instance->xft_data)); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
592 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
593 fill_xft_data (&instance->xft_data[0], w, xft_font); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
594 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
595 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
596 |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
597 button_override = XtParseTranslationTable (buttonTrans); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
598 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
599 #endif |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
600 |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
601 bc = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
602 button = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
603 for (i = 0; i < left_buttons; i++) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
604 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
605 ac = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
606 XtSetArg (av [ac], XtNfromHoriz, button); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
607 XtSetArg (av [ac], XtNleft, XtChainLeft); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
608 XtSetArg (av [ac], XtNright, XtChainLeft); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
609 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
610 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
611 XtSetArg (av [ac], XtNresizable, True); ac++; |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
612 #ifdef HAVE_XAW3D |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
613 if (DefaultDepthOfScreen (XtScreen (dialog)) >= 16) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
614 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
615 /* Turn of dithered shadow if we can. Looks bad */ |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
616 XtSetArg (av [ac], "beNiceToColormap", False); ac++; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
617 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
618 #endif |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
619 sprintf (button_name, "button%d", ++bc); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
620 button = XtCreateManagedWidget (button_name, commandWidgetClass, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
621 dialog, av, ac); |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
622 #ifdef HAVE_XFT |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
623 if (xft_font) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
624 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
625 fill_xft_data (&instance->xft_data[bc], button, xft_font); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
626 XtOverrideTranslations (button, button_override); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
627 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
628 #endif |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
629 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
630 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
631 for (i = 0; i < right_buttons; i++) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
632 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
633 ac = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
634 XtSetArg (av [ac], XtNfromHoriz, button); ac++; |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
635 if (i == 0) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
636 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
637 /* Separator to the other buttons. */ |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
638 XtSetArg (av [ac], XtNhorizDistance, 30); ac++; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
639 } |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
640 XtSetArg (av [ac], XtNleft, XtChainRight); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
641 XtSetArg (av [ac], XtNright, XtChainRight); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
642 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
643 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
644 XtSetArg (av [ac], XtNresizable, True); ac++; |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
645 #ifdef HAVE_XAW3D |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
646 if (DefaultDepthOfScreen (XtScreen (dialog)) >= 16) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
647 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
648 /* Turn of dithered shadow if we can. Looks bad */ |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
649 XtSetArg (av [ac], "beNiceToColormap", False); ac++; |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
650 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
651 #endif |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
652 sprintf (button_name, "button%d", ++bc); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
653 button = XtCreateManagedWidget (button_name, commandWidgetClass, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
654 dialog, av, ac); |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
655 #ifdef HAVE_XFT |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
656 if (xft_font) |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
657 { |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
658 fill_xft_data (&instance->xft_data[bc], button, xft_font); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
659 XtOverrideTranslations (button, button_override); |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
660 } |
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
661 #endif |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
662 } |
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 return dialog; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
665 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
666 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
667 Widget |
109123
384b3408c143
Convert function definitions in lwlib files to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108539
diff
changeset
|
668 xaw_create_dialog (widget_instance *instance) |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
669 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
670 char *name = instance->info->type; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
671 Widget parent = instance->parent; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
672 Widget widget; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
673 Boolean pop_up_p = instance->pop_up_p; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
674 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
|
675 char *icon_name = 0; |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
676 Boolean text_input_slot = False; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
677 Boolean radio_box = False; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
678 Boolean list = False; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
679 int total_buttons; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
680 int left_buttons = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
681 int right_buttons = 1; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
682 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
683 switch (name [0]) { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
684 case 'E': case 'e': |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
685 icon_name = "dbox-error"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
686 shell_name = "Error"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
687 break; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
688 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
689 case 'I': case 'i': |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
690 icon_name = "dbox-info"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
691 shell_name = "Information"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
692 break; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
693 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
694 case 'L': case 'l': |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
695 list = True; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
696 icon_name = "dbox-question"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
697 shell_name = "Prompt"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
698 break; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
699 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
700 case 'P': case 'p': |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
701 text_input_slot = True; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
702 icon_name = "dbox-question"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
703 shell_name = "Prompt"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
704 break; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
705 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
706 case 'Q': case 'q': |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
707 icon_name = "dbox-question"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
708 shell_name = "Question"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
709 break; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
710 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48488
diff
changeset
|
711 |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
712 total_buttons = name [1] - '0'; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
713 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
714 if (name [3] == 'T' || name [3] == 't') |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
715 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
716 text_input_slot = False; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
717 radio_box = True; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
718 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
719 else if (name [3]) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
720 right_buttons = name [4] - '0'; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48488
diff
changeset
|
721 |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
722 left_buttons = total_buttons - right_buttons; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48488
diff
changeset
|
723 |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
724 widget = make_dialog (name, parent, pop_up_p, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
725 shell_name, icon_name, text_input_slot, radio_box, |
107827
aa85632b7860
Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
726 list, left_buttons, right_buttons, instance); |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
727 return widget; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
728 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
729 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
730 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
731 static void |
109123
384b3408c143
Convert function definitions in lwlib files to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108539
diff
changeset
|
732 xaw_generic_callback (Widget widget, XtPointer closure, XtPointer call_data) |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
733 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
734 widget_instance *instance = (widget_instance *) closure; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
735 Widget instance_widget; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
736 LWLIB_ID id; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
737 XtPointer user_data; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
738 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
739 lw_internal_update_other_instances (widget, closure, call_data); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
740 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
741 if (! instance) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
742 return; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
743 if (widget->core.being_destroyed) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
744 return; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
745 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
746 instance_widget = instance->widget; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
747 if (!instance_widget) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
748 return; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
749 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
750 id = instance->info->id; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
751 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
752 /* 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
|
753 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
|
754 all instances of a button have the same call data. */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
755 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
756 widget_value *val = instance->info->val->contents; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
757 char *name = XtName (widget); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
758 while (val) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
759 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
760 if (val->name && !strcmp (val->name, name)) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
761 break; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
762 val = val->next; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
763 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
764 if (! val) abort (); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
765 user_data = val->call_data; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
766 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
767 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
768 if (instance->info->selection_cb) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
769 instance->info->selection_cb (widget, id, user_data); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
770 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
771 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
772 static void |
109141
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109123
diff
changeset
|
773 wm_delete_window (Widget w, |
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109123
diff
changeset
|
774 XEvent *event, |
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109123
diff
changeset
|
775 String *params, |
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109123
diff
changeset
|
776 Cardinal *num_params) |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
777 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
778 LWLIB_ID id; |
25754
d4de526fb0e0
(wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
779 Cardinal nkids; |
d4de526fb0e0
(wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
780 int i; |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
781 Widget *kids = 0; |
109141
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109123
diff
changeset
|
782 Widget widget = 0, shell; |
53564
609ef1718642
Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
783 |
609ef1718642
Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
784 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
|
785 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
|
786 else |
609ef1718642
Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
787 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
|
788 |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
789 if (! XtIsSubclass (shell, shellWidgetClass)) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
790 abort (); |
30571 | 791 XtVaGetValues (shell, XtNnumChildren, &nkids, NULL); |
792 XtVaGetValues (shell, XtNchildren, &kids, NULL); | |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
793 if (!kids || !*kids) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
794 abort (); |
25754
d4de526fb0e0
(wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
795 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
|
796 { |
d4de526fb0e0
(wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
797 widget = kids[i]; |
d4de526fb0e0
(wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
798 if (XtIsSubclass (widget, dialogWidgetClass)) |
d4de526fb0e0
(wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
799 break; |
d4de526fb0e0
(wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents:
14186
diff
changeset
|
800 } |
109141
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109123
diff
changeset
|
801 if (! widget) return; |
fa173b9bd9ce
Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents:
109123
diff
changeset
|
802 |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
803 id = lw_get_widget_id (widget); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
804 if (! id) abort (); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
805 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
806 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
807 widget_info *info = lw_get_widget_info (id); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
808 if (! info) abort (); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
809 if (info->selection_cb) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
810 info->selection_cb (widget, id, (XtPointer) -1); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
811 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
812 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
813 lw_destroy_all_widgets (id); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
814 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
815 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
816 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
817 |
8785 | 818 static Widget |
109123
384b3408c143
Convert function definitions in lwlib files to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108539
diff
changeset
|
819 xaw_create_main (widget_instance *instance) |
8785 | 820 { |
821 Arg al[1]; | |
822 int ac; | |
823 | |
824 /* Create a vertical Paned to hold menubar */ | |
825 ac = 0; | |
826 XtSetArg (al[ac], XtNborderWidth, 0); ac++; | |
827 return XtCreateWidget (instance->info->name, panedWidgetClass, | |
828 instance->parent, al, ac); | |
829 } | |
830 | |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
831 widget_creation_entry |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
832 xaw_creation_table [] = |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
833 { |
8785 | 834 {"main", xaw_create_main}, |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
835 {NULL, NULL} |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
836 }; |
52401 | 837 |
838 /* arch-tag: fbbd3589-ae1c-41a0-9142-f628cfee6564 | |
839 (do not change this comment) */ |