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