annotate lwlib/lwlib-Xaw.c @ 108374:f043f612f6da

Regenerate src/config.in.
author Glenn Morris <rgm@gnu.org>
date Sat, 08 May 2010 11:42:56 -0700
parents 150fd3d78f5a
children 247a650c5ccd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1 /* The lwlib interface to Athena widgets.
76177
a274050b67b1 Add FSF copyright.
Glenn Morris <rgm@gnu.org>
parents: 64083
diff changeset
2 Copyright (C) 1993 Chuck Thompson <cthomp@cs.uiuc.edu>
a274050b67b1 Add FSF copyright.
Glenn Morris <rgm@gnu.org>
parents: 64083
diff changeset
3 Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105669
diff changeset
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
23a17af379b1 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 59085
diff changeset
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23a17af379b1 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 59085
diff changeset
21 Boston, MA 02110-1301, USA. */
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
22
26087
e0d966fb548f Add support for large files, plus some locale improvements.
Paul Eggert <eggert@twinsun.com>
parents: 25754
diff changeset
23 #ifdef HAVE_CONFIG_H
e0d966fb548f Add support for large files, plus some locale improvements.
Paul Eggert <eggert@twinsun.com>
parents: 25754
diff changeset
24 #include <config.h>
e0d966fb548f Add support for large files, plus some locale improvements.
Paul Eggert <eggert@twinsun.com>
parents: 25754
diff changeset
25 #endif
e0d966fb548f Add support for large files, plus some locale improvements.
Paul Eggert <eggert@twinsun.com>
parents: 25754
diff changeset
26
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
27 #include <stdio.h>
105669
68dd71358159 * alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100957
diff changeset
28 #include <setjmp.h>
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
29
41767
7fb1caba0f51 Include ../src/lisp.h.
Richard M. Stallman <rms@gnu.org>
parents: 39721
diff changeset
30 #include "../src/lisp.h"
7fb1caba0f51 Include ../src/lisp.h.
Richard M. Stallman <rms@gnu.org>
parents: 39721
diff changeset
31
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
32 #include "lwlib-Xaw.h"
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
33
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
34 #include <X11/StringDefs.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
35 #include <X11/IntrinsicP.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
36 #include <X11/CoreP.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
37 #include <X11/Shell.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
38
81372
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
39 #ifdef HAVE_XAW3D
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
40 #include <X11/Xaw3d/Scrollbar.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
41 #include <X11/Xaw3d/Paned.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
42 #include <X11/Xaw3d/Dialog.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
43 #include <X11/Xaw3d/Form.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
44 #include <X11/Xaw3d/Command.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
45 #include <X11/Xaw3d/Label.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
46 #else /* !HAVE_XAW3D */
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
47 #include <X11/Xaw/Scrollbar.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
48 #include <X11/Xaw/Paned.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
49 #include <X11/Xaw/Dialog.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
50 #include <X11/Xaw/Form.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
51 #include <X11/Xaw/Command.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
52 #include <X11/Xaw/Label.h>
81372
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
53 #endif /* HAVE_XAW3D */
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
54
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
55 #include <X11/Xatom.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
56
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
57 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
58 #include <X11/Xft/Xft.h>
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
59
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
60 struct widget_xft_data
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
61 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
62 Widget widget;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
63 XftFont *xft_font;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
64 XftDraw *xft_draw;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
65 XftColor xft_fg, xft_bg;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
66 int p_width, p_height;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
67 Pixmap p;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
68 };
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 #endif
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
72
6833
5a3216dd6b70 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6623
diff changeset
73 static void xaw_generic_callback (/*Widget, XtPointer, XtPointer*/);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
74
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
75
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
76 Boolean
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
77 lw_xaw_widget_p (widget)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
78 Widget widget;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
79 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
80 return (XtIsSubclass (widget, scrollbarWidgetClass) ||
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
81 XtIsSubclass (widget, dialogWidgetClass));
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
82 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
83
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
84 #if 0
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
85 static void
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
86 xaw_update_scrollbar (instance, widget, val)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
87 widget_instance *instance;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
88 Widget widget;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
89 widget_value *val;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
90 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
91 if (val->scrollbar_data)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
92 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
93 scrollbar_values *data = val->scrollbar_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
94 Dimension height, width;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
95 Dimension pos_x, pos_y;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
96 int widget_shown, widget_topOfThumb;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
97 float new_shown, new_topOfThumb;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
98
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
99 XtVaGetValues (widget,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
100 XtNheight, &height,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
101 XtNwidth, &width,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
102 XtNx, &pos_x,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
103 XtNy, &pos_y,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
104 XtNtopOfThumb, &widget_topOfThumb,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
105 XtNshown, &widget_shown,
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
106 NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
107
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
108 /*
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
109 * First size and position the scrollbar widget.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
110 * We need to position it to second-guess the Paned widget's notion
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
111 * of what should happen when the WMShell gets resized.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
112 */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
113 if (height != data->scrollbar_height || pos_y != data->scrollbar_pos)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
114 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
115 XtConfigureWidget (widget, pos_x, data->scrollbar_pos,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
116 width, data->scrollbar_height, 0);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
117
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
118 XtVaSetValues (widget,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
119 XtNlength, data->scrollbar_height,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
120 XtNthickness, width,
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
121 NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
122 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
123
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
124 /*
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
125 * Now the size the scrollbar's slider.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
126 */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
127 new_shown = (float) data->slider_size /
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
128 (float) (data->maximum - data->minimum);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
129
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
130 new_topOfThumb = (float) (data->slider_position - data->minimum) /
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
131 (float) (data->maximum - data->minimum);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
132
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
133 if (new_shown > 1.0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
134 new_shown = 1.0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
135 if (new_shown < 0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
136 new_shown = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
137
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
138 if (new_topOfThumb > 1.0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
139 new_topOfThumb = 1.0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
140 if (new_topOfThumb < 0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
141 new_topOfThumb = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
142
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
143 if (new_shown != widget_shown || new_topOfThumb != widget_topOfThumb)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
144 XawScrollbarSetThumb (widget, new_topOfThumb, new_shown);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
145 }
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
146 }
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
147 #endif
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
148
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
149 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
150 static void
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
151 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
152 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
153 Pixel bg, fg;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
154 XColor colors[2];
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
155 int screen = XScreenNumberOfScreen (XtScreen (widget));
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
156
108023
150fd3d78f5a Declarations before code (Bug#5993).
Jan D. <jan.h.d@swipnet.se>
parents: 107827
diff changeset
157 data->widget = widget;
150fd3d78f5a Declarations before code (Bug#5993).
Jan D. <jan.h.d@swipnet.se>
parents: 107827
diff changeset
158 data->xft_font = font;
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
159 XtVaGetValues (widget,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
160 XtNbackground, &bg,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
161 XtNforeground, &fg,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
162 NULL);
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 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
165 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
166 XQueryColors (XtDisplay (widget),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
167 DefaultColormapOfScreen (XtScreen (widget)),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
168 colors, 2);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
169
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
170 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
171 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
172 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
173 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
174 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
175 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
176 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
177 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
178
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
179 data->p = None;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
180 data->xft_draw = 0;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
181 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
182 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
183
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
184 static XftFont*
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
185 openFont (Widget widget, char *name)
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 char *fname = name;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
188 int screen = XScreenNumberOfScreen (XtScreen (widget));
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
189 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
190 XftFont *fn;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
191
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
192 /* 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
193 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
194 --i;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
195 if (fname[i] == ' ')
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
196 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
197 fname = xstrdup (name);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
198 fname[i] = '-';
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 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
202 if (fname != name) free (fname);
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 return fn;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
205 }
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 static int
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
208 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
209 XftFont *xft_font,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
210 int *height)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
211 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
212 int w = 0, h = 0;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
213 char *bp = text;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
214
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
215 while (bp && *bp != '\0')
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
216 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
217 XGlyphInfo gi;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
218 char *cp = strchr (bp, '\n');
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
219 XftTextExtentsUtf8 (XtDisplay (widget), xft_font,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
220 (FcChar8 *) bp,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
221 cp ? cp - bp : strlen (bp),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
222 &gi);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
223 bp = cp ? cp + 1 : NULL;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
224 h += xft_font->height;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
225 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
226 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
227
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
228 *height = h;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
229 return w;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
230 }
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 static void
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
233 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
234 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
235 Screen *sc = XtScreen (data->widget);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
236 int screen = XScreenNumberOfScreen (sc);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
237 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
238 int x = inverse ? 0 : 2;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
239 char *bp = lbl;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
240
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
241 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
242 data->p,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
243 DefaultVisual (XtDisplay (data->widget),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
244 screen),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
245 DefaultColormapOfScreen (sc));
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
246 XftDrawRect (data->xft_draw,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
247 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
248 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
249
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
250 if (!inverse) y += 2;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
251 while (bp && *bp != '\0')
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
252 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
253 char *cp = strchr (bp, '\n');
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
254 XftDrawStringUtf8 (data->xft_draw,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
255 inverse ? &data->xft_bg : &data->xft_fg,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
256 data->xft_font, x, y, bp, cp ? cp - bp : strlen (bp));
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
257 bp = cp ? cp + 1 : NULL;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
258 /* 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
259 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
260 }
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
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
265 static void
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
266 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
267 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
268 int screen = XScreenNumberOfScreen (XtScreen (data->widget));
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
269 int width, height;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
270
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
271 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
272 &height);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
273 data->p_width = width + margin;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
274 data->p_height = height + margin;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
275
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
276 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
277 XtWindow (toplevel),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
278 data->p_width,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
279 data->p_height,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
280 DefaultDepthOfScreen (XtScreen (data->widget)));
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
281 draw_text (data, lbl, 0);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
282 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
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 static struct widget_xft_data *
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
286 find_xft_data (Widget widget)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
287 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
288 widget_instance *inst = NULL;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
289 Widget parent = XtParent (widget);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
290 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
291 int nr;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
292 while (parent && !inst)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
293 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
294 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
295 parent = XtParent (parent);
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 if (!inst || !inst->xft_data || !inst->xft_data[0].xft_font) return;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
298
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
299 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
300 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
301 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
302 data = &inst->xft_data[nr];
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
303 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
304
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
305 return data;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
306 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
307
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
308 static void
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
309 command_press (Widget widget,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
310 XEvent* event,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
311 String *params,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
312 Cardinal *num_params)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
313 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
314 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
315 if (data)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
316 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
317 char *lbl;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
318 /* 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
319 XtVaSetValues (widget, XtNcornerRoundPercent, 1, NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
320
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
321 XtVaGetValues (widget, XtNlabel, &lbl, NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
322 draw_text (data, lbl, 1);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
323 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
324 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
325
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
326 static void
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
327 command_reset (Widget widget,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
328 XEvent* event,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
329 String *params,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
330 Cardinal *num_params)
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 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
333 if (data)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
334 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
335 Dimension cr;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
336 XtVaGetValues (widget, XtNcornerRoundPercent, &cr, NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
337 if (cr == 1)
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 char *lbl;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
340 XtVaSetValues (widget, XtNcornerRoundPercent, 0, NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
341 XtVaGetValues (widget, XtNlabel, &lbl, NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
342 draw_text (data, lbl, 0);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
343 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
344 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
345 }
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
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
350 void
48488
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
351 #ifdef PROTOTYPES
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
352 xaw_update_one_widget (widget_instance *instance, Widget widget,
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
353 widget_value *val, Boolean deep_p)
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
354 #else
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
355 xaw_update_one_widget (instance, widget, val, deep_p)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
356 widget_instance *instance;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
357 Widget widget;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
358 widget_value *val;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
359 Boolean deep_p;
48488
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
360 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
361 {
6425
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
362 #if 0
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
363 if (XtIsSubclass (widget, scrollbarWidgetClass))
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 xaw_update_scrollbar (instance, widget, val);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
366 }
6425
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
367 #endif
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
368 if (XtIsSubclass (widget, dialogWidgetClass))
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
369 {
107827
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 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
372 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
373 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
374 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
375 val->contents->value, 10);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
376 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
377 #endif
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
378 XtVaSetValues (widget, XtNlabel, val->contents->value, NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
379 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
380 else if (XtIsSubclass (widget, commandWidgetClass))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
381 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
382 Dimension bw = 0;
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
383 Arg al[10];
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
384 int ac = 0;
6425
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
385
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
386 XtVaGetValues (widget, XtNborderWidth, &bw, NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
387 if (bw == 0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
388 /* 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
389 Yeah, all this should really be done through app-defaults files
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
390 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
391 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
392 not look like shit is just entirely too much work.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
393 */
6425
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
394 {
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
395 XtSetArg (al[0], XtNborderWidth, 1);
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
396 XtSetValues (widget, al, 1);
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
397 }
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
398
36438
78f5e669dc5e (xaw_update_one_widget): Use XtSetSensitive instead
Gerd Moellmann <gerd@gnu.org>
parents: 30571
diff changeset
399 XtSetSensitive (widget, val->enabled);
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
400 XtSetArg (al[ac], XtNlabel, val->value);ac++;
6425
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
401 /* 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
402 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
403 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
404 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
405 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
406 int th;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
407 int nr;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
408 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
409 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
410 break;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
411 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
412 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
413 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
414 val->value, 6);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
415
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
416 /* 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
417 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
418 XtVaGetValues (widget, XtNhighlightThickness, &th, NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
419 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
420 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
421 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
422 #endif
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
423 XtSetValues (widget, al, ac);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
424 XtRemoveAllCallbacks (widget, XtNcallback);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
425 XtAddCallback (widget, XtNcallback, xaw_generic_callback, instance);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
426 }
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
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
429 void
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
430 xaw_update_one_value (instance, widget, val)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
431 widget_instance *instance;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
432 Widget widget;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
433 widget_value *val;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
434 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
435 /* 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
436 Athena widget implemented at the moment so do nothing. */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
437 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
438 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
439
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
440 void
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
441 xaw_destroy_instance (instance)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
442 widget_instance *instance;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
443 {
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
444 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
445 if (instance->xft_data)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
446 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
447 int i;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
448 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
449 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
450 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
451 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
452 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
453 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
454 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
455 NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
456 XFreePixmap (XtDisplay (instance->widget),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
457 instance->xft_data[i].p);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
458 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
459 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
460 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
461 XftFontClose (XtDisplay (instance->widget),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
462 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
463 free (instance->xft_data);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
464 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
465 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
466 if (XtIsSubclass (instance->widget, dialogWidgetClass))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
467 /* Need to destroy the Shell too. */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
468 XtDestroyWidget (XtParent (instance->widget));
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
469 else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
470 XtDestroyWidget (instance->widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
471 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
472
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
473 void
29465
e1023a35920f (xaw_popup_menu): Add EVENT arg.
Dave Love <fx@gnu.org>
parents: 26087
diff changeset
474 xaw_popup_menu (widget, event)
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
475 Widget widget;
29465
e1023a35920f (xaw_popup_menu): Add EVENT arg.
Dave Love <fx@gnu.org>
parents: 26087
diff changeset
476 XEvent *event;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
477 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
478 /* An Athena menubar has not been implemented. */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
479 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
480 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
481
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
482 void
48488
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
483 #ifdef PROTOTYPES
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
484 xaw_pop_instance (widget_instance *instance, Boolean up)
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
485 #else
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
486 xaw_pop_instance (instance, up)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
487 widget_instance *instance;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
488 Boolean up;
48488
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
489 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
490 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
491 Widget widget = instance->widget;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
492
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
493 if (up)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
494 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
495 if (XtIsSubclass (widget, dialogWidgetClass))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
496 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
497 /* For dialogs, we need to call XtPopup on the parent instead
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
498 of calling XtManageChild on the widget.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
499 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
500 understand what the close box is supposed to do!!
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
501 */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
502 Display *dpy = XtDisplay (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
503 Widget shell = XtParent (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
504 Atom props [2];
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
505 int i = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
506 props [i++] = XInternAtom (dpy, "WM_DELETE_WINDOW", False);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
507 XChangeProperty (dpy, XtWindow (shell),
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
508 XInternAtom (dpy, "WM_PROTOCOLS", False),
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
509 XA_ATOM, 32, PropModeAppend,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
510 (unsigned char *) props, i);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
511
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
512 /* 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
513 done automatically? I thought toolkits were supposed to make
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
514 life easier?
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
515 */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
516 {
11462
b3c30d040767 (xaw_pop_instance): Make x, y, w, h unsigned.
Richard M. Stallman <rms@gnu.org>
parents: 8785
diff changeset
517 unsigned int x, y, w, h;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
518 Widget topmost = instance->parent;
8785
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
519 Arg args[2];
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
520
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
521 w = shell->core.width;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
522 h = shell->core.height;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
523 while (topmost->core.parent && XtIsRealized (topmost->core.parent))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
524 topmost = topmost->core.parent;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
525 if (topmost->core.width < w) x = topmost->core.x;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
526 else x = topmost->core.x + ((topmost->core.width - w) / 2);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
527 if (topmost->core.height < h) y = topmost->core.y;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
528 else y = topmost->core.y + ((topmost->core.height - h) / 2);
8785
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
529 /* Using XtMoveWidget caused the widget to come
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
530 out in the wrong place with vtwm.
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
531 Question of virtual vs real coords, perhaps. */
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
532 XtSetArg (args[0], XtNx, x);
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
533 XtSetArg (args[1], XtNy, y);
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
534 XtSetValues (shell, args, 2);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
535 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
536
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
537 /* Finally, pop it up. */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
538 XtPopup (shell, XtGrabNonexclusive);
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 else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
541 XtManageChild (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
542 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
543 else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
544 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
545 if (XtIsSubclass (widget, dialogWidgetClass))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
546 XtUnmanageChild (XtParent (widget));
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
547 else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
548 XtUnmanageChild (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
549 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
550 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
551
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 /* Dialog boxes */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
554
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
555 static char overrideTrans[] =
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
556 "<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
557 /* 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
558 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
559 "<KeyPress>Escape: lwlib_delete_dialog()";
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
560 static void wm_delete_window();
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
561 static XtActionsRec xaw_actions [] = {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
562 {"lwlib_delete_dialog", wm_delete_window}
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
563 };
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
564 static Boolean actions_initted = False;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
565
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
566 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
567 static XtActionsRec button_actions[] =
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
568 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
569 { "my_reset", command_reset },
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
570 { "my_press", command_press },
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
571 };
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
572 char buttonTrans[] =
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
573 "<Leave>: reset() my_reset()\n"
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
574 "<Btn1Down>: set() my_press()\n"
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
575 "<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
576 #endif
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
577
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
578 static Widget
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
579 make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
580 radio_box, list, left_buttons, right_buttons, instance)
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
581 char* name;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
582 Widget parent;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
583 Boolean pop_up_p;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
584 char* shell_title;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
585 char* icon_name;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
586 Boolean text_input_slot;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
587 Boolean radio_box;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
588 Boolean list;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
589 int left_buttons;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
590 int right_buttons;
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
591 widget_instance *instance;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
592 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
593 Arg av [20];
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
594 int ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
595 int i, bc;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
596 char button_name [255];
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
597 Widget shell;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
598 Widget dialog;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
599 Widget button;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
600 XtTranslations override;
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
601 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
602 XftFont *xft_font = 0;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
603 XtTranslations button_override;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
604 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
605
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
606 if (! pop_up_p) abort (); /* not implemented */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
607 if (text_input_slot) abort (); /* not implemented */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
608 if (radio_box) abort (); /* not implemented */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
609 if (list) abort (); /* not implemented */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
610
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
611 if (! actions_initted)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
612 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
613 XtAppContext app = XtWidgetToApplicationContext (parent);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
614 XtAppAddActions (app, xaw_actions,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
615 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
616 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
617 XtAppAddActions (app, button_actions,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
618 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
619 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
620 actions_initted = True;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
621 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
622
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
623 override = XtParseTranslationTable (overrideTrans);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
624
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
625 ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
626 XtSetArg (av[ac], XtNtitle, shell_title); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
627 XtSetArg (av[ac], XtNallowShellResize, True); ac++;
6623
1d60a75efa87 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6425
diff changeset
628
1d60a75efa87 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6425
diff changeset
629 /* Don't allow any geometry request from the user. */
1d60a75efa87 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6425
diff changeset
630 XtSetArg (av[ac], XtNgeometry, 0); ac++;
1d60a75efa87 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6425
diff changeset
631
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
632 shell = XtCreatePopupShell ("dialog", transientShellWidgetClass,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
633 parent, av, ac);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
634 XtOverrideTranslations (shell, override);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
635
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
636 ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
637 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
638 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
639 XtOverrideTranslations (dialog, override);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
640
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
641 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
642 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
643 int num;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
644 Widget *ch = NULL;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
645 Widget w = 0;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
646 XtVaGetValues (dialog,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
647 XtNnumChildren, &num,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
648 XtNchildren, &ch, NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
649 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
650 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
651 if (!XtIsSubclass (ch[i], commandWidgetClass)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
652 && XtIsSubclass (ch[i], labelWidgetClass))
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
653 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
654 w = ch[i];
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
655 break;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
656 }
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 instance->xft_data = 0;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
659 instance->nr_xft_data = 0;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
660 if (w)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
661 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
662 XtResource rec[] =
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
663 { { "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
664 (XtPointer)"Sans-14" }};
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
665 char *faceName;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
666 XtVaGetSubresources (dialog, &faceName, "Dialog", "dialog",
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
667 rec, 1, 0, NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
668 if (strcmp ("none", faceName) != 0)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
669 xft_font = openFont (dialog, faceName);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
670 if (xft_font)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
671 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
672 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
673 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
674 sizeof(*instance->xft_data));
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
675
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
676 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
677 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
678 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
679
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
680 button_override = XtParseTranslationTable (buttonTrans);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
681 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
682 #endif
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
683
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
684 bc = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
685 button = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
686 for (i = 0; i < left_buttons; i++)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
687 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
688 ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
689 XtSetArg (av [ac], XtNfromHoriz, button); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
690 XtSetArg (av [ac], XtNleft, XtChainLeft); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
691 XtSetArg (av [ac], XtNright, XtChainLeft); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
692 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
693 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
694 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
695 #ifdef HAVE_XAW3D
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
696 if (DefaultDepthOfScreen (XtScreen (dialog)) >= 16)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
697 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
698 /* 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
699 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
700 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
701 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
702 sprintf (button_name, "button%d", ++bc);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
703 button = XtCreateManagedWidget (button_name, commandWidgetClass,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
704 dialog, av, ac);
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
705 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
706 if (xft_font)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
707 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
708 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
709 XtOverrideTranslations (button, button_override);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
710 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
711 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
712 }
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 for (i = 0; i < right_buttons; i++)
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 ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
717 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
718 if (i == 0)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
719 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
720 /* Separator to the other buttons. */
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
721 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
722 }
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
723 XtSetArg (av [ac], XtNleft, XtChainRight); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
724 XtSetArg (av [ac], XtNright, XtChainRight); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
725 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
726 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
727 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
728 #ifdef HAVE_XAW3D
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
729 if (DefaultDepthOfScreen (XtScreen (dialog)) >= 16)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
730 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
731 /* 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
732 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
733 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
734 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
735 sprintf (button_name, "button%d", ++bc);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
736 button = XtCreateManagedWidget (button_name, commandWidgetClass,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
737 dialog, av, ac);
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
738 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
739 if (xft_font)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
740 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
741 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
742 XtOverrideTranslations (button, button_override);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
743 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
744 #endif
6302
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
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
747 return dialog;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
748 }
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 Widget
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
751 xaw_create_dialog (instance)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
752 widget_instance* instance;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
753 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
754 char *name = instance->info->type;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
755 Widget parent = instance->parent;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
756 Widget widget;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
757 Boolean pop_up_p = instance->pop_up_p;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
758 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
759 char *icon_name = 0;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
760 Boolean text_input_slot = False;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
761 Boolean radio_box = False;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
762 Boolean list = False;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
763 int total_buttons;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
764 int left_buttons = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
765 int right_buttons = 1;
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 switch (name [0]) {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
768 case 'E': case 'e':
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
769 icon_name = "dbox-error";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
770 shell_name = "Error";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
771 break;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
772
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
773 case 'I': case 'i':
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
774 icon_name = "dbox-info";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
775 shell_name = "Information";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
776 break;
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 case 'L': case 'l':
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
779 list = True;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
780 icon_name = "dbox-question";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
781 shell_name = "Prompt";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
782 break;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
783
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
784 case 'P': case 'p':
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
785 text_input_slot = True;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
786 icon_name = "dbox-question";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
787 shell_name = "Prompt";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
788 break;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
789
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
790 case 'Q': case 'q':
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
791 icon_name = "dbox-question";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
792 shell_name = "Question";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
793 break;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
794 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48488
diff changeset
795
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
796 total_buttons = name [1] - '0';
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
797
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
798 if (name [3] == 'T' || name [3] == 't')
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
799 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
800 text_input_slot = False;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
801 radio_box = True;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
802 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
803 else if (name [3])
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
804 right_buttons = name [4] - '0';
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48488
diff changeset
805
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
806 left_buttons = total_buttons - right_buttons;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48488
diff changeset
807
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
808 widget = make_dialog (name, parent, pop_up_p,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
809 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
810 list, left_buttons, right_buttons, instance);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
811 return widget;
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
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 static void
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
816 xaw_generic_callback (widget, closure, call_data)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
817 Widget widget;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
818 XtPointer closure;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
819 XtPointer call_data;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
820 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
821 widget_instance *instance = (widget_instance *) closure;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
822 Widget instance_widget;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
823 LWLIB_ID id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
824 XtPointer user_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
825
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
826 lw_internal_update_other_instances (widget, closure, call_data);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
827
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
828 if (! instance)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
829 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
830 if (widget->core.being_destroyed)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
831 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
832
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
833 instance_widget = instance->widget;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
834 if (!instance_widget)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
835 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
836
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
837 id = instance->info->id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
838
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
839 #if 0
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
840 user_data = NULL;
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
841 XtVaGetValues (widget, XtNuserData, &user_data, NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
842 #else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
843 /* 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
844 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
845 all instances of a button have the same call data. */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
846 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
847 widget_value *val = instance->info->val->contents;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
848 char *name = XtName (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
849 while (val)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
850 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
851 if (val->name && !strcmp (val->name, name))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
852 break;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
853 val = val->next;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
854 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
855 if (! val) abort ();
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
856 user_data = val->call_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
857 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
858 #endif
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
859
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
860 if (instance->info->selection_cb)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
861 instance->info->selection_cb (widget, id, user_data);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
862 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
863
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
864 static void
53564
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
865 wm_delete_window (w, closure, call_data)
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
866 Widget w;
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
867 XtPointer closure;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
868 XtPointer call_data;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
869 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
870 LWLIB_ID id;
25754
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
871 Cardinal nkids;
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
872 int i;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
873 Widget *kids = 0;
53564
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
874 Widget widget, shell;
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
875
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
876 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
877 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
878 else
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
879 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
880
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
881 if (! XtIsSubclass (shell, shellWidgetClass))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
882 abort ();
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
883 XtVaGetValues (shell, XtNnumChildren, &nkids, NULL);
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
884 XtVaGetValues (shell, XtNchildren, &kids, NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
885 if (!kids || !*kids)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
886 abort ();
25754
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
887 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
888 {
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
889 widget = kids[i];
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
890 if (XtIsSubclass (widget, dialogWidgetClass))
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
891 break;
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
892 }
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
893 id = lw_get_widget_id (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
894 if (! id) abort ();
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
895
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
896 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
897 widget_info *info = lw_get_widget_info (id);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
898 if (! info) abort ();
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
899 if (info->selection_cb)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
900 info->selection_cb (widget, id, (XtPointer) -1);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
901 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
902
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
903 lw_destroy_all_widgets (id);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
904 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
905
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
906
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
907 /* Scrollbars */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
908
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
909 #if 0
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
910 static void
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
911 xaw_scrollbar_scroll (widget, closure, call_data)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
912 Widget widget;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
913 XtPointer closure;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
914 XtPointer call_data;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
915 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
916 widget_instance *instance = (widget_instance *) closure;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
917 LWLIB_ID id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
918 scroll_event event_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
919
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
920 if (!instance || widget->core.being_destroyed)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
921 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
922
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
923 id = instance->info->id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
924 event_data.slider_value = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
925 event_data.time = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
926
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
927 if ((int) call_data > 0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
928 event_data.action = SCROLLBAR_PAGE_DOWN;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
929 else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
930 event_data.action = SCROLLBAR_PAGE_UP;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
931
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
932 if (instance->info->pre_activate_cb)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
933 instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data);
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
934 }
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
935 #endif
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
936
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
937 #if 0
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
938 static void
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
939 xaw_scrollbar_jump (widget, closure, call_data)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
940 Widget widget;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
941 XtPointer closure;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
942 XtPointer call_data;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
943 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
944 widget_instance *instance = (widget_instance *) closure;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
945 LWLIB_ID id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
946 scroll_event event_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
947 scrollbar_values *val =
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
948 (scrollbar_values *) instance->info->val->scrollbar_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
949 float percent;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
950
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
951 if (!instance || widget->core.being_destroyed)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
952 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
953
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
954 id = instance->info->id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
955
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
956 percent = * (float *) call_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
957 event_data.slider_value =
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
958 (int) (percent * (float) (val->maximum - val->minimum)) + val->minimum;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
959
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
960 event_data.time = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
961 event_data.action = SCROLLBAR_DRAG;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
962
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
963 if (instance->info->pre_activate_cb)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
964 instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data);
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
965 }
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
966 #endif
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
967
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
968 static Widget
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
969 xaw_create_scrollbar (instance)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
970 widget_instance *instance;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
971 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
972 #if 0
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
973 Arg av[20];
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
974 int ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
975 Dimension width;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
976 Widget scrollbar;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
977
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
978 XtVaGetValues (instance->parent, XtNwidth, &width, NULL);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48488
diff changeset
979
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
980 XtSetArg (av[ac], XtNshowGrip, 0); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
981 XtSetArg (av[ac], XtNresizeToPreferred, 1); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
982 XtSetArg (av[ac], XtNallowResize, True); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
983 XtSetArg (av[ac], XtNskipAdjust, True); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
984 XtSetArg (av[ac], XtNwidth, width); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
985 XtSetArg (av[ac], XtNmappedWhenManaged, True); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
986
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
987 scrollbar =
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
988 XtCreateWidget (instance->info->name, scrollbarWidgetClass,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
989 instance->parent, av, ac);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
990
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
991 /* We have to force the border width to be 0 otherwise the
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
992 geometry manager likes to start looping for awhile... */
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
993 XtVaSetValues (scrollbar, XtNborderWidth, 0, NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
994
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
995 XtRemoveAllCallbacks (scrollbar, "jumpProc");
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
996 XtRemoveAllCallbacks (scrollbar, "scrollProc");
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
997
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
998 XtAddCallback (scrollbar, "jumpProc", xaw_scrollbar_jump,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
999 (XtPointer) instance);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1000 XtAddCallback (scrollbar, "scrollProc", xaw_scrollbar_scroll,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1001 (XtPointer) instance);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1002
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1003 return scrollbar;
39721
e33afc45e39d (xaw_create_scrollbar) [!0]: Return NULL.
Gerd Moellmann <gerd@gnu.org>
parents: 36438
diff changeset
1004 #else
e33afc45e39d (xaw_create_scrollbar) [!0]: Return NULL.
Gerd Moellmann <gerd@gnu.org>
parents: 36438
diff changeset
1005 return NULL;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1006 #endif
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1007 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1008
8785
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1009 static Widget
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1010 xaw_create_main (instance)
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1011 widget_instance *instance;
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1012 {
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1013 Arg al[1];
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1014 int ac;
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1015
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1016 /* Create a vertical Paned to hold menubar */
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1017 ac = 0;
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1018 XtSetArg (al[ac], XtNborderWidth, 0); ac++;
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1019 return XtCreateWidget (instance->info->name, panedWidgetClass,
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1020 instance->parent, al, ac);
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1021 }
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1022
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1023 widget_creation_entry
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1024 xaw_creation_table [] =
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1025 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1026 {"scrollbar", xaw_create_scrollbar},
8785
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1027 {"main", xaw_create_main},
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1028 {NULL, NULL}
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1029 };
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1030
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1031 /* arch-tag: fbbd3589-ae1c-41a0-9142-f628cfee6564
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1032 (do not change this comment) */