Mercurial > emacs
annotate lwlib/lwlib-Xaw.c @ 6335:fe5cb6ca692a
*** empty log message ***
author | Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr> |
---|---|
date | Mon, 14 Mar 1994 17:50:20 +0000 |
parents | f3fe542e8cd7 |
children | e884cf1153d7 |
rev | line source |
---|---|
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
1 /* The lwlib interface to Athena widgets. |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
2 Copyright (C) 1993 Chuck Thompson <cthomp@cs.uiuc.edu> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
3 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
4 This file is part of the Lucid Widget Library. |
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 The Lucid Widget Library is free software; you can redistribute it and/or |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
7 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
|
8 the Free Software Foundation; either version 1, or (at your option) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
9 any later version. |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
10 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
11 The Lucid Widget Library is distributed in the hope that it will be useful, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
14 GNU General Public License for more details. |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
15 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
16 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
|
17 along with GNU Emacs; see the file COPYING. If not, write to |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
19 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
20 #include <stdio.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
21 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
22 #include "lwlib-Xaw.h" |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
23 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
24 #include <X11/StringDefs.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
25 #include <X11/IntrinsicP.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
26 #include <X11/CoreP.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
27 #include <X11/Shell.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
28 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
29 #include <X11/Xaw/Scrollbar.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
30 #include <X11/Xaw/Paned.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
31 #include <X11/Xaw/Dialog.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
32 #include <X11/Xaw/Form.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
33 #include <X11/Xaw/Command.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
34 #include <X11/Xaw/Label.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
35 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
36 #include <X11/Xatom.h> |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
37 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
38 static void xaw_generic_callback (Widget, XtPointer, XtPointer); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
39 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
40 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
41 Boolean |
6333
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
42 lw_xaw_widget_p (widget) |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
43 Widget widget; |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
44 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
45 return (XtIsSubclass (widget, scrollbarWidgetClass) || |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
46 XtIsSubclass (widget, dialogWidgetClass)); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
47 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
48 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
49 static void |
6333
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
50 xaw_update_scrollbar (instance, widget, val) |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
51 widget_instance *instance; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
52 Widget widget; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
53 widget_value *val; |
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 #if 0 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
56 if (val->scrollbar_data) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
57 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
58 scrollbar_values *data = val->scrollbar_data; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
59 Dimension height, width; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
60 Dimension pos_x, pos_y; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
61 int widget_shown, widget_topOfThumb; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
62 float new_shown, new_topOfThumb; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
63 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
64 XtVaGetValues (widget, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
65 XtNheight, &height, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
66 XtNwidth, &width, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
67 XtNx, &pos_x, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
68 XtNy, &pos_y, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
69 XtNtopOfThumb, &widget_topOfThumb, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
70 XtNshown, &widget_shown, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
71 0); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
72 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
73 /* |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
74 * First size and position the scrollbar widget. |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
75 * 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
|
76 * of what should happen when the WMShell gets resized. |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
77 */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
78 if (height != data->scrollbar_height || pos_y != data->scrollbar_pos) |
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 XtConfigureWidget (widget, pos_x, data->scrollbar_pos, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
81 width, data->scrollbar_height, 0); |
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 XtVaSetValues (widget, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
84 XtNlength, data->scrollbar_height, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
85 XtNthickness, width, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
86 0); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
87 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
88 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
89 /* |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
90 * Now the size the scrollbar's slider. |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
91 */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
92 new_shown = (float) data->slider_size / |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
93 (float) (data->maximum - data->minimum); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
94 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
95 new_topOfThumb = (float) (data->slider_position - data->minimum) / |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
96 (float) (data->maximum - data->minimum); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
97 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
98 if (new_shown > 1.0) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
99 new_shown = 1.0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
100 if (new_shown < 0) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
101 new_shown = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
102 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
103 if (new_topOfThumb > 1.0) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
104 new_topOfThumb = 1.0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
105 if (new_topOfThumb < 0) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
106 new_topOfThumb = 0; |
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 if (new_shown != widget_shown || new_topOfThumb != widget_topOfThumb) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
109 XawScrollbarSetThumb (widget, new_topOfThumb, new_shown); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
110 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
111 #endif |
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 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
114 void |
6333
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
115 xaw_update_one_widget (instance, widget, val, deep_p) |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
116 widget_instance *instance; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
117 Widget widget; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
118 widget_value *val; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
119 Boolean deep_p; |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
120 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
121 if (XtIsSubclass (widget, scrollbarWidgetClass)) |
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 xaw_update_scrollbar (instance, widget, val); |
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 else if (XtIsSubclass (widget, dialogWidgetClass)) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
126 { |
6335
fe5cb6ca692a
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6333
diff
changeset
|
127 Arg al[1]; |
fe5cb6ca692a
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6333
diff
changeset
|
128 int ac = 0; |
fe5cb6ca692a
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6333
diff
changeset
|
129 XtSetArg (al[ac], XtNlabel, val->contents->value); ac++; |
fe5cb6ca692a
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6333
diff
changeset
|
130 XtSetValues (widget, al, ac); |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
131 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
132 else if (XtIsSubclass (widget, commandWidgetClass)) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
133 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
134 Dimension bw = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
135 XtVaGetValues (widget, XtNborderWidth, &bw, 0); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
136 if (bw == 0) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
137 /* 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
|
138 Yeah, all this should really be done through app-defaults files |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
139 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
|
140 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
|
141 not look like shit is just entirely too much work. |
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 XtVaSetValues (widget, XtNborderWidth, 1, 0); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
144 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
145 XtVaSetValues (widget, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
146 XtNlabel, val->value, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
147 XtNsensitive, val->enabled, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
148 /* Force centered button text. Se above. */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
149 XtNjustify, XtJustifyCenter, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
150 0); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
151 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
152 XtRemoveAllCallbacks (widget, XtNcallback); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
153 XtAddCallback (widget, XtNcallback, xaw_generic_callback, instance); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
154 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
155 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
156 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
157 void |
6333
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
158 xaw_update_one_value (instance, widget, val) |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
159 widget_instance *instance; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
160 Widget widget; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
161 widget_value *val; |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
162 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
163 /* 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
|
164 Athena widget implemented at the moment so do nothing. */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
165 return; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
166 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
167 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
168 void |
6333
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
169 xaw_destroy_instance (instance) |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
170 widget_instance *instance; |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
171 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
172 if (XtIsSubclass (instance->widget, dialogWidgetClass)) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
173 /* Need to destroy the Shell too. */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
174 XtDestroyWidget (XtParent (instance->widget)); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
175 else |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
176 XtDestroyWidget (instance->widget); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
177 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
178 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
179 void |
6333
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
180 xaw_popup_menu (widget) |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
181 Widget widget; |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
182 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
183 /* An Athena menubar has not been implemented. */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
184 return; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
185 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
186 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
187 void |
6333
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
188 xaw_pop_instance (instance, up) |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
189 widget_instance *instance; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
190 Boolean up; |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
191 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
192 Widget widget = instance->widget; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
193 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
194 if (up) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
195 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
196 if (XtIsSubclass (widget, dialogWidgetClass)) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
197 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
198 /* For dialogs, we need to call XtPopup on the parent instead |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
199 of calling XtManageChild on the widget. |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
200 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
|
201 understand what the close box is supposed to do!! |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
202 */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
203 Display *dpy = XtDisplay (widget); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
204 Widget shell = XtParent (widget); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
205 Atom props [2]; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
206 int i = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
207 props [i++] = XInternAtom (dpy, "WM_DELETE_WINDOW", False); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
208 XChangeProperty (dpy, XtWindow (shell), |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
209 XInternAtom (dpy, "WM_PROTOCOLS", False), |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
210 XA_ATOM, 32, PropModeAppend, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
211 (unsigned char *) props, i); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
212 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
213 /* 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
|
214 done automatically? I thought toolkits were supposed to make |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
215 life easier? |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
216 */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
217 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
218 int x, y, w, h; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
219 Widget topmost = instance->parent; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
220 w = shell->core.width; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
221 h = shell->core.height; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
222 while (topmost->core.parent && XtIsRealized (topmost->core.parent)) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
223 topmost = topmost->core.parent; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
224 if (topmost->core.width < w) x = topmost->core.x; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
225 else x = topmost->core.x + ((topmost->core.width - w) / 2); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
226 if (topmost->core.height < h) y = topmost->core.y; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
227 else y = topmost->core.y + ((topmost->core.height - h) / 2); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
228 XtMoveWidget (shell, x, y); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
229 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
230 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
231 /* Finally, pop it up. */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
232 XtPopup (shell, XtGrabNonexclusive); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
233 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
234 else |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
235 XtManageChild (widget); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
236 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
237 else |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
238 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
239 if (XtIsSubclass (widget, dialogWidgetClass)) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
240 XtUnmanageChild (XtParent (widget)); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
241 else |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
242 XtUnmanageChild (widget); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
243 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
244 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
245 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
246 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
247 /* Dialog boxes */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
248 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
249 static char overrideTrans[] = |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
250 "<Message>WM_PROTOCOLS: lwlib_delete_dialog()"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
251 static void wm_delete_window(); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
252 static XtActionsRec xaw_actions [] = { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
253 {"lwlib_delete_dialog", wm_delete_window} |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
254 }; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
255 static Boolean actions_initted = False; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
256 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
257 static Widget |
6333
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
258 make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot, radio_box, list, left_buttons, right_buttons) |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
259 char* name; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
260 Widget parent; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
261 Boolean pop_up_p; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
262 char* shell_title; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
263 char* icon_name; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
264 Boolean text_input_slot; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
265 Boolean radio_box; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
266 Boolean list; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
267 int left_buttons; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
268 int right_buttons; |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
269 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
270 Arg av [20]; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
271 int ac = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
272 int i, bc; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
273 char button_name [255]; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
274 Widget shell; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
275 Widget dialog; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
276 Widget button; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
277 XtTranslations override; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
278 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
279 if (! pop_up_p) abort (); /* not implemented */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
280 if (text_input_slot) abort (); /* not implemented */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
281 if (radio_box) abort (); /* not implemented */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
282 if (list) abort (); /* not implemented */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
283 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
284 if (! actions_initted) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
285 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
286 XtAppContext app = XtWidgetToApplicationContext (parent); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
287 XtAppAddActions (app, xaw_actions, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
288 sizeof (xaw_actions) / sizeof (xaw_actions[0])); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
289 actions_initted = True; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
290 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
291 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
292 override = XtParseTranslationTable (overrideTrans); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
293 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
294 ac = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
295 XtSetArg (av[ac], XtNtitle, shell_title); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
296 XtSetArg (av[ac], XtNallowShellResize, True); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
297 shell = XtCreatePopupShell ("dialog", transientShellWidgetClass, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
298 parent, av, ac); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
299 XtOverrideTranslations (shell, override); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
300 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
301 ac = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
302 dialog = XtCreateManagedWidget (name, dialogWidgetClass, shell, av, ac); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
303 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
304 bc = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
305 button = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
306 for (i = 0; i < left_buttons; i++) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
307 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
308 ac = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
309 XtSetArg (av [ac], XtNfromHoriz, button); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
310 XtSetArg (av [ac], XtNleft, XtChainLeft); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
311 XtSetArg (av [ac], XtNright, XtChainLeft); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
312 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
313 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
314 XtSetArg (av [ac], XtNresizable, True); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
315 sprintf (button_name, "button%d", ++bc); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
316 button = XtCreateManagedWidget (button_name, commandWidgetClass, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
317 dialog, av, ac); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
318 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
319 if (right_buttons) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
320 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
321 /* Create a separator |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
322 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
323 I want the separator to take up the slack between the buttons on |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
324 the right and the buttons on the left (that is I want the buttons |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
325 after the separator to be packed against the right edge of the |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
326 window) but I can't seem to make it do it. |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
327 */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
328 ac = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
329 XtSetArg (av [ac], XtNfromHoriz, button); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
330 /* XtSetArg (av [ac], XtNfromVert, XtNameToWidget (dialog, "label")); ac++; */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
331 XtSetArg (av [ac], XtNleft, XtChainLeft); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
332 XtSetArg (av [ac], XtNright, XtChainRight); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
333 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
334 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
335 XtSetArg (av [ac], XtNlabel, ""); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
336 XtSetArg (av [ac], XtNwidth, 30); ac++; /* #### aaack!! */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
337 XtSetArg (av [ac], XtNborderWidth, 0); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
338 XtSetArg (av [ac], XtNshapeStyle, XmuShapeRectangle); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
339 XtSetArg (av [ac], XtNresizable, False); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
340 XtSetArg (av [ac], XtNsensitive, False); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
341 button = XtCreateManagedWidget ("separator", |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
342 /* labelWidgetClass, */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
343 /* This has to be Command to fake out |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
344 the Dialog widget... */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
345 commandWidgetClass, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
346 dialog, av, ac); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
347 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
348 for (i = 0; i < right_buttons; i++) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
349 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
350 ac = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
351 XtSetArg (av [ac], XtNfromHoriz, button); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
352 XtSetArg (av [ac], XtNleft, XtChainRight); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
353 XtSetArg (av [ac], XtNright, XtChainRight); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
354 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
355 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
356 XtSetArg (av [ac], XtNresizable, True); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
357 sprintf (button_name, "button%d", ++bc); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
358 button = XtCreateManagedWidget (button_name, commandWidgetClass, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
359 dialog, av, ac); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
360 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
361 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
362 return dialog; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
363 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
364 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
365 Widget |
6333
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
366 xaw_create_dialog (instance) |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
367 widget_instance* instance; |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
368 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
369 char *name = instance->info->type; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
370 Widget parent = instance->parent; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
371 Widget widget; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
372 Boolean pop_up_p = instance->pop_up_p; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
373 char *shell_name = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
374 char *icon_name; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
375 Boolean text_input_slot = False; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
376 Boolean radio_box = False; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
377 Boolean list = False; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
378 int total_buttons; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
379 int left_buttons = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
380 int right_buttons = 1; |
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 switch (name [0]) { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
383 case 'E': case 'e': |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
384 icon_name = "dbox-error"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
385 shell_name = "Error"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
386 break; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
387 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
388 case 'I': case 'i': |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
389 icon_name = "dbox-info"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
390 shell_name = "Information"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
391 break; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
392 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
393 case 'L': case 'l': |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
394 list = True; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
395 icon_name = "dbox-question"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
396 shell_name = "Prompt"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
397 break; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
398 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
399 case 'P': case 'p': |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
400 text_input_slot = True; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
401 icon_name = "dbox-question"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
402 shell_name = "Prompt"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
403 break; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
404 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
405 case 'Q': case 'q': |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
406 icon_name = "dbox-question"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
407 shell_name = "Question"; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
408 break; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
409 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
410 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
411 total_buttons = name [1] - '0'; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
412 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
413 if (name [3] == 'T' || name [3] == 't') |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
414 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
415 text_input_slot = False; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
416 radio_box = True; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
417 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
418 else if (name [3]) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
419 right_buttons = name [4] - '0'; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
420 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
421 left_buttons = total_buttons - right_buttons; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
422 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
423 widget = make_dialog (name, parent, pop_up_p, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
424 shell_name, icon_name, text_input_slot, radio_box, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
425 list, left_buttons, right_buttons); |
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 return widget; |
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 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
430 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
431 static void |
6333
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
432 xaw_generic_callback (widget, closure, call_data) |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
433 Widget widget; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
434 XtPointer closure; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
435 XtPointer call_data; |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
436 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
437 widget_instance *instance = (widget_instance *) closure; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
438 Widget instance_widget; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
439 LWLIB_ID id; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
440 XtPointer user_data; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
441 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
442 lw_internal_update_other_instances (widget, closure, call_data); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
443 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
444 if (! instance) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
445 return; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
446 if (widget->core.being_destroyed) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
447 return; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
448 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
449 instance_widget = instance->widget; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
450 if (!instance_widget) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
451 return; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
452 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
453 id = instance->info->id; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
454 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
455 #if 0 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
456 user_data = NULL; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
457 XtVaGetValues (widget, XtNuserData, &user_data, 0); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
458 #else |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
459 /* 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
|
460 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
|
461 all instances of a button have the same call data. */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
462 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
463 widget_value *val = instance->info->val->contents; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
464 char *name = XtName (widget); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
465 while (val) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
466 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
467 if (val->name && !strcmp (val->name, name)) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
468 break; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
469 val = val->next; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
470 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
471 if (! val) abort (); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
472 user_data = val->call_data; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
473 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
474 #endif |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
475 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
476 if (instance->info->selection_cb) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
477 instance->info->selection_cb (widget, id, user_data); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
478 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
479 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
480 static void |
6333
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
481 wm_delete_window (shell, closure, call_data) |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
482 Widget shell; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
483 XtPointer closure; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
484 XtPointer call_data; |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
485 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
486 LWLIB_ID id; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
487 Widget *kids = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
488 Widget widget; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
489 if (! XtIsSubclass (shell, shellWidgetClass)) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
490 abort (); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
491 XtVaGetValues (shell, XtNchildren, &kids, 0); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
492 if (!kids || !*kids) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
493 abort (); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
494 widget = kids [0]; |
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 abort (); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
497 id = lw_get_widget_id (widget); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
498 if (! id) abort (); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
499 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
500 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
501 widget_info *info = lw_get_widget_info (id); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
502 if (! info) abort (); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
503 if (info->selection_cb) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
504 info->selection_cb (widget, id, (XtPointer) -1); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
505 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
506 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
507 lw_destroy_all_widgets (id); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
508 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
509 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
510 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
511 /* Scrollbars */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
512 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
513 static void |
6333
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
514 xaw_scrollbar_scroll (widget, closure, call_data) |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
515 Widget widget; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
516 XtPointer closure; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
517 XtPointer call_data; |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
518 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
519 #if 0 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
520 widget_instance *instance = (widget_instance *) closure; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
521 LWLIB_ID id; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
522 scroll_event event_data; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
523 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
524 if (!instance || widget->core.being_destroyed) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
525 return; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
526 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
527 id = instance->info->id; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
528 event_data.slider_value = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
529 event_data.time = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
530 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
531 if ((int) call_data > 0) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
532 event_data.action = SCROLLBAR_PAGE_DOWN; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
533 else |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
534 event_data.action = SCROLLBAR_PAGE_UP; |
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 if (instance->info->pre_activate_cb) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
537 instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
538 #endif |
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 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
541 static void |
6333
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
542 xaw_scrollbar_jump (widget, closure, call_data) |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
543 Widget widget; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
544 XtPointer closure; |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
545 XtPointer call_data; |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
546 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
547 #if 0 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
548 widget_instance *instance = (widget_instance *) closure; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
549 LWLIB_ID id; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
550 scroll_event event_data; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
551 scrollbar_values *val = |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
552 (scrollbar_values *) instance->info->val->scrollbar_data; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
553 float percent; |
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 if (!instance || widget->core.being_destroyed) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
556 return; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
557 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
558 id = instance->info->id; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
559 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
560 percent = * (float *) call_data; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
561 event_data.slider_value = |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
562 (int) (percent * (float) (val->maximum - val->minimum)) + val->minimum; |
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 event_data.time = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
565 event_data.action = SCROLLBAR_DRAG; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
566 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
567 if (instance->info->pre_activate_cb) |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
568 instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
569 #endif |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
570 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
571 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
572 static Widget |
6333
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
573 xaw_create_scrollbar (instance) |
f3fe542e8cd7
*** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6302
diff
changeset
|
574 widget_instance *instance; |
6302
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
575 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
576 #if 0 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
577 Arg av[20]; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
578 int ac = 0; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
579 Dimension width; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
580 Widget scrollbar; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
581 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
582 XtVaGetValues (instance->parent, XtNwidth, &width, 0); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
583 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
584 XtSetArg (av[ac], XtNshowGrip, 0); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
585 XtSetArg (av[ac], XtNresizeToPreferred, 1); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
586 XtSetArg (av[ac], XtNallowResize, True); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
587 XtSetArg (av[ac], XtNskipAdjust, True); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
588 XtSetArg (av[ac], XtNwidth, width); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
589 XtSetArg (av[ac], XtNmappedWhenManaged, True); ac++; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
590 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
591 scrollbar = |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
592 XtCreateWidget (instance->info->name, scrollbarWidgetClass, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
593 instance->parent, av, ac); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
594 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
595 /* 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
|
596 geometry manager likes to start looping for awhile... */ |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
597 XtVaSetValues (scrollbar, XtNborderWidth, 0, 0); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
598 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
599 XtRemoveAllCallbacks (scrollbar, "jumpProc"); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
600 XtRemoveAllCallbacks (scrollbar, "scrollProc"); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
601 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
602 XtAddCallback (scrollbar, "jumpProc", xaw_scrollbar_jump, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
603 (XtPointer) instance); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
604 XtAddCallback (scrollbar, "scrollProc", xaw_scrollbar_scroll, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
605 (XtPointer) instance); |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
606 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
607 return scrollbar; |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
608 #endif |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
609 } |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
610 |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
611 widget_creation_entry |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
612 xaw_creation_table [] = |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
613 { |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
614 {"scrollbar", xaw_create_scrollbar}, |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
615 {NULL, NULL} |
f407e83e1aa4
Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff
changeset
|
616 }; |