annotate lwlib/lwlib-Xol.c @ 88374:fa717c37ad16

Include "character.h" instead of "charset.h". (Finsert_file_contents): Big change for the new code-conversion API. (choose_write_coding_system): Likewise. (Fwrite_region): Likewise. (build_annotations_2): Deleted. (e_write): Big change for the new code-conversion API.
author Kenichi Handa <handa@m17n.org>
date Fri, 01 Mar 2002 01:38:37 +0000
parents 7fb1caba0f51
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
41767
7fb1caba0f51 Include ../src/lisp.h.
Richard M. Stallman <rms@gnu.org>
parents: 14018
diff changeset
1
7fb1caba0f51 Include ../src/lisp.h.
Richard M. Stallman <rms@gnu.org>
parents: 14018
diff changeset
2 #include "../src/lisp.h"
7fb1caba0f51 Include ../src/lisp.h.
Richard M. Stallman <rms@gnu.org>
parents: 14018
diff changeset
3
5628
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4 #include "lwlib-Xol.h"
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 #include <X11/StringDefs.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 #include <X11/IntrinsicP.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 #include <X11/CompositeP.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 #include <X11/Shell.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 #include <Xol/Menu.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 #include <Xol/OpenLook.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 #include <Xol/MenuButton.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 #include <Xol/OblongButt.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 #include <Xol/ControlAre.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 #include <Xol/Stub.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 #include <Xol/StaticText.h>
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 /* forward declarations */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 static void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 update_menu_widget (widget_instance* instance, Widget widget,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 widget_value* val);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 /* Menu callbacks */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 static void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 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
25 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 OlVirtualEvent ve = (OlVirtualEvent)call_data;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 widget_instance* instance = (widget_instance*)client_data;
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 (w->core.being_destroyed)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 return;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 if (XtParent (w) == instance->widget)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 if (ve->xevent->type == ButtonPress && instance->info->pre_activate_cb)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 instance->info->pre_activate_cb (instance->widget, instance->info->id,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 NULL);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 }
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 static void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 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
42 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 widget_instance* instance = (widget_instance*)client_data;
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 (w->core.being_destroyed)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 return;
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 if (instance->info->post_activate_cb)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 instance->info->post_activate_cb (w, instance->info->id, NULL);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 }
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 static void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 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
54 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 widget_instance* instance = 0;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 widget_value* val = (widget_value*)client_data;
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 if (w->core.being_destroyed)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 return;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 XtVaGetValues (w, XtNuserData, &instance, 0);
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)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 return;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 if (instance->info->selection_cb && val && val->enabled
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 && !val->contents)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 instance->info->selection_cb (w, instance->info->id, val->call_data);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 /* creation functions */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 static Widget
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 xol_create_menubar (widget_instance* instance)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 Widget widget =
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 XtVaCreateWidget (instance->info->name, controlAreaWidgetClass,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 instance->parent, 0);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 return widget;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 }
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 static Widget
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 xol_create_popup_menu (widget_instance* instance)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 Widget popup_shell =
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 XtCreatePopupShell (instance->info->name, menuShellWidgetClass,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 instance->parent, NULL, 0);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 return popup_shell;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 }
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 widget_creation_entry
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 xol_creation_table [] =
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 {"menubar", xol_create_menubar},
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 {"popup", xol_create_popup_menu},
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 {NULL, NULL}
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 };
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 Widget
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 xol_create_dialog (widget_instance* instance)
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 return NULL;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 }
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 Boolean
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 lw_olit_widget_p (Widget widget)
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 return True;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 /* update functions */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 static void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 destroy_all_children (Widget widget)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 Widget* children;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 unsigned int number;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 int i;
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 children = (Widget *) XtCompositeChildren (widget, &number);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 if (children)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 /* Unmanage all children and destroy them. They will only be
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 * really destroyed when we get out of DispatchEvent. */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 for (i = 0; i < number; i++)
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 Widget child = children [i];
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 if (!child->core.being_destroyed)
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 XtUnmanageChild (child);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 XtDestroyWidget (child);
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 XtFree (children);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 }
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 static Boolean
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 all_dashes_p (char* s)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 char* t;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 for (t = s; *t; t++)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 if (*t != '-')
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 return False;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 return True;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 static void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 make_menu_in_widget (widget_instance* instance, Widget widget,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 widget_value* val)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 widget_value* cur;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 Widget button;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 Arg al [256];
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 int ac;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 String label;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 for (cur = val; cur; cur = cur->next)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 ac = 0;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 XtSetArg (al [ac], XtNsensitive, cur->enabled); ac++;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 XtSetArg (al [ac], XtNuserData, instance); ac++;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 XtSetArg (al [ac], XtNacceleratorText, cur->key); ac++;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 /* label = (char *) resource_string (widget, cur->name);*/
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 label = cur->name;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 if (label)
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 XtSetArg (al [ac], XtNlabel, label); ac++;
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
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 if (all_dashes_p (cur->name))
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 /* no separator in OpenLook just make some space. */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 XtSetArg (al [ac], XtNheight, 5); ac++;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174 XtSetArg (al [ac], XtNwidth, 5); ac++;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 button = XtCreateWidget (cur->name, stubWidgetClass, widget, al, ac);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 else if (!cur->contents)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 if (!cur->call_data)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 button =
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 XtCreateManagedWidget (cur->name, staticTextWidgetClass, widget,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 al, ac);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 else
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 button =
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 XtCreateManagedWidget (cur->name, oblongButtonWidgetClass,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 widget, al, ac);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 XtAddCallback (button, XtNselect, pick_hook, cur);
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 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 else
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 Widget menu = NULL;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 button =
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 XtCreateManagedWidget (cur->name, menuButtonWidgetClass, widget,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 al, ac);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 XtVaGetValues (button, XtNmenuPane, &menu, 0);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 if (!menu)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 abort ();
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 make_menu_in_widget (instance, menu, cur->contents);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 OlAddCallback (button, XtNconsumeEvent, pre_hook, instance);
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 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 static void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 update_one_menu_entry (widget_instance* instance, Widget widget,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208 widget_value* val)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 Arg al [256];
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 int ac;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212 Widget menu;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 widget_value* contents;
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 if (val->change == NO_CHANGE)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 return;
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 sensitivity */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 XtVaSetValues (widget, XtNsensitive, val->enabled, 0);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221 /* update the pulldown/pullaside as needed */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 ac = 0;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 menu = NULL;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 XtVaGetValues (widget, XtNmenuPane, &menu, 0);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 contents = val->contents;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 if (!menu)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229 if (contents)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 {
14018
0a94cd2c51c4 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 5628
diff changeset
231 /* 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
232 button. */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 abort ();
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 else if (!contents)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 {
14018
0a94cd2c51c4 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 5628
diff changeset
238 /* 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
239 abort ();
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 else if (contents->change != NO_CHANGE)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 update_menu_widget (instance, menu, val);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 static void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 update_menu_widget (widget_instance* instance, Widget widget,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 widget_value* val)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248
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 if (val->change == STRUCTURAL_CHANGE
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 || val->contents->change == STRUCTURAL_CHANGE)
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 destroy_all_children (widget);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 make_menu_in_widget (instance, widget, val->contents);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 else
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 /* Update all the buttons of the composite widget in order. */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 Widget* children;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 unsigned int num_children;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 int i;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 widget_value* cur;
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 children = (Widget *) XtCompositeChildren (widget, &num_children);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 if (children)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 for (i = 0, cur = val->contents; i < num_children; i++)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 if (!cur)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 abort ();
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 if (children [i]->core.being_destroyed
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 || strcmp (XtName (children [i]), cur->name))
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 continue;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 update_one_menu_entry (instance, children [i], cur);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 cur = cur->next;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 XtFree (children);
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 if (cur)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 abort ();
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 xol_update_one_widget (widget_instance* instance, Widget widget,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286 widget_value* val, Boolean deep_p)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 Widget menu = widget;
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 if (XtIsShell (widget))
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 XtVaGetValues (widget, XtNmenuPane, &menu, 0);
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 update_menu_widget (instance, menu, val);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296 void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 xol_update_one_value (widget_instance* instance, Widget widget,
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298 widget_value* val)
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 return;
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 }
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 void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 xol_pop_instance (widget_instance* instance, Boolean up)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306 }
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 void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 xol_popup_menu (Widget widget)
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 OlMenuPost (widget);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 /* Destruction of instances */
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 void
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 xol_destroy_instance (widget_instance* instance)
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317 {
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318 XtDestroyWidget (instance->widget);
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319 }
f999ebca00da entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320