annotate lwlib/lwlib-Xm.c @ 94:1040fe1366ac xemacs-20-0f2

Import from CVS: tag xemacs-20-0f2
author cvs
date Mon, 13 Aug 2007 09:12:09 +0200
parents 1ce6082ce73f
children 6b37e6ddd302
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* The lwlib interface to Motif widgets.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1992, 1993, 1994 Lucid, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 This file is part of the Lucid Widget Library.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 The Lucid Widget Library is free software; you can redistribute it and/or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 modify it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 The Lucid Widget Library is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
20 Boston, MA 02111-1307, USA. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 #include <stdlib.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 #include <unistd.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 #include <string.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 #include <stdio.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 #include <limits.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 #include <X11/StringDefs.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 #include <X11/IntrinsicP.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 #include <X11/ObjectP.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 #include <X11/CoreP.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #include <X11/CompositeP.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 #include "lwlib-Xm.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 #include "lwlib-utils.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #include <Xm/Xm.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 #include <Xm/BulletinB.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 #include <Xm/CascadeB.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 #include <Xm/DrawingA.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 #include <Xm/FileSB.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 #include <Xm/Label.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 #include <Xm/List.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 #include <Xm/MenuShell.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 #include <Xm/MessageB.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 #include <Xm/PushB.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 #include <Xm/PushBG.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 #include <Xm/ArrowB.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 #include <Xm/ScrollBar.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 #include <Xm/SelectioB.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 #include <Xm/Text.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 #include <Xm/TextF.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 #include <Xm/ToggleB.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 #include <Xm/ToggleBG.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 #include <Xm/RowColumn.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 #include <Xm/ScrolledW.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 #include <Xm/Separator.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 #include <Xm/DialogS.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 #include <Xm/Form.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 #ifdef MENUBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 static void xm_pull_down_callback (Widget, XtPointer, XtPointer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 static void xm_pop_down_callback (Widget, XtPointer, XtPointer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 #endif /* 0 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 static void xm_internal_update_other_instances (Widget, XtPointer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 XtPointer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 static void xm_generic_callback (Widget, XtPointer, XtPointer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 #ifdef DIALOGS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 static void xm_nosel_callback (Widget, XtPointer, XtPointer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 #ifdef SCROLLBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 static void xm_scrollbar_callback (Widget, XtPointer, XtPointer);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 #ifdef MENUBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 xm_update_menu (widget_instance* instance, Widget widget, widget_value* val,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 Boolean deep_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 /* Structures to keep destroyed instances */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 typedef struct _destroyed_instance
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 char* name;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 char* type;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 Widget widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 Widget parent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 Boolean pop_up_p;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 struct _destroyed_instance* next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 } destroyed_instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 static destroyed_instance*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 all_destroyed_instances = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 /* Utility function. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 static char *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 safe_strdup (char* s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 char *result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 if (! s) return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 result = (char *) malloc (strlen (s) + 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 if (! result)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 strcpy (result, s);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 return result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 static destroyed_instance*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 make_destroyed_instance (char* name, char* type, Widget widget, Widget parent,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 Boolean pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 {
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
114 destroyed_instance* instance =
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
115 (destroyed_instance*) malloc (sizeof (destroyed_instance));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 instance->name = safe_strdup (name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 instance->type = safe_strdup (type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 instance->widget = widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 instance->parent = parent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 instance->pop_up_p = pop_up_p;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 instance->next = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 return instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 free_destroyed_instance (destroyed_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 free (instance->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 free (instance->type);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 free (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 /* motif utility functions */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 first_child (Widget widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 return ((CompositeWidget)widget)->composite.children [0];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 Boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 lw_motif_widget_p (Widget widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 return
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 #ifdef DIALOGS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 XtClass (widget) == xmDialogShellWidgetClass ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 XmIsPrimitive (widget) || XmIsManager (widget) || XmIsGadget (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 static char *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 resource_string (Widget widget, char *name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 XtResource resource;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 char *result = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
156 resource.resource_name = "labelString";
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
157 resource.resource_class = "LabelString"; /* #### should be Xmsomething... */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 resource.resource_type = XtRString;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 resource.resource_size = sizeof (String);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 resource.resource_offset = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 resource.default_type = XtRImmediate;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 resource.default_addr = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 XtGetSubresources (widget, (XtPointer)&result, name,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 name, &resource, 1, NULL, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 return result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 #ifdef MENUBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 destroy_all_children (Widget widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 Widget* children;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 unsigned int number;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 children = XtCompositeChildren (widget, &number);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 if (children)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 /* Unmanage all children and destroy them. They will only be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 * really destroyed when we get out of DispatchEvent. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 for (i = 0; i < number; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 Widget child = children [i];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 if (!child->core.being_destroyed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 XtUnmanageChild (child);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 XtDestroyWidget (child);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 XtFree ((char *) children);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 #endif /* MENUBARS_MOTIF */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 #ifdef DIALOGS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 static Boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 is_in_dialog_box (Widget w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 Widget wmshell;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 wmshell = XtParent (w);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 while (wmshell && (XtClass (wmshell) != xmDialogShellWidgetClass))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 wmshell = XtParent (wmshell);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 if (wmshell && XtClass (wmshell) == xmDialogShellWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 return True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 return False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 #endif /* DIALOGS_MOTIF */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 #if defined (DIALOGS_MOTIF) || defined (MENUBARS_MOTIF)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 /* update the label of anything subclass of a label */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 xm_update_label (widget_instance* instance, Widget widget, widget_value* val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 XmString built_string = 0;
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
226 XmString key_string = 0;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
227 XmString val_string = 0;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
228 XmString name_string = 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 Arg al [256];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 int ac;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 ac = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 if (val->value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 #ifdef DIALOGS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 * Sigh. The main text of a label is the name field for menubar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 * entries. The value field is a possible additional field to be
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
240 * concatenated on to the name field. HOWEVER, with dialog boxes
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 * the value field is the complete text which is supposed to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 * displayed as the label. Yuck.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 if (is_in_dialog_box (widget))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 char *value_name = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 value_name = resource_string (widget, val->value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 if (!value_name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 value_name = val->value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 built_string =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 XmStringCreateLtoR (value_name, XmSTRING_DEFAULT_CHARSET);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 char *value_name = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 char *res_name = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 res_name = resource_string (widget, val->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 if (!res_name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 res_name = val->name;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 name_string =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 XmStringCreateLtoR (res_name, XmSTRING_DEFAULT_CHARSET);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 value_name = XtMalloc (strlen (val->value) + 2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 *value_name = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 strcat (value_name, " ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 strcat (value_name, val->value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 val_string =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 XmStringCreateLtoR (value_name, XmSTRING_DEFAULT_CHARSET);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 built_string =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 XmStringConcat (name_string, val_string);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 XtFree (value_name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 XtSetArg (al [ac], XmNlabelString, built_string); ac++;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
283 XtSetArg (al [ac], XmNlabelType, XmSTRING); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 if (val->key)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 key_string = XmStringCreateLtoR (val->key, XmSTRING_DEFAULT_CHARSET);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 XtSetArg (al [ac], XmNacceleratorText, key_string); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 if (ac)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 XtSetValues (widget, al, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 if (built_string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 XmStringFree (built_string);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 if (key_string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 XmStringFree (key_string);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 if (name_string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 XmStringFree (name_string);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 #endif /* defined (DIALOGS_MOTIF) || defined (MENUBARS_MOTIF) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 /* update of list */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 xm_update_list (widget_instance* instance, Widget widget, widget_value* val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 widget_value* cur;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 XtRemoveAllCallbacks (widget, XmNsingleSelectionCallback);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 XtAddCallback (widget, XmNsingleSelectionCallback, xm_generic_callback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 for (cur = val->contents, i = 0; cur; cur = cur->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 if (cur->value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 XmString xmstr = XmStringCreate (cur->value, XmSTRING_DEFAULT_CHARSET);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 i += 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 XmListAddItem (widget, xmstr, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 if (cur->selected)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 XmListSelectPos (widget, i, False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 XmStringFree (xmstr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 /* update of buttons */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 xm_update_pushbutton (widget_instance* instance, Widget widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 widget_value* val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 XtVaSetValues (widget, XmNalignment, XmALIGNMENT_CENTER, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 XtRemoveAllCallbacks (widget, XmNactivateCallback);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 #ifdef MENUBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 xm_update_cascadebutton (widget_instance* instance, Widget widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 widget_value* val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 /* Should also rebuild the menu by calling ...update_menu... */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 if (val
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 && val->type == CASCADE_TYPE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 && val->contents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 && val->contents->type == INCREMENTAL_TYPE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 /* okay, we're now doing a lisp callback to incrementally generate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 more of the menu. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 XtRemoveAllCallbacks (widget, XmNcascadingCallback);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 XtAddCallback (widget, XmNcascadingCallback, xm_pull_down_callback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 XtCallCallbacks ((Widget)widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 XmNcascadingCallback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (XtPointer)val->contents);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 } else {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 XtRemoveAllCallbacks (widget, XmNcascadingCallback);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 XtAddCallback (widget, XmNcascadingCallback, xm_pull_down_callback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 #endif /* MENUBARS_MOTIF */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 /* update toggle and radiobox */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 xm_update_toggle (widget_instance* instance, Widget widget, widget_value* val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 XtRemoveAllCallbacks (widget, XmNvalueChangedCallback);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 #ifndef ENERGIZE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 XtAddCallback (widget, XmNvalueChangedCallback, xm_generic_callback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 XtAddCallback (widget, XmNvalueChangedCallback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 xm_internal_update_other_instances, instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 XtVaSetValues (widget, XmNset, val->selected,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 XmNalignment, XmALIGNMENT_BEGINNING, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 xm_update_radiobox (widget_instance* instance, Widget widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 widget_value* val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 Widget toggle;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 widget_value* cur;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 /* update the callback */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 XtRemoveAllCallbacks (widget, XmNentryCallback);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 XtAddCallback (widget, XmNentryCallback, xm_generic_callback, instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 /* first update all the toggles */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 /* Energize kernel interface is currently bad. It sets the selected widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 with the selected flag but returns it by its name. So we currently
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 have to support both setting the selection with the selected slot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 of val contents and setting it with the "value" slot of val. The latter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 has a higher priority. This to be removed when the kernel is fixed. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 for (cur = val->contents; cur; cur = cur->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 toggle = XtNameToWidget (widget, cur->value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 if (toggle)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 XtVaSetValues (toggle, XmNsensitive, cur->enabled, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 if (!val->value && cur->selected)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 XtVaSetValues (toggle, XmNset, cur->selected, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 if (val->value && strcmp (val->value, cur->value))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 XtVaSetValues (toggle, XmNset, False, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 /* The selected was specified by the value slot */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 if (val->value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 toggle = XtNameToWidget (widget, val->value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 if (toggle)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 XtVaSetValues (toggle, XmNset, True, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 #ifdef MENUBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 /* update a popup menu, pulldown menu or a menubar */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 make_menu_in_widget (widget_instance* instance, Widget widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 widget_value* val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 Widget* children = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 int num_children;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 int child_index;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 widget_value* cur;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 Widget button = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 Widget menu;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 Arg al [256];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 int ac;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 Boolean menubar_p;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 /* Allocate the children array */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 for (num_children = 0, cur = val; cur; num_children++, cur = cur->next);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 children = (Widget*)XtMalloc (num_children * sizeof (Widget));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 /* tricky way to know if this RowColumn is a menubar or a pulldown... */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 menubar_p = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 XtVaGetValues (widget, XmNisHomogeneous, &menubar_p, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 /* add the unmap callback for popups and pulldowns */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 /*** this sounds bogus ***/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 /* probably because it is -- cet */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 if (!menubar_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 XtAddCallback (XtParent (widget), XmNpopdownCallback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 xm_pop_down_callback, (XtPointer)instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 num_children = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 for (child_index = 0, cur = val; cur; child_index++, cur = cur->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 ac = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 button = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
462 XtSetArg (al [ac], XmNsensitive, cur->enabled); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
463 XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
464 XtSetArg (al [ac], XmNuserData, cur->call_data); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 switch (cur->type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 case PUSHRIGHT_TYPE:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 /* A pushright marker which is not needed for the real Motif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 menubar. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 case SEPARATOR_TYPE:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 ac = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 if (cur->value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 /* #### - xlwmenu.h supports several types that motif does
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 not. Also, motif supports pixmaps w/ type NO_LINE and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 lwlib provides no way to access that functionality. --Stig */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 XtSetArg (al [ac], XmNseparatorType, cur->value), ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 button = XmCreateSeparator (widget, "separator", al, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 case CASCADE_TYPE:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 menu = XmCreatePulldownMenu (widget, "pulldown", NULL, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 make_menu_in_widget (instance, menu, cur->contents);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 XtSetArg (al [ac], XmNsubMenuId, menu); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 button = XmCreateCascadeButton (widget, cur->name, al, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 xm_update_label (instance, button, cur);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 XtAddCallback (button, XmNcascadingCallback, xm_pull_down_callback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (XtPointer)instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 if (menubar_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 button = XmCreateCascadeButton (widget, cur->name, al, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 else if (!cur->call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 button = XmCreateLabel (widget, cur->name, al, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 else if (cur->type == TOGGLE_TYPE || cur->type == RADIO_TYPE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 if (cur->type == TOGGLE_TYPE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 XtSetArg (al [ac], XmNindicatorType, XmN_OF_MANY); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 XtSetArg (al [ac], XmNindicatorType, XmONE_OF_MANY); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 XtSetArg (al [ac], XmNvisibleWhenOff, True); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 button = XmCreateToggleButtonGadget (widget, cur->name, al, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 button = XmCreatePushButtonGadget (widget, cur->name, al, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 xm_update_label (instance, button, cur);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 /* don't add a callback to a simple label */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 if (cur->type == TOGGLE_TYPE || cur->type == RADIO_TYPE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 xm_update_toggle (instance, button, cur);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 else if (cur->call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 XtAddCallback (button, XmNactivateCallback, xm_generic_callback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 (XtPointer)instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 } /* switch (cur->type) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 if (button)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 children [num_children++] = button;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 /* Last entry is the help button. This used be done after managing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 the buttons. The comment claimed that it had to be done this way
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 otherwise the menubar ended up only 4 pixels high. That must
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 have been in the Old World. In the New World it stays the proper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 height if you don't manage them until after you set this and as a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 bonus the Help menu ends up where it is supposed to. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 if (button)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 ac = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 XtSetArg (al [ac], XmNmenuHelpWidget, button); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 XtSetValues (widget, al, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 if (num_children)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 XtManageChildren (children, num_children);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 XtFree ((char *) children);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 update_one_menu_entry (widget_instance* instance, Widget widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 widget_value* val, Boolean deep_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 Arg al [256];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 int ac;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 Widget menu;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 widget_value* contents;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 if (val->change == NO_CHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 /* update the sensitivity and userdata */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 /* Common to all widget types */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 XtVaSetValues (widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 XmNsensitive, val->enabled,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 XmNuserData, val->call_data,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 /* update the menu button as a label. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 if (val->change >= VISIBLE_CHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 xm_update_label (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 if (XtClass (widget) == xmToggleButtonWidgetClass
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 || XtClass (widget) == xmToggleButtonGadgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 xm_update_toggle (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 /* update the pulldown/pullaside as needed */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 menu = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 XtVaGetValues (widget, XmNsubMenuId, &menu, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 contents = val->contents;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 if (!menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 if (contents)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 menu = XmCreatePulldownMenu (widget, "pulldown", NULL, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 make_menu_in_widget (instance, menu, contents);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 ac = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 XtSetArg (al [ac], XmNsubMenuId, menu); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 XtSetValues (widget, al, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 else if (!contents)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 ac = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 XtSetArg (al [ac], XmNsubMenuId, NULL); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 XtSetValues (widget, al, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 XtDestroyWidget (menu);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 else if (deep_p && contents->change != NO_CHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 xm_update_menu (instance, menu, val, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 xm_update_menu (widget_instance* instance, Widget widget, widget_value* val,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 Boolean deep_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 /* Widget is a RowColumn widget whose contents have to be updated
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 * to reflect the list of items in val->contents */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 if (val->contents->change == STRUCTURAL_CHANGE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 destroy_all_children (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 make_menu_in_widget (instance, widget, val->contents);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 /* Update all the buttons of the RowColumn in order. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 Widget* children;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 unsigned int num_children;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 widget_value *cur = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 children = XtCompositeChildren (widget, &num_children);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 if (children)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 for (i = 0, cur = val->contents; i < num_children; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 if (!cur)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 /* skip if this is a pushright marker or a separator */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 if (cur->type == PUSHRIGHT_TYPE || cur->type == SEPARATOR_TYPE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 cur = cur->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 /* #### - this could puke if you have a separator as the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 last item on a pullright menu. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 if (!cur)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 if (!cur)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 continue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 if (children [i]->core.being_destroyed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 || strcmp (XtName (children [i]), cur->name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 continue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 update_one_menu_entry (instance, children [i], cur, deep_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 cur = cur->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 XtFree ((char *) children);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 if (cur)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 #endif /* MENUBARS_MOTIF */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 #ifdef DIALOGS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 /* update text widgets */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 xm_update_text (widget_instance* instance, Widget widget, widget_value* val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 {
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
671 XmTextSetString (widget, val->value ? val->value : "");
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 XtRemoveAllCallbacks (widget, XmNactivateCallback);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 XtRemoveAllCallbacks (widget, XmNvalueChangedCallback);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 XtAddCallback (widget, XmNvalueChangedCallback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 xm_internal_update_other_instances, instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 xm_update_text_field (widget_instance* instance, Widget widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 widget_value* val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 {
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
683 XmTextFieldSetString (widget, val->value ? val->value : "");
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 XtRemoveAllCallbacks (widget, XmNactivateCallback);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 XtAddCallback (widget, XmNactivateCallback, xm_generic_callback, instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 XtRemoveAllCallbacks (widget, XmNvalueChangedCallback);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 XtAddCallback (widget, XmNvalueChangedCallback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 xm_internal_update_other_instances, instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 #endif /* DIALOGS_MOTIF */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 #ifdef SCROLLBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 * If this function looks like it does a lot more work than it needs to,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 * you're right. Blame the Motif scrollbar for not being smart about
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 * updating its appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 xm_update_scrollbar (widget_instance *instance, Widget widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 widget_value *val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 if (val->scrollbar_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 scrollbar_values *data = val->scrollbar_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 int widget_sliderSize, widget_val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 int new_sliderSize, new_value;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 double percent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 double h_water, l_water;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 * First size and position the scrollbar widget.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 XtVaSetValues (widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 XtNx, data->scrollbar_x,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 XtNy, data->scrollbar_y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 XtNwidth, data->scrollbar_width,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 XtNheight, data->scrollbar_height,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 * Now the size the scrollbar's slider.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 XtVaGetValues (widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 XmNsliderSize, &widget_sliderSize,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 XmNvalue, &widget_val,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 percent = (double) data->slider_size /
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 (double) (data->maximum - data->minimum);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 new_sliderSize = (int) ((double) (INT_MAX - 1) * percent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 percent = (double) (data->slider_position - data->minimum) /
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 (double) (data->maximum - data->minimum);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 new_value = (int) ((double) (INT_MAX - 1) * percent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 if (new_sliderSize > (INT_MAX - 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 new_sliderSize = INT_MAX - 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 if (new_sliderSize < 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 new_sliderSize = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 if (new_value > (INT_MAX - new_sliderSize))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 new_value = INT_MAX - new_sliderSize;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 else if (new_value < 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 new_value = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 h_water = 1.05;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 l_water = 0.95;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 if (new_sliderSize != widget_sliderSize || new_value != widget_val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 int force = ((INT_MAX - widget_sliderSize - widget_val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 ? 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 : (INT_MAX - new_sliderSize - new_value));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 if (force
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 || (double)new_sliderSize < (l_water * (double)widget_sliderSize)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 || (double)new_sliderSize > (h_water * (double)widget_sliderSize)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 || (double)new_value < (l_water * (double)widget_val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 || (double)new_value > (h_water * (double)widget_val))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 XmScrollBarSetValues (widget, new_value, new_sliderSize, 1, 1,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 #endif /* SCROLLBARS_MOTIF */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 /* update a motif widget */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 xm_update_one_widget (widget_instance* instance, Widget widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 widget_value* val, Boolean deep_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 WidgetClass class;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 /* Mark as not edited */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 val->edited = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 /* Common to all widget types */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 XtVaSetValues (widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 XmNsensitive, val->enabled,
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
787 XmNuserData, val->call_data,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 #if defined (DIALOGS_MOTIF) || defined (MENUBARS_MOTIF)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 /* Common to all label like widgets */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 if (XtIsSubclass (widget, xmLabelWidgetClass))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 xm_update_label (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 class = XtClass (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 /* Class specific things */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 if (class == xmPushButtonWidgetClass ||
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 class == xmArrowButtonWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 xm_update_pushbutton (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 #ifdef MENUBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 else if (class == xmCascadeButtonWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 xm_update_cascadebutton (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 else if (class == xmToggleButtonWidgetClass
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 || class == xmToggleButtonGadgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 xm_update_toggle (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 else if (class == xmRowColumnWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 Boolean radiobox = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 XtVaGetValues (widget, XmNradioBehavior, &radiobox, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 if (radiobox)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 xm_update_radiobox (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 #ifdef MENUBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 xm_update_menu (instance, widget, val, deep_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 #ifdef DIALOGS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 else if (class == xmTextWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 xm_update_text (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 else if (class == xmTextFieldWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 xm_update_text_field (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 else if (class == xmListWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 xm_update_list (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 #ifdef SCROLLBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 else if (class == xmScrollBarWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 xm_update_scrollbar (instance, widget, val);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 /* getting the value back */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 xm_update_one_value (widget_instance* instance, Widget widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 widget_value* val)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 WidgetClass class = XtClass (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 widget_value *old_wv;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 /* copy the call_data slot into the "return" widget_value */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 for (old_wv = instance->info->val->contents; old_wv; old_wv = old_wv->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 if (!strcmp (val->name, old_wv->name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 val->call_data = old_wv->call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 if (class == xmToggleButtonWidgetClass || class == xmToggleButtonGadgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 XtVaGetValues (widget, XmNset, &val->selected, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 val->edited = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 #ifdef DIALOGS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 else if (class == xmTextWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 if (val->value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 free (val->value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 val->value = XmTextGetString (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 val->edited = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 else if (class == xmTextFieldWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 if (val->value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 free (val->value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 val->value = XmTextFieldGetString (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 val->edited = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 else if (class == xmRowColumnWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 Boolean radiobox = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 XtVaGetValues (widget, XmNradioBehavior, &radiobox, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 if (radiobox)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 CompositeWidget radio = (CompositeWidget)widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 for (i = 0; i < radio->composite.num_children; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 int set = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 Widget toggle = radio->composite.children [i];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 XtVaGetValues (toggle, XmNset, &set, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 if (set)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 if (val->value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 free (val->value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 val->value = safe_strdup (XtName (toggle));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 val->edited = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 else if (class == xmListWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 int pos_cnt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 int* pos_list;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 if (XmListGetSelectedPos (widget, &pos_list, &pos_cnt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 widget_value* cur;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 for (cur = val->contents, i = 0; cur; cur = cur->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 if (cur->value)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 int j;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 cur->selected = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 i += 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 for (j = 0; j < pos_cnt; j++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 if (pos_list [j] == i)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 cur->selected = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 val->value = safe_strdup (cur->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 val->edited = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 XtFree ((char *) pos_list);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 #ifdef SCROLLBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 else if (class == xmScrollBarWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 /* This function is not used by the scrollbar. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 /* This function is for activating a button from a program. It's wrong because
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 we pass a NULL argument in the call_data which is not Motif compatible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 This is used from the XmNdefaultAction callback of the List widgets to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 have a dble-click put down a dialog box like the button woudl do.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 I could not find a way to do that with accelerators.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 activate_button (Widget widget, XtPointer closure, XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 Widget button = (Widget)closure;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 XtCallCallbacks (button, XmNactivateCallback, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 /* creation functions */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 #ifdef DIALOGS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 /* dialogs */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 #if (XmVersion >= 1002)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 # define ARMANDACTIVATE_KLUDGE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 # define DND_KLUDGE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 #ifdef ARMANDACTIVATE_KLUDGE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 /* We want typing Return at a dialog box to select the default button; but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 we're satisfied with having it select the leftmost button instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 In Motif 1.1.5 we could do this by putting this resource in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 app-defaults file:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 *dialog*button1.accelerators:#override\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 <KeyPress>Return: ArmAndActivate()\n\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 <KeyPress>KP_Enter: ArmAndActivate()\n\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 Ctrl<KeyPress>m: ArmAndActivate()\n
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 but that doesn't work with 1.2.1 and I don't understand why. However,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 doing the equivalent C code does work, with the notable disadvantage that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 the user can't override it. So that's what we do until we figure out
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 something better....
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 static char button_trans[] = "\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 <KeyPress>Return: ArmAndActivate()\n\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 <KeyPress>KP_Enter: ArmAndActivate()\n\
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 Ctrl<KeyPress>m: ArmAndActivate()\n";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 #endif /* ARMANDACTIVATE_KLUDGE */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 #ifdef DND_KLUDGE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 /* This is a kludge to disable drag-and-drop in dialog boxes. The symptom
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 was a segv down in libXm somewhere if you used the middle button on a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 dialog box to begin a drag; when you released the button to make a drop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 things would lose if you were not over the button where you started the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 drag (canceling the operation). This was probably due to the fact that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 the dialog boxes were not set up to handle a drag but were trying to do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 so anyway for some reason.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 So we disable drag-and-drop in dialog boxes by turning off the binding for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 Btn2Down which, by default, initiates a drag. Clearly this is a shitty
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 solution as it only works in default configurations, but...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 static char disable_dnd_trans[] = "<Btn2Down>: ";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 #endif /* DND_KLUDGE */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 make_dialog (char* name, Widget parent, Boolean pop_up_p,
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1015 CONST char* shell_title, CONST char* icon_name,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1016 Boolean text_input_slot, Boolean radio_box, Boolean list,
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 int left_buttons, int right_buttons)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 Widget result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 Widget form;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 Widget row;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 Widget icon;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 Widget icon_separator;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 Widget message;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 Widget value = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 Widget separator;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 Widget button = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 Widget children [16]; /* for the final XtManageChildren */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 int n_children;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 Arg al[64]; /* Arg List */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 int ac; /* Arg Count */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 #ifdef DND_KLUDGE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 XtTranslations dnd_override = XtParseTranslationTable (disable_dnd_trans);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 # define DO_DND_KLUDGE(widget) XtOverrideTranslations ((widget), dnd_override)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 #else /* ! DND_KLUDGE */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 # define DO_DND_KLUDGE(widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 #endif /* ! DND_KLUDGE */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 if (pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 ac = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1044 XtSetArg(al[ac], XmNtitle, shell_title); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1045 XtSetArg(al[ac], XtNallowShellResize, True); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1046 XtSetArg(al[ac], XmNdeleteResponse, XmUNMAP); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1047 result = XmCreateDialogShell (parent, "dialog", al, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1049 XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 /* XtSetArg(al[ac], XmNautoUnmanage, TRUE); ac++; */ /* ####is this ok? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++;
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1052 form = XmCreateForm (result, (char *) shell_title, al, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 ac = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1057 XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++;
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1059 form = XmCreateForm (parent, (char *) shell_title, al, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 result = form;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 ac = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1064 XtSetArg(al[ac], XmNpacking, XmPACK_COLUMN); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1065 XtSetArg(al[ac], XmNorientation, XmVERTICAL); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 XtSetArg(al[ac], XmNnumColumns, left_buttons + right_buttons + 1); ac++;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1067 XtSetArg(al[ac], XmNmarginWidth, 0); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1068 XtSetArg(al[ac], XmNmarginHeight, 0); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1069 XtSetArg(al[ac], XmNspacing, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1070 XtSetArg(al[ac], XmNadjustLast, False); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1071 XtSetArg(al[ac], XmNalignment, XmALIGNMENT_CENTER); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1072 XtSetArg(al[ac], XmNisAligned, True); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1073 XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1074 XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_FORM); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1075 XtSetArg(al[ac], XmNbottomOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1076 XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1077 XtSetArg(al[ac], XmNleftOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1078 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1079 XtSetArg(al[ac], XmNrightOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1080 row = XmCreateRowColumn (form, "row", al, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 n_children = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 for (i = 0; i < left_buttons; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 char button_name [16];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 sprintf (button_name, "button%d", i + 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 ac = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 if (i == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 XtSetArg(al[ac], XmNhighlightThickness, 1); ac++;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1091 XtSetArg(al[ac], XmNshowAsDefault, TRUE); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 children [n_children] = XmCreatePushButton (row, button_name, al, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 DO_DND_KLUDGE (children [n_children]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 if (i == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 button = children [n_children];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 ac = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 XtSetArg(al[ac], XmNdefaultButton, button); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 XtSetValues (row, al, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 #ifdef ARMANDACTIVATE_KLUDGE /* See comment above */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 XtTranslations losers = XtParseTranslationTable (button_trans);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 XtOverrideTranslations (button, losers);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 XtFree ((char *) losers);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 #endif /* ARMANDACTIVATE_KLUDGE */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 n_children++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 /* invisible seperator button */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 ac = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 XtSetArg (al[ac], XmNmappedWhenManaged, FALSE); ac++;
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
1119 children [n_children] = XmCreateLabel (row, "separator_button",
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1120 al, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 DO_DND_KLUDGE (children [n_children]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 n_children++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 for (i = 0; i < right_buttons; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 char button_name [16];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 sprintf (button_name, "button%d", left_buttons + i + 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 ac = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 XtSetArg(al[ac], XmNnavigationType, XmTAB_GROUP); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 children [n_children] = XmCreatePushButton (row, button_name, al, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 DO_DND_KLUDGE (children [n_children]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 if (! button) button = children [n_children];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 n_children++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 XtManageChildren (children, n_children);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 ac = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1139 XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1140 XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1141 XtSetArg(al[ac], XmNbottomOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1142 XtSetArg(al[ac], XmNbottomWidget, row); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1143 XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1144 XtSetArg(al[ac], XmNleftOffset, 0); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1145 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1146 XtSetArg(al[ac], XmNrightOffset, 0); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1147 separator = XmCreateSeparator (form, "", al, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 ac = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1150 XtSetArg(al[ac], XmNlabelType, XmPIXMAP); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1151 XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1152 XtSetArg(al[ac], XmNtopOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1153 XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_NONE); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1154 XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1155 XtSetArg(al[ac], XmNleftOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1156 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1157 icon = XmCreateLabel (form, (char *) icon_name, al, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 DO_DND_KLUDGE (icon);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 ac = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1161 XtSetArg(al[ac], XmNmappedWhenManaged, FALSE); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1162 XtSetArg(al[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1163 XtSetArg(al[ac], XmNtopOffset, 6); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1164 XtSetArg(al[ac], XmNtopWidget, icon); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1165 XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1166 XtSetArg(al[ac], XmNbottomOffset, 6); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1167 XtSetArg(al[ac], XmNbottomWidget, separator); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1168 XtSetArg(al[ac], XmNleftAttachment, XmATTACH_NONE); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1169 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_NONE); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1170 icon_separator = XmCreateLabel (form, "", al, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 DO_DND_KLUDGE (icon_separator);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 if (text_input_slot)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 ac = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1176 XtSetArg(al[ac], XmNcolumns, 50); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1177 XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1178 XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1179 XtSetArg(al[ac], XmNbottomOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1180 XtSetArg(al[ac], XmNbottomWidget, separator); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1181 XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1182 XtSetArg(al[ac], XmNleftOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1183 XtSetArg(al[ac], XmNleftWidget, icon); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1184 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1185 XtSetArg(al[ac], XmNrightOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1186 value = XmCreateTextField (form, "value", al, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 DO_DND_KLUDGE (value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 else if (radio_box)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 Widget radio_butt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 ac = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1193 XtSetArg(al[ac], XmNmarginWidth, 0); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1194 XtSetArg(al[ac], XmNmarginHeight, 0); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1195 XtSetArg(al[ac], XmNspacing, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1196 XtSetArg(al[ac], XmNalignment, XmALIGNMENT_CENTER); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1197 XtSetArg(al[ac], XmNorientation, XmHORIZONTAL); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1198 XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1199 XtSetArg(al[ac], XmNbottomOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1200 XtSetArg(al[ac], XmNbottomWidget, separator); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1201 XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1202 XtSetArg(al[ac], XmNleftOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1203 XtSetArg(al[ac], XmNleftWidget, icon); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1204 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1205 XtSetArg(al[ac], XmNrightOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1206 value = XmCreateRadioBox (form, "radiobutton1", al, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 ac = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 i = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1209 radio_butt = XmCreateToggleButtonGadget (value, "radio1", al, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 children [i++] = radio_butt;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1211 radio_butt = XmCreateToggleButtonGadget (value, "radio2", al, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 children [i++] = radio_butt;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1213 radio_butt = XmCreateToggleButtonGadget (value, "radio3", al, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 children [i++] = radio_butt;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 XtManageChildren (children, i);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 else if (list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 ac = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1220 XtSetArg(al[ac], XmNvisibleItemCount, 5); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1221 XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1222 XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1223 XtSetArg(al[ac], XmNbottomOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1224 XtSetArg(al[ac], XmNbottomWidget, separator); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1225 XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1226 XtSetArg(al[ac], XmNleftOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1227 XtSetArg(al[ac], XmNleftWidget, icon); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1228 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1229 XtSetArg(al[ac], XmNrightOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1230 value = XmCreateScrolledList (form, "list", al, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 /* this is the easiest way I found to have the dble click in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 list activate the default button */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 XtAddCallback (value, XmNdefaultActionCallback, activate_button, button);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 ac = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1238 XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1239 XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1240 XtSetArg(al[ac], XmNtopOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1241 XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1242 XtSetArg(al[ac], XmNbottomOffset, 13); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 XtSetArg(al[ac], XmNbottomWidget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 text_input_slot || radio_box || list ? value : separator); ac++;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1245 XtSetArg(al[ac], XmNleftAttachment, XmATTACH_WIDGET); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1246 XtSetArg(al[ac], XmNleftOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1247 XtSetArg(al[ac], XmNleftWidget, icon); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1248 XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1249 XtSetArg(al[ac], XmNrightOffset, 13); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1250 message = XmCreateLabel (form, "message", al, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 DO_DND_KLUDGE (message);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 if (list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 XtManageChild (value);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 i = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 children [i] = row; i++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 children [i] = separator; i++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 if (text_input_slot || radio_box)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 children [i] = value; i++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263 children [i] = message; i++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 children [i] = icon; i++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 children [i] = icon_separator; i++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 XtManageChildren (children, i);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 if (text_input_slot || list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 XtInstallAccelerators (value, button);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 XmProcessTraversal(value, XmTRAVERSE_CURRENT);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 XtInstallAccelerators (form, button);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 XmProcessTraversal(value, XmTRAVERSE_CURRENT);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 #ifdef DND_KLUDGE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 XtFree ((char *) dnd_override);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 #undef DO_DND_KLUDGE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 return result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 static destroyed_instance*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 find_matching_instance (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 destroyed_instance* cur;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 destroyed_instance* prev;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 char* type = instance->info->type;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 char* name = instance->info->name;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 for (prev = NULL, cur = all_destroyed_instances;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 cur;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 prev = cur, cur = cur->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 if (!strcmp (cur->name, name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 && !strcmp (cur->type, type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 && cur->parent == instance->parent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 && cur->pop_up_p == instance->pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 if (prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 prev->next = cur->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 all_destroyed_instances = cur->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 return cur;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 /* do some cleanup */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 else if (!cur->widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 if (prev)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 prev->next = cur->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 all_destroyed_instances = cur->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 free_destroyed_instance (cur);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 cur = prev ? prev : all_destroyed_instances;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 return NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 mark_dead_instance_destroyed (Widget widget, XtPointer closure,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 destroyed_instance* instance = (destroyed_instance*)closure;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 instance->widget = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 recenter_widget (Widget widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 Widget parent = XtParent (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 Screen* screen = XtScreen (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 Dimension screen_width = WidthOfScreen (screen);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 Dimension screen_height = HeightOfScreen (screen);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 Dimension parent_width = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 Dimension parent_height = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 Dimension child_width = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 Dimension child_height = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 Position x;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 Position y;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 XtVaGetValues (widget, XtNwidth, &child_width, XtNheight, &child_height, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 XtVaGetValues (parent, XtNwidth, &parent_width, XtNheight, &parent_height,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 x = (((Position)parent_width) - ((Position)child_width)) / 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 y = (((Position)parent_height) - ((Position)child_height)) / 2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 XtTranslateCoords (parent, x, y, &x, &y);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 if ((Dimension) (x + child_width) > screen_width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 x = screen_width - child_width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 if (x < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 x = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 if ((Dimension) (y + child_height) > screen_height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 y = screen_height - child_height;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 if (y < 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 y = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 XtVaSetValues (widget, XtNx, x, XtNy, y, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 recycle_instance (destroyed_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 Widget widget = instance->widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 /* widget is NULL if the parent was destroyed. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 if (widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 Widget focus;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 Widget separator;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 /* Remove the destroy callback as the instance is not in the list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 anymore */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 XtRemoveCallback (instance->parent, XtNdestroyCallback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 mark_dead_instance_destroyed,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 (XtPointer)instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 /* Give the focus to the initial item */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 focus = XtNameToWidget (widget, "*value");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 if (!focus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 focus = XtNameToWidget (widget, "*button1");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 if (focus)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 XmProcessTraversal(focus, XmTRAVERSE_CURRENT);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 /* shrink the separator label back to their original size */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 separator = XtNameToWidget (widget, "*separator_button");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 if (separator)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 XtVaSetValues (separator, XtNwidth, 5, XtNheight, 5, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 /* Center the dialog in its parent */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 recenter_widget (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 free_destroyed_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 return widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 xm_create_dialog (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 char* name = instance->info->type;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 Widget parent = instance->parent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 Widget widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 Boolean pop_up_p = instance->pop_up_p;
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1411 CONST char* shell_name = 0;
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1412 CONST char* icon_name = 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 Boolean text_input_slot = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 Boolean radio_box = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 Boolean list = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 int total_buttons;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 int left_buttons = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 int right_buttons = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 destroyed_instance* dead_one;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 /* try to find a widget to recycle */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 dead_one = find_matching_instance (instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 if (dead_one)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 Widget recycled_widget = recycle_instance (dead_one);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 if (recycled_widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 return recycled_widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 switch (name [0]){
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 case 'E': case 'e':
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 icon_name = "dbox-error";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 shell_name = "Error";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 case 'I': case 'i':
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 icon_name = "dbox-info";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 shell_name = "Information";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 case 'L': case 'l':
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 list = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 icon_name = "dbox-question";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 shell_name = "Prompt";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 case 'P': case 'p':
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 text_input_slot = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 icon_name = "dbox-question";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 shell_name = "Prompt";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 case 'Q': case 'q':
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 icon_name = "dbox-question";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 shell_name = "Question";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459 total_buttons = name [1] - '0';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 if (name [3] == 'T' || name [3] == 't')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 text_input_slot = False;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 radio_box = True;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 else if (name [3])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 right_buttons = name [4] - '0';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 left_buttons = total_buttons - right_buttons;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 widget = make_dialog (name, parent, pop_up_p,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 shell_name, icon_name, text_input_slot, radio_box,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 list, left_buttons, right_buttons);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 XtAddCallback (widget, XmNpopdownCallback, xm_nosel_callback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 (XtPointer) instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 return widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 #endif /* DIALOGS_MOTIF */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 #ifdef MENUBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 make_menubar (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 Arg al[10];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 int ac = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1489 XtSetArg(al[ac], XmNmarginHeight, 0); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 XtSetArg(al[ac], XmNshadowThickness, 3); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 return XmCreateMenuBar (instance->parent, instance->info->name, al, ac);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 remove_grabs (Widget shell, XtPointer closure, XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 Widget menu = (Widget) closure;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 XmRemoveFromPostFromList (menu, XtParent (XtParent ((Widget) menu)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 make_popup_menu (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 Widget parent = instance->parent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 Window parent_window = parent->core.window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 Widget result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 /* sets the parent window to 0 to fool Motif into not generating a grab */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510 parent->core.window = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 result = XmCreatePopupMenu (parent, instance->info->name, NULL, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 XtAddCallback (XtParent (result), XmNpopdownCallback, remove_grabs,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 (XtPointer)result);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 parent->core.window = parent_window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515 return result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 #endif /* MENUBARS_MOTIF */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 #ifdef SCROLLBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 make_scrollbar (widget_instance *instance, int vertical)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 Arg al[20];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 int ac = 0;
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1525 static XtCallbackRec callbacks[2] =
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1526 { {xm_scrollbar_callback, NULL}, {NULL, NULL} };
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1528 callbacks[0].closure = (XtPointer) instance;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1529
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1530 XtSetArg (al[ac], XmNminimum, 1); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1531 XtSetArg (al[ac], XmNmaximum, INT_MAX); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1532 XtSetArg (al[ac], XmNincrement, 1); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1533 XtSetArg (al[ac], XmNpageIncrement, 1); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1534 XtSetArg (al[ac], XmNborderWidth, 0); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1535 XtSetArg (al[ac], XmNorientation, vertical ? XmVERTICAL : XmHORIZONTAL); ac++;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1537 XtSetArg (al[ac], XmNdecrementCallback, callbacks); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1538 XtSetArg (al[ac], XmNdragCallback, callbacks); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1539 XtSetArg (al[ac], XmNincrementCallback, callbacks); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1540 XtSetArg (al[ac], XmNpageDecrementCallback, callbacks); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1541 XtSetArg (al[ac], XmNpageIncrementCallback, callbacks); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1542 XtSetArg (al[ac], XmNtoBottomCallback, callbacks); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1543 XtSetArg (al[ac], XmNtoTopCallback, callbacks); ac++;
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1544 XtSetArg (al[ac], XmNvalueChangedCallback, callbacks); ac++;
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 14
diff changeset
1545
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 78
diff changeset
1546 return XmCreateScrollBar (instance->parent, instance->info->name, al, ac);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1548
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1550 make_vertical_scrollbar (widget_instance *instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552 return make_scrollbar (instance, 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556 make_horizontal_scrollbar (widget_instance *instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1558 return make_scrollbar (instance, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1559 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1560
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1561 #endif /* SCROLLBARS_MOTIF */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1562
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1563 /* Table of functions to create widgets */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1564
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565 #ifdef ENERGIZE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567 /* interface with the XDesigner generated functions */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1568 typedef Widget (*widget_maker) (Widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569 extern Widget create_project_p_sheet (Widget parent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570 extern Widget create_debugger_p_sheet (Widget parent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571 extern Widget create_breaklist_p_sheet (Widget parent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1572 extern Widget create_le_browser_p_sheet (Widget parent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1573 extern Widget create_class_browser_p_sheet (Widget parent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574 extern Widget create_call_browser_p_sheet (Widget parent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1575 extern Widget create_build_dialog (Widget parent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1576 extern Widget create_editmode_dialog (Widget parent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1577 extern Widget create_search_dialog (Widget parent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578 extern Widget create_project_display_dialog (Widget parent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1579
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1581 make_one (widget_instance* instance, widget_maker fn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1582 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583 Widget result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1584 Arg al [64];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585 int ac = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587 if (instance->pop_up_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 XtSetArg (al [ac], XmNallowShellResize, TRUE); ac++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590 result = XmCreateDialogShell (instance->parent, "dialog", NULL, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591 XtAddCallback (result, XmNpopdownCallback, &xm_nosel_callback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592 (XtPointer) instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1593 (*fn) (result);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597 result = (*fn) (instance->parent);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598 XtRealizeWidget (result);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600 return result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1601 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1604 make_project_p_sheet (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1605 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1606 return make_one (instance, create_project_p_sheet);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1607 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1608
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1609 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 make_debugger_p_sheet (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1612 return make_one (instance, create_debugger_p_sheet);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1613 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616 make_breaklist_p_sheet (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1618 return make_one (instance, create_breaklist_p_sheet);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 make_le_browser_p_sheet (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 return make_one (instance, create_le_browser_p_sheet);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1628 make_class_browser_p_sheet (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1629 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630 return make_one (instance, create_class_browser_p_sheet);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634 make_call_browser_p_sheet (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636 return make_one (instance, create_call_browser_p_sheet);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640 make_build_dialog (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642 return make_one (instance, create_build_dialog);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646 make_editmode_dialog (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648 return make_one (instance, create_editmode_dialog);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 make_search_dialog (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654 return make_one (instance, create_search_dialog);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657 static Widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1658 make_project_display_dialog (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1660 return make_one (instance, create_project_display_dialog);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1662
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1663 #endif /* ENERGIZE */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1664
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665 widget_creation_entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1666 xm_creation_table [] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668 #ifdef MENUBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1669 {"menubar", make_menubar},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670 {"popup", make_popup_menu},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 #ifdef SCROLLBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673 {"vertical-scrollbar", make_vertical_scrollbar},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674 {"horizontal-scrollbar", make_horizontal_scrollbar},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676 #ifdef ENERGIZE
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677 {"project_p_sheet", make_project_p_sheet},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 {"debugger_p_sheet", make_debugger_p_sheet},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679 {"breaklist_psheet", make_breaklist_p_sheet},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680 {"leb_psheet", make_le_browser_p_sheet},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681 {"class_browser_psheet", make_class_browser_p_sheet},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 {"ctree_browser_psheet", make_call_browser_p_sheet},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683 {"build", make_build_dialog},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684 {"editmode", make_editmode_dialog},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685 {"search", make_search_dialog},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686 {"project_display", make_project_display_dialog},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687 #endif /* ENERGIZE */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688 {NULL, NULL}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1689 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 /* Destruction of instances */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 xm_destroy_instance (widget_instance* instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 #ifdef DIALOGS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696 /* It appears that this is used only for dialog boxes. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697 Widget widget = instance->widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698 /* recycle the dialog boxes */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 /* Disable the recycling until we can find a way to have the dialog box
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700 get reasonable layout after we modify its contents. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 if (0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702 && XtClass (widget) == xmDialogShellWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1703 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704 destroyed_instance* dead_instance =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1705 make_destroyed_instance (instance->info->name,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706 instance->info->type,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707 instance->widget,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708 instance->parent,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1709 instance->pop_up_p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710 dead_instance->next = all_destroyed_instances;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711 all_destroyed_instances = dead_instance;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712 XtUnmanageChild (first_child (instance->widget));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1713 XFlush (XtDisplay (instance->widget));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1714 XtAddCallback (instance->parent, XtNdestroyCallback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1715 mark_dead_instance_destroyed, (XtPointer)dead_instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719 /* This might not be necessary now that the nosel is attached to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 popdown instead of destroy, but it can't hurt. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721 XtRemoveCallback (instance->widget, XtNdestroyCallback,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722 xm_nosel_callback, (XtPointer)instance);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724 XtDestroyWidget (instance->widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1725 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 #endif /* DIALOGS_MOTIF */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 /* popup utility */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730 #ifdef MENUBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733 xm_popup_menu (Widget widget, XEvent *event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735 if (event->type == ButtonPress || event->type == ButtonRelease)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1736 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737 /* This is so totally ridiculous: there's NO WAY to tell Motif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738 that *any* button can select a menu item. Only one button
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1739 can have that honor.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1740 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1741 char *trans = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742 if (event->xbutton.state & Button5Mask) trans = "<Btn5Down>";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743 else if (event->xbutton.state & Button4Mask) trans = "<Btn4Down>";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744 else if (event->xbutton.state & Button3Mask) trans = "<Btn3Down>";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1745 else if (event->xbutton.state & Button2Mask) trans = "<Btn2Down>";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746 else if (event->xbutton.state & Button1Mask) trans = "<Btn1Down>";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1747 if (trans) XtVaSetValues (widget, XmNmenuPost, trans, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748 XmMenuPosition (widget, (XButtonPressedEvent *) event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750 XtManageChild (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1751 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1752
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1753 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1754
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755 #ifdef DIALOGS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1756
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758 set_min_dialog_size (Widget w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760 short width;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761 short height;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762 XtVaGetValues (w, XmNwidth, &width, XmNheight, &height, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 XtVaSetValues (w, XmNminWidth, width, XmNminHeight, height, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769 xm_pop_instance (widget_instance* instance, Boolean up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771 Widget widget = instance->widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 #ifdef DIALOGS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 if (XtClass (widget) == xmDialogShellWidgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776 Widget widget_to_manage = first_child (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1777 if (up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 XtManageChild (widget_to_manage);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 set_min_dialog_size (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781 XmProcessTraversal(widget, XmTRAVERSE_CURRENT);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1783 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784 XtUnmanageChild (widget_to_manage);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 if (up)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790 XtManageChild (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 XtUnmanageChild (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1795
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1796
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1797 /* motif callback */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1798
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1799 enum do_call_type { pre_activate, selection, no_selection, post_activate };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1800
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1801 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802 do_call (Widget widget, XtPointer closure, enum do_call_type type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804 XtPointer user_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805 widget_instance* instance = (widget_instance*)closure;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806 Widget instance_widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807 LWLIB_ID id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809 if (!instance)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811 if (widget->core.being_destroyed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1813
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1814 instance_widget = instance->widget;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1815 if (!instance_widget)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1816 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818 id = instance->info->id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819 user_data = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820 XtVaGetValues (widget, XmNuserData, &user_data, NULL);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1821 switch (type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1822 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1823 case pre_activate:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824 if (instance->info->pre_activate_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1825 instance->info->pre_activate_cb (widget, id, user_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1827 case selection:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1828 if (instance->info->selection_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1829 instance->info->selection_cb (widget, id, user_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1831 case no_selection:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832 if (instance->info->selection_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833 instance->info->selection_cb (widget, id, (XtPointer) -1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1835 case post_activate:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1836 if (instance->info->post_activate_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837 instance->info->post_activate_cb (widget, id, user_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1838 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1840 abort ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1841 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1842 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1843
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1844 /* Like lw_internal_update_other_instances except that it does not do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1845 anything if its shell parent is not managed. This is to protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1846 lw_internal_update_other_instances to dereference freed memory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1847 if the widget was ``destroyed'' by caching it in the all_destroyed_instances
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1848 list */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1849 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850 xm_internal_update_other_instances (Widget widget, XtPointer closure,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1851 XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853 Widget parent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854 for (parent = widget; parent; parent = XtParent (parent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855 if (XtIsShell (parent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857 else if (!XtIsManaged (parent))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1858 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1859 lw_internal_update_other_instances (widget, closure, call_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1860 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1861
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1862 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1863 xm_generic_callback (Widget widget, XtPointer closure, XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1864 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1865 #if !defined (ENERGIZE) && (defined (MENUBARS_MOTIF) || defined (DIALOGS_MOTIF))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1866 /* We want the selected status to change only when we decide it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1867 should change. Yuck but correct. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1868 if (XtClass (widget) == xmToggleButtonWidgetClass
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1869 || XtClass (widget) == xmToggleButtonGadgetClass)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1870 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1871 Boolean check;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872 XtVaGetValues (widget, XmNset, &check, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1873 XtVaSetValues (widget, XmNset, !check, 0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1874 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1875 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1876 lw_internal_update_other_instances (widget, closure, call_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1877 do_call (widget, closure, selection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1878 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1879
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1880 #ifdef DIALOGS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1881
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1882 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1883 xm_nosel_callback (Widget widget, XtPointer closure, XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1884 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1885 /* This callback is only called when a dialog box is dismissed with the wm's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886 destroy button (WM_DELETE_WINDOW.) We want the dialog box to be destroyed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1887 in that case, not just unmapped, so that it releases its keyboard grabs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1888 But there are problems with running our callbacks while the widget is in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1889 the process of being destroyed, so we set XmNdeleteResponse to XmUNMAP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1890 instead of XmDESTROY and then destroy it ourself after having run the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1891 callback.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1892 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1893 do_call (widget, closure, no_selection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1894 XtDestroyWidget (widget);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1895 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1896
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1897 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1898
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1899 #ifdef MENUBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1900
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1901 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1902 xm_pull_down_callback (Widget widget, XtPointer closure, XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1903 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1904 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1905 if (call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1906 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1907 /* new behavior for incremental menu construction */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1908
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1909 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1910 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1911 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1912 do_call (widget, closure, pre_activate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1913 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1914
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1915 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1916 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1917 xm_pop_down_callback (Widget widget, XtPointer closure, XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1918 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1919 do_call (widget, closure, post_activate);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1920 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1921 #endif /* 0 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1922
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1923 #endif /* MENUBARS_MOTIF */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1924
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1925 #ifdef SCROLLBARS_MOTIF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1926 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1927 xm_scrollbar_callback (Widget widget, XtPointer closure, XtPointer call_data)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1928 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1929 widget_instance *instance = (widget_instance *) closure;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1930 LWLIB_ID id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1931 XmScrollBarCallbackStruct *data =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1932 (XmScrollBarCallbackStruct *) call_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1933 scroll_event event_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1934 scrollbar_values *val =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1935 (scrollbar_values *) instance->info->val->scrollbar_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1936 double percent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1937
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1938 if (!instance || widget->core.being_destroyed)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1939 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1940
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1941 id = instance->info->id;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1942
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1943 percent = (double) (data->value - 1) / (double) (INT_MAX - 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1944 event_data.slider_value =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1945 (int) (percent * (double) (val->maximum - val->minimum)) + val->minimum;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1946
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1947 if (event_data.slider_value > (val->maximum - val->slider_size))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1948 event_data.slider_value = val->maximum - val->slider_size;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1949 else if (event_data.slider_value < 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1950 event_data.slider_value = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1951
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1952 if (data->event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1953 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1954 switch (data->event->xany.type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1955 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1956 case KeyPress:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1957 case KeyRelease:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1958 event_data.time = data->event->xkey.time;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1959 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1960 case ButtonPress:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1961 case ButtonRelease:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1962 event_data.time = data->event->xbutton.time;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1963 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1964 case MotionNotify:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1965 event_data.time = data->event->xmotion.time;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1966 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1967 case EnterNotify:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1968 case LeaveNotify:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1969 event_data.time = data->event->xcrossing.time;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1970 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1971 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1972 event_data.time = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1973 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1974 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1975 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1976 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1977 event_data.time = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1978
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1979 switch (data->reason)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1980 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1981 case XmCR_DECREMENT:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1982 event_data.action = SCROLLBAR_LINE_UP;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1983 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1984 case XmCR_INCREMENT:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1985 event_data.action = SCROLLBAR_LINE_DOWN;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1986 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1987 case XmCR_PAGE_DECREMENT:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1988 event_data.action = SCROLLBAR_PAGE_UP;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1989 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1990 case XmCR_PAGE_INCREMENT:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1991 event_data.action = SCROLLBAR_PAGE_DOWN;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1992 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1993 case XmCR_TO_TOP:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1994 event_data.action = SCROLLBAR_TOP;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1995 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1996 case XmCR_TO_BOTTOM:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1997 event_data.action = SCROLLBAR_BOTTOM;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1998 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1999 case XmCR_DRAG:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2000 event_data.action = SCROLLBAR_DRAG;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2001 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2002 case XmCR_VALUE_CHANGED:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2003 event_data.action = SCROLLBAR_CHANGE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2004 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2005 default:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2006 event_data.action = SCROLLBAR_CHANGE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2007 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2008 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2009
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2010 if (instance->info->pre_activate_cb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2011 instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2012 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2013 #endif /* SCROLLBARS_MOTIF */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2014
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2015
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2016 /* set the keyboard focus */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2017 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2018 xm_set_keyboard_focus (Widget parent, Widget w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2019 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2020 XmProcessTraversal (w, XmTRAVERSE_CURRENT);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2021 /* At some point we believed that it was necessary to use XtSetKeyboardFocus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2022 instead of XmProcessTraversal when using Motif >= 1.2.1, but that's bogus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2023 Presumably the problem was elsewhere, and is now gone...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2024 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2025 }