annotate lwlib/lwlib-Xol.c @ 15453:ad4f0ac5e7ef

(smtpmail-via-smtp): Bracket names in FROM and RCPT TO commands.
author Richard M. Stallman <rms@gnu.org>
date Tue, 18 Jun 1996 22:39:51 +0000
parents 0a94cd2c51c4
children 7fb1caba0f51
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5628
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 #include "lwlib-Xol.h"
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2 #include <X11/StringDefs.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3 #include <X11/IntrinsicP.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4 #include <X11/CompositeP.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 #include <X11/Shell.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 #include <Xol/Menu.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 #include <Xol/OpenLook.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 #include <Xol/MenuButton.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 #include <Xol/OblongButt.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 #include <Xol/ControlAre.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 #include <Xol/Stub.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 #include <Xol/StaticText.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 /* forward declarations */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 static void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 update_menu_widget (widget_instance* instance, Widget widget,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 widget_value* val);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 /* Menu callbacks */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 static void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 pre_hook (Widget w, caddr_t client_data, caddr_t call_data)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 OlVirtualEvent ve = (OlVirtualEvent)call_data;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 widget_instance* instance = (widget_instance*)client_data;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 if (w->core.being_destroyed)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 return;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 if (XtParent (w) == instance->widget)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 if (ve->xevent->type == ButtonPress && instance->info->pre_activate_cb)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 instance->info->pre_activate_cb (instance->widget, instance->info->id,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 NULL);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 static void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 post_hook (Widget w, caddr_t client_data, caddr_t call_data)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 widget_instance* instance = (widget_instance*)client_data;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 if (w->core.being_destroyed)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 return;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 if (instance->info->post_activate_cb)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 instance->info->post_activate_cb (w, instance->info->id, NULL);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 static void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 pick_hook (Widget w, caddr_t client_data, caddr_t call_data)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 widget_instance* instance = 0;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 widget_value* val = (widget_value*)client_data;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 if (w->core.being_destroyed)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 return;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 XtVaGetValues (w, XtNuserData, &instance, 0);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 if (!instance)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 return;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 if (instance->info->selection_cb && val && val->enabled
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 && !val->contents)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 instance->info->selection_cb (w, instance->info->id, val->call_data);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 /* creation functions */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 static Widget
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 xol_create_menubar (widget_instance* instance)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 Widget widget =
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 XtVaCreateWidget (instance->info->name, controlAreaWidgetClass,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 instance->parent, 0);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 return widget;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 static Widget
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 xol_create_popup_menu (widget_instance* instance)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 Widget popup_shell =
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 XtCreatePopupShell (instance->info->name, menuShellWidgetClass,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 instance->parent, NULL, 0);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 return popup_shell;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 widget_creation_entry
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 xol_creation_table [] =
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 {"menubar", xol_create_menubar},
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 {"popup", xol_create_popup_menu},
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 {NULL, NULL}
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 };
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 Widget
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 xol_create_dialog (widget_instance* instance)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 return NULL;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 Boolean
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 lw_olit_widget_p (Widget widget)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 return True;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 /* update functions */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 static void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 destroy_all_children (Widget widget)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 Widget* children;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 unsigned int number;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 int i;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 children = (Widget *) XtCompositeChildren (widget, &number);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 if (children)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 /* Unmanage all children and destroy them. They will only be
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 * really destroyed when we get out of DispatchEvent. */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 for (i = 0; i < number; i++)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 Widget child = children [i];
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 if (!child->core.being_destroyed)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 XtUnmanageChild (child);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 XtDestroyWidget (child);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 XtFree (children);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 static Boolean
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 all_dashes_p (char* s)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 char* t;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 for (t = s; *t; t++)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 if (*t != '-')
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 return False;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 return True;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 static void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 make_menu_in_widget (widget_instance* instance, Widget widget,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 widget_value* val)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 widget_value* cur;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 Widget button;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 Arg al [256];
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 int ac;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 String label;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 for (cur = val; cur; cur = cur->next)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 ac = 0;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 XtSetArg (al [ac], XtNsensitive, cur->enabled); ac++;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 XtSetArg (al [ac], XtNuserData, instance); ac++;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 XtSetArg (al [ac], XtNacceleratorText, cur->key); ac++;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 /* label = (char *) resource_string (widget, cur->name);*/
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 label = cur->name;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 if (label)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 XtSetArg (al [ac], XtNlabel, label); ac++;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 if (all_dashes_p (cur->name))
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 /* no separator in OpenLook just make some space. */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 XtSetArg (al [ac], XtNheight, 5); ac++;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 XtSetArg (al [ac], XtNwidth, 5); ac++;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 button = XtCreateWidget (cur->name, stubWidgetClass, widget, al, ac);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 else if (!cur->contents)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 if (!cur->call_data)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 button =
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 XtCreateManagedWidget (cur->name, staticTextWidgetClass, widget,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 al, ac);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 else
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 button =
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 XtCreateManagedWidget (cur->name, oblongButtonWidgetClass,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 widget, al, ac);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 XtAddCallback (button, XtNselect, pick_hook, cur);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 else
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 Widget menu = NULL;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 button =
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 XtCreateManagedWidget (cur->name, menuButtonWidgetClass, widget,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 al, ac);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 XtVaGetValues (button, XtNmenuPane, &menu, 0);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 if (!menu)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 abort ();
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 make_menu_in_widget (instance, menu, cur->contents);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 OlAddCallback (button, XtNconsumeEvent, pre_hook, instance);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 static void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 update_one_menu_entry (widget_instance* instance, Widget widget,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 widget_value* val)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 Arg al [256];
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 int ac;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 Widget menu;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 widget_value* contents;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 if (val->change == NO_CHANGE)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 return;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 /* update the sensitivity */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 XtVaSetValues (widget, XtNsensitive, val->enabled, 0);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 /* update the pulldown/pullaside as needed */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 ac = 0;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 menu = NULL;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 XtVaGetValues (widget, XtNmenuPane, &menu, 0);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 contents = val->contents;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 if (!menu)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 if (contents)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 {
14018
0a94cd2c51c4 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 5628
diff changeset
228 /* in OLIT this would have to be a structural change on the
5628
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229 button. */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 abort ();
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 else if (!contents)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 {
14018
0a94cd2c51c4 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 5628
diff changeset
235 /* in OLIT this would have to be a structural change on the button. */
5628
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 abort ();
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 else if (contents->change != NO_CHANGE)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 update_menu_widget (instance, menu, val);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 static void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 update_menu_widget (widget_instance* instance, Widget widget,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 widget_value* val)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 if (val->change == STRUCTURAL_CHANGE
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 || val->contents->change == STRUCTURAL_CHANGE)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 destroy_all_children (widget);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 make_menu_in_widget (instance, widget, val->contents);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253 else
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 /* Update all the buttons of the composite widget in order. */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 Widget* children;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 unsigned int num_children;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 int i;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 widget_value* cur;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 children = (Widget *) XtCompositeChildren (widget, &num_children);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 if (children)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 for (i = 0, cur = val->contents; i < num_children; i++)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 if (!cur)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 abort ();
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 if (children [i]->core.being_destroyed
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 || strcmp (XtName (children [i]), cur->name))
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 continue;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 update_one_menu_entry (instance, children [i], cur);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 cur = cur->next;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 XtFree (children);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 if (cur)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 abort ();
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 xol_update_one_widget (widget_instance* instance, Widget widget,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 widget_value* val, Boolean deep_p)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 Widget menu = widget;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 if (XtIsShell (widget))
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 XtVaGetValues (widget, XtNmenuPane, &menu, 0);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 update_menu_widget (instance, menu, val);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 xol_update_one_value (widget_instance* instance, Widget widget,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 widget_value* val)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 return;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 xol_pop_instance (widget_instance* instance, Boolean up)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306 xol_popup_menu (Widget widget)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 OlMenuPost (widget);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311 /* Destruction of instances */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313 xol_destroy_instance (widget_instance* instance)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 XtDestroyWidget (instance->widget);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317