annotate lwlib/lwlib-Xm.c @ 4570:e6a7054a9c30

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