annotate lwlib/lwlib-Xaw.c @ 109141:fa173b9bd9ce

Fix some bad prototypes and formatting after conversion from K&R declaration. * lwlib/lwlib-Xaw.c: Include <ctype.h> for isdigit. (fill_xft_data, set_text): Remove unused variable screen. (draw_text): Cast bp to FcChar8*. (find_xft_data): Return 0 if inst or xft_data is not set. (wm_delete_window): Correct prototype. Initialize widget to 0 and return if widget is still 0 after loop. * lwlib/xlwmenu.c (XlwMenuSetValues, XlwMenuInitialize): Correct prototype. (display_menu_item): Remove unused variable gi. (make_windows_if_needed): Remove unused variable screen. (XlwMenuRedisplay): Remove unused variable i. * src/gtkutil.c (xg_get_pixbuf_from_pix_and_mask) (xg_get_image_for_pixmap, create_dialog) (xg_get_file_with_selection, xg_get_file_name, update_cl_data) (menuitem_highlight_callback, make_menu_item) (xg_create_one_menuitem, create_menus, xg_update_menu_item) (xg_create_scroll_bar, xg_update_scrollbar_pos) (xg_set_toolkit_scroll_bar_thumb, xg_tool_bar_button_cb) (xg_tool_bar_proxy_help_callback, xg_tool_bar_detach_callback) (xg_tool_bar_attach_callback, xg_tool_bar_help_callback) (xg_tool_bar_item_expose_callback): Reformat prototype. (xg_update_menubar): GList *group => GSList *group. (xg_modify_menubar_widgets): Initialize witem to 0, check witem != 0 before use. (update_frame_tool_bar): 4:th param to xg_get_image_for_pixmap changed to GTK_IMAGE (wimage). * src/xsettings.c (something_changedCB, parse_settings) (apply_xft_settings): Reformat prototype. (something_changedCB, init_gconf): Remove unused variable i. (read_settings): Remove unused variable long_len. * src/xsmfns.c (SSDATA): New macro. (smc_save_yourself_CB, x_session_initialize): Use SSDATA for strings passed to strlen/strcpy/strcat. (create_client_leader_window): Surround with #ifndef USE_GTK. Cast 7:th arg to XChangeProperty to (unsigned char *)
author Jan D <jan.h.d@swipnet.se>
date Mon, 05 Jul 2010 11:17:12 +0200
parents 384b3408c143
children d8a16c4fa9b1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1 /* The lwlib interface to Athena widgets.
76177
a274050b67b1 Add FSF copyright.
Glenn Morris <rgm@gnu.org>
parents: 64083
diff changeset
2 Copyright (C) 1993 Chuck Thompson <cthomp@cs.uiuc.edu>
a274050b67b1 Add FSF copyright.
Glenn Morris <rgm@gnu.org>
parents: 64083
diff changeset
3 Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105669
diff changeset
4 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
5
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
6 This file is part of the Lucid Widget Library.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
7
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48488
diff changeset
8 The Lucid Widget Library is free software; you can redistribute it and/or
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
9 modify it under the terms of the GNU General Public License as published by
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
10 the Free Software Foundation; either version 1, or (at your option)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
11 any later version.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
12
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
13 The Lucid Widget Library is distributed in the hope that it will be useful,
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48488
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
16 GNU General Public License for more details.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
17
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
19 along with GNU Emacs; see the file COPYING. If not, write to
64083
23a17af379b1 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 59085
diff changeset
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23a17af379b1 Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 59085
diff changeset
21 Boston, MA 02110-1301, USA. */
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
22
26087
e0d966fb548f Add support for large files, plus some locale improvements.
Paul Eggert <eggert@twinsun.com>
parents: 25754
diff changeset
23 #ifdef HAVE_CONFIG_H
e0d966fb548f Add support for large files, plus some locale improvements.
Paul Eggert <eggert@twinsun.com>
parents: 25754
diff changeset
24 #include <config.h>
e0d966fb548f Add support for large files, plus some locale improvements.
Paul Eggert <eggert@twinsun.com>
parents: 25754
diff changeset
25 #endif
e0d966fb548f Add support for large files, plus some locale improvements.
Paul Eggert <eggert@twinsun.com>
parents: 25754
diff changeset
26
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
27 #include <stdio.h>
105669
68dd71358159 * alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 100957
diff changeset
28 #include <setjmp.h>
109141
fa173b9bd9ce Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents: 109123
diff changeset
29 #include <ctype.h>
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
30
41767
7fb1caba0f51 Include ../src/lisp.h.
Richard M. Stallman <rms@gnu.org>
parents: 39721
diff changeset
31 #include "../src/lisp.h"
7fb1caba0f51 Include ../src/lisp.h.
Richard M. Stallman <rms@gnu.org>
parents: 39721
diff changeset
32
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
33 #include "lwlib-Xaw.h"
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
34
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
35 #include <X11/StringDefs.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
36 #include <X11/IntrinsicP.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
37 #include <X11/CoreP.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
38 #include <X11/Shell.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
39
81372
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
40 #ifdef HAVE_XAW3D
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
41 #include <X11/Xaw3d/Scrollbar.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
42 #include <X11/Xaw3d/Paned.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
43 #include <X11/Xaw3d/Dialog.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
44 #include <X11/Xaw3d/Form.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
45 #include <X11/Xaw3d/Command.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
46 #include <X11/Xaw3d/Label.h>
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
47 #else /* !HAVE_XAW3D */
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
48 #include <X11/Xaw/Scrollbar.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
49 #include <X11/Xaw/Paned.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
50 #include <X11/Xaw/Dialog.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
51 #include <X11/Xaw/Form.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
52 #include <X11/Xaw/Command.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
53 #include <X11/Xaw/Label.h>
81372
66f8afbd03d5 Link to xaw3d if available.
Chong Yidong <cyd@stupidchicken.com>
parents: 76177
diff changeset
54 #endif /* HAVE_XAW3D */
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
55
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
56 #include <X11/Xatom.h>
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
57
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
58 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
59 #include <X11/Xft/Xft.h>
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
60
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
61 struct widget_xft_data
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
62 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
63 Widget widget;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
64 XftFont *xft_font;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
65 XftDraw *xft_draw;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
66 XftColor xft_fg, xft_bg;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
67 int p_width, p_height;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
68 Pixmap p;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
69 };
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
70
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
71
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
72 #endif
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
73
109123
384b3408c143 Convert function definitions in lwlib files to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108539
diff changeset
74 static void xaw_generic_callback (Widget widget, XtPointer closure, XtPointer call_data);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
75
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
76
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
77 Boolean
109123
384b3408c143 Convert function definitions in lwlib files to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108539
diff changeset
78 lw_xaw_widget_p (Widget widget)
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
79 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
80 return (XtIsSubclass (widget, scrollbarWidgetClass) ||
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
81 XtIsSubclass (widget, dialogWidgetClass));
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
82 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
83
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
84 #if 0
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
85 static void
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
86 xaw_update_scrollbar (instance, widget, val)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
87 widget_instance *instance;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
88 Widget widget;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
89 widget_value *val;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
90 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
91 if (val->scrollbar_data)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
92 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
93 scrollbar_values *data = val->scrollbar_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
94 Dimension height, width;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
95 Dimension pos_x, pos_y;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
96 int widget_shown, widget_topOfThumb;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
97 float new_shown, new_topOfThumb;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
98
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
99 XtVaGetValues (widget,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
100 XtNheight, &height,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
101 XtNwidth, &width,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
102 XtNx, &pos_x,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
103 XtNy, &pos_y,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
104 XtNtopOfThumb, &widget_topOfThumb,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
105 XtNshown, &widget_shown,
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
106 NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
107
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
108 /*
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
109 * First size and position the scrollbar widget.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
110 * We need to position it to second-guess the Paned widget's notion
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
111 * of what should happen when the WMShell gets resized.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
112 */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
113 if (height != data->scrollbar_height || pos_y != data->scrollbar_pos)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
114 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
115 XtConfigureWidget (widget, pos_x, data->scrollbar_pos,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
116 width, data->scrollbar_height, 0);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
117
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
118 XtVaSetValues (widget,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
119 XtNlength, data->scrollbar_height,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
120 XtNthickness, width,
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
121 NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
122 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
123
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
124 /*
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
125 * Now the size the scrollbar's slider.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
126 */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
127 new_shown = (float) data->slider_size /
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
128 (float) (data->maximum - data->minimum);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
129
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
130 new_topOfThumb = (float) (data->slider_position - data->minimum) /
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
131 (float) (data->maximum - data->minimum);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
132
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
133 if (new_shown > 1.0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
134 new_shown = 1.0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
135 if (new_shown < 0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
136 new_shown = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
137
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
138 if (new_topOfThumb > 1.0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
139 new_topOfThumb = 1.0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
140 if (new_topOfThumb < 0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
141 new_topOfThumb = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
142
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
143 if (new_shown != widget_shown || new_topOfThumb != widget_topOfThumb)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
144 XawScrollbarSetThumb (widget, new_topOfThumb, new_shown);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
145 }
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
146 }
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
147 #endif
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
148
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
149 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
150 static void
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
151 fill_xft_data (struct widget_xft_data *data, Widget widget, XftFont *font)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
152 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
153 Pixel bg, fg;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
154 XColor colors[2];
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
155
108023
150fd3d78f5a Declarations before code (Bug#5993).
Jan D. <jan.h.d@swipnet.se>
parents: 107827
diff changeset
156 data->widget = widget;
150fd3d78f5a Declarations before code (Bug#5993).
Jan D. <jan.h.d@swipnet.se>
parents: 107827
diff changeset
157 data->xft_font = font;
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
158 XtVaGetValues (widget,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
159 XtNbackground, &bg,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
160 XtNforeground, &fg,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
161 NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
162
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
163 colors[0].pixel = data->xft_fg.pixel = fg;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
164 colors[1].pixel = data->xft_bg.pixel = bg;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
165 XQueryColors (XtDisplay (widget),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
166 DefaultColormapOfScreen (XtScreen (widget)),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
167 colors, 2);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
168
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
169 data->xft_fg.color.alpha = 0xFFFF;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
170 data->xft_fg.color.red = colors[0].red;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
171 data->xft_fg.color.green = colors[0].green;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
172 data->xft_fg.color.blue = colors[0].blue;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
173 data->xft_bg.color.alpha = 0xFFFF;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
174 data->xft_bg.color.red = colors[1].red;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
175 data->xft_bg.color.green = colors[1].green;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
176 data->xft_bg.color.blue = colors[1].blue;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
177
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
178 data->p = None;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
179 data->xft_draw = 0;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
180 data->p_width = data->p_height = 0;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
181 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
182
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
183 static XftFont*
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
184 openFont (Widget widget, char *name)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
185 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
186 char *fname = name;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
187 int screen = XScreenNumberOfScreen (XtScreen (widget));
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
188 int len = strlen (fname), i = len-1;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
189 XftFont *fn;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
190
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
191 /* Try to convert Gtk-syntax (Sans 9) to Xft syntax Sans-9. */
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
192 while (i > 0 && isdigit (fname[i]))
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
193 --i;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
194 if (fname[i] == ' ')
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
195 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
196 fname = xstrdup (name);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
197 fname[i] = '-';
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
198 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
199
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
200 fn = XftFontOpenName (XtDisplay (widget), screen, fname);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
201 if (fname != name) free (fname);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
202
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
203 return fn;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
204 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
205
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
206 static int
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
207 get_text_width_and_height (Widget widget, char *text,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
208 XftFont *xft_font,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
209 int *height)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
210 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
211 int w = 0, h = 0;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
212 char *bp = text;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
213
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
214 while (bp && *bp != '\0')
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
215 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
216 XGlyphInfo gi;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
217 char *cp = strchr (bp, '\n');
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
218 XftTextExtentsUtf8 (XtDisplay (widget), xft_font,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
219 (FcChar8 *) bp,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
220 cp ? cp - bp : strlen (bp),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
221 &gi);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
222 bp = cp ? cp + 1 : NULL;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
223 h += xft_font->height;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
224 if (w < gi.width) w = gi.width;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
225 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
226
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
227 *height = h;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
228 return w;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
229 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
230
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
231 static void
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
232 draw_text (struct widget_xft_data *data, char *lbl, int inverse)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
233 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
234 Screen *sc = XtScreen (data->widget);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
235 int screen = XScreenNumberOfScreen (sc);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
236 int y = data->xft_font->ascent;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
237 int x = inverse ? 0 : 2;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
238 char *bp = lbl;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
239
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
240 data->xft_draw = XftDrawCreate (XtDisplay (data->widget),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
241 data->p,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
242 DefaultVisual (XtDisplay (data->widget),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
243 screen),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
244 DefaultColormapOfScreen (sc));
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
245 XftDrawRect (data->xft_draw,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
246 inverse ? &data->xft_fg : &data->xft_bg,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
247 0, 0, data->p_width, data->p_height);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
248
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
249 if (!inverse) y += 2;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
250 while (bp && *bp != '\0')
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
251 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
252 char *cp = strchr (bp, '\n');
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
253 XftDrawStringUtf8 (data->xft_draw,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
254 inverse ? &data->xft_bg : &data->xft_fg,
109141
fa173b9bd9ce Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents: 109123
diff changeset
255 data->xft_font, x, y,
fa173b9bd9ce Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents: 109123
diff changeset
256 (FcChar8 *) bp,
fa173b9bd9ce Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents: 109123
diff changeset
257 cp ? cp - bp : strlen (bp));
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
258 bp = cp ? cp + 1 : NULL;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
259 /* 1.2 gives reasonable line spacing. */
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
260 y += data->xft_font->height * 1.2;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
261 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
262
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
263 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
264
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
265
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
266 static void
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
267 set_text (struct widget_xft_data *data, Widget toplevel, char *lbl, int margin)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
268 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
269 int width, height;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
270
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
271 width = get_text_width_and_height (data->widget, lbl, data->xft_font,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
272 &height);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
273 data->p_width = width + margin;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
274 data->p_height = height + margin;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
275
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
276 data->p = XCreatePixmap (XtDisplay (data->widget),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
277 XtWindow (toplevel),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
278 data->p_width,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
279 data->p_height,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
280 DefaultDepthOfScreen (XtScreen (data->widget)));
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
281 draw_text (data, lbl, 0);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
282 XtVaSetValues (data->widget, XtNbitmap, data->p, NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
283 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
284
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
285 static struct widget_xft_data *
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
286 find_xft_data (Widget widget)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
287 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
288 widget_instance *inst = NULL;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
289 Widget parent = XtParent (widget);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
290 struct widget_xft_data *data = NULL;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
291 int nr;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
292 while (parent && !inst)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
293 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
294 inst = lw_get_widget_instance (parent);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
295 parent = XtParent (parent);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
296 }
109141
fa173b9bd9ce Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents: 109123
diff changeset
297 if (!inst || !inst->xft_data || !inst->xft_data[0].xft_font) return 0;
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
298
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
299 for (nr = 0; data == NULL && nr < inst->nr_xft_data; ++nr)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
300 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
301 if (inst->xft_data[nr].widget == widget)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
302 data = &inst->xft_data[nr];
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
303 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
304
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
305 return data;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
306 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
307
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
308 static void
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
309 command_press (Widget widget,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
310 XEvent* event,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
311 String *params,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
312 Cardinal *num_params)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
313 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
314 struct widget_xft_data *data = find_xft_data (widget);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
315 if (data)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
316 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
317 char *lbl;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
318 /* Since this isn't used for rectangle buttons, use it to for armed. */
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
319 XtVaSetValues (widget, XtNcornerRoundPercent, 1, NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
320
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
321 XtVaGetValues (widget, XtNlabel, &lbl, NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
322 draw_text (data, lbl, 1);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
323 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
324 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
325
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
326 static void
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
327 command_reset (Widget widget,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
328 XEvent* event,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
329 String *params,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
330 Cardinal *num_params)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
331 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
332 struct widget_xft_data *data = find_xft_data (widget);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
333 if (data)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
334 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
335 Dimension cr;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
336 XtVaGetValues (widget, XtNcornerRoundPercent, &cr, NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
337 if (cr == 1)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
338 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
339 char *lbl;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
340 XtVaSetValues (widget, XtNcornerRoundPercent, 0, NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
341 XtVaGetValues (widget, XtNlabel, &lbl, NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
342 draw_text (data, lbl, 0);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
343 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
344 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
345 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
346
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
347
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
348 #endif
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
349
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
350 void
48488
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
351 #ifdef PROTOTYPES
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
352 xaw_update_one_widget (widget_instance *instance, Widget widget,
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
353 widget_value *val, Boolean deep_p)
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
354 #else
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
355 xaw_update_one_widget (instance, widget, val, deep_p)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
356 widget_instance *instance;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
357 Widget widget;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
358 widget_value *val;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
359 Boolean deep_p;
48488
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
360 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
361 {
6425
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
362 #if 0
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
363 if (XtIsSubclass (widget, scrollbarWidgetClass))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
364 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
365 xaw_update_scrollbar (instance, widget, val);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
366 }
6425
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
367 #endif
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
368 if (XtIsSubclass (widget, dialogWidgetClass))
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
369 {
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
370
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
371 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
372 if (instance->xft_data && instance->xft_data[0].xft_font)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
373 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
374 set_text (&instance->xft_data[0], instance->parent,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
375 val->contents->value, 10);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
376 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
377 #endif
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
378 XtVaSetValues (widget, XtNlabel, val->contents->value, NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
379 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
380 else if (XtIsSubclass (widget, commandWidgetClass))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
381 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
382 Dimension bw = 0;
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
383 Arg al[10];
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
384 int ac = 0;
6425
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
385
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
386 XtVaGetValues (widget, XtNborderWidth, &bw, NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
387 if (bw == 0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
388 /* Don't let buttons end up with 0 borderwidth, that's ugly...
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
389 Yeah, all this should really be done through app-defaults files
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
390 or fallback resources, but that's a whole different can of worms
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
391 that I don't feel like opening right now. Making Athena widgets
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
392 not look like shit is just entirely too much work.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
393 */
6425
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
394 {
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
395 XtSetArg (al[0], XtNborderWidth, 1);
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
396 XtSetValues (widget, al, 1);
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
397 }
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
398
36438
78f5e669dc5e (xaw_update_one_widget): Use XtSetSensitive instead
Gerd Moellmann <gerd@gnu.org>
parents: 30571
diff changeset
399 XtSetSensitive (widget, val->enabled);
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
400 XtSetArg (al[ac], XtNlabel, val->value);ac++;
6425
e884cf1153d7 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 6335
diff changeset
401 /* Force centered button text. Se above. */
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
402 XtSetArg (al[ac], XtNjustify, XtJustifyCenter);ac++;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
403 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
404 if (instance->xft_data && instance->xft_data[0].xft_font)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
405 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
406 int th;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
407 int nr;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
408 for (nr = 0; nr < instance->nr_xft_data; ++nr)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
409 if (instance->xft_data[nr].widget == widget)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
410 break;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
411 if (nr < instance->nr_xft_data)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
412 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
413 set_text (&instance->xft_data[nr], instance->parent,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
414 val->value, 6);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
415
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
416 /* Must set internalHeight to twice the highlight thickness,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
417 or else it gets overwritten by our pixmap. Probably a bug. */
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
418 XtVaGetValues (widget, XtNhighlightThickness, &th, NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
419 XtSetArg (al[ac], XtNinternalHeight, 2*th);ac++;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
420 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
421 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
422 #endif
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
423 XtSetValues (widget, al, ac);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
424 XtRemoveAllCallbacks (widget, XtNcallback);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
425 XtAddCallback (widget, XtNcallback, xaw_generic_callback, instance);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
426 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
427 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
428
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
429 void
109123
384b3408c143 Convert function definitions in lwlib files to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108539
diff changeset
430 xaw_update_one_value (widget_instance *instance, Widget widget, widget_value *val)
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
431 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
432 /* This function is not used by the scrollbars and those are the only
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
433 Athena widget implemented at the moment so do nothing. */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
434 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
435 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
436
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
437 void
109123
384b3408c143 Convert function definitions in lwlib files to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108539
diff changeset
438 xaw_destroy_instance (widget_instance *instance)
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
439 {
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
440 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
441 if (instance->xft_data)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
442 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
443 int i;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
444 for (i = 0; i < instance->nr_xft_data; ++i)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
445 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
446 if (instance->xft_data[i].xft_draw)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
447 XftDrawDestroy (instance->xft_data[i].xft_draw);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
448 if (instance->xft_data[i].p != None)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
449 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
450 XtVaSetValues (instance->xft_data[i].widget, XtNbitmap, None,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
451 NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
452 XFreePixmap (XtDisplay (instance->widget),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
453 instance->xft_data[i].p);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
454 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
455 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
456 if (instance->xft_data[0].xft_font)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
457 XftFontClose (XtDisplay (instance->widget),
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
458 instance->xft_data[0].xft_font);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
459 free (instance->xft_data);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
460 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
461 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
462 if (XtIsSubclass (instance->widget, dialogWidgetClass))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
463 /* Need to destroy the Shell too. */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
464 XtDestroyWidget (XtParent (instance->widget));
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
465 else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
466 XtDestroyWidget (instance->widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
467 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
468
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
469 void
109123
384b3408c143 Convert function definitions in lwlib files to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108539
diff changeset
470 xaw_popup_menu (Widget widget, XEvent *event)
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
471 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
472 /* An Athena menubar has not been implemented. */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
473 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
474 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
475
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
476 void
48488
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
477 #ifdef PROTOTYPES
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
478 xaw_pop_instance (widget_instance *instance, Boolean up)
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
479 #else
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
480 xaw_pop_instance (instance, up)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
481 widget_instance *instance;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
482 Boolean up;
48488
3336a76643ef Provide ISO C arglists for functions
Dave Love <fx@gnu.org>
parents: 42999
diff changeset
483 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
484 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
485 Widget widget = instance->widget;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
486
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
487 if (up)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
488 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
489 if (XtIsSubclass (widget, dialogWidgetClass))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
490 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
491 /* For dialogs, we need to call XtPopup on the parent instead
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
492 of calling XtManageChild on the widget.
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
493 Also we need to hack the shell's WM_PROTOCOLS to get it to
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
494 understand what the close box is supposed to do!!
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
495 */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
496 Display *dpy = XtDisplay (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
497 Widget shell = XtParent (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
498 Atom props [2];
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
499 int i = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
500 props [i++] = XInternAtom (dpy, "WM_DELETE_WINDOW", False);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
501 XChangeProperty (dpy, XtWindow (shell),
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
502 XInternAtom (dpy, "WM_PROTOCOLS", False),
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
503 XA_ATOM, 32, PropModeAppend,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
504 (unsigned char *) props, i);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
505
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
506 /* Center the widget in its parent. Why isn't this kind of crap
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
507 done automatically? I thought toolkits were supposed to make
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
508 life easier?
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
509 */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
510 {
11462
b3c30d040767 (xaw_pop_instance): Make x, y, w, h unsigned.
Richard M. Stallman <rms@gnu.org>
parents: 8785
diff changeset
511 unsigned int x, y, w, h;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
512 Widget topmost = instance->parent;
8785
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
513 Arg args[2];
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
514
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
515 w = shell->core.width;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
516 h = shell->core.height;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
517 while (topmost->core.parent && XtIsRealized (topmost->core.parent))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
518 topmost = topmost->core.parent;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
519 if (topmost->core.width < w) x = topmost->core.x;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
520 else x = topmost->core.x + ((topmost->core.width - w) / 2);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
521 if (topmost->core.height < h) y = topmost->core.y;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
522 else y = topmost->core.y + ((topmost->core.height - h) / 2);
8785
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
523 /* Using XtMoveWidget caused the widget to come
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
524 out in the wrong place with vtwm.
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
525 Question of virtual vs real coords, perhaps. */
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
526 XtSetArg (args[0], XtNx, x);
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
527 XtSetArg (args[1], XtNy, y);
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
528 XtSetValues (shell, args, 2);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
529 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
530
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
531 /* Finally, pop it up. */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
532 XtPopup (shell, XtGrabNonexclusive);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
533 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
534 else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
535 XtManageChild (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
536 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
537 else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
538 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
539 if (XtIsSubclass (widget, dialogWidgetClass))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
540 XtUnmanageChild (XtParent (widget));
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
541 else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
542 XtUnmanageChild (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
543 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
544 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
545
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
546
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
547 /* Dialog boxes */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
548
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
549 static char overrideTrans[] =
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
550 "<Message>WM_PROTOCOLS: lwlib_delete_dialog()";
53564
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
551 /* Dialogs pop down on any key press */
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
552 static char dialogOverride[] =
59085
4ee3b3653b2e * lwlib-Xaw.c: Put <KeyPress>Escape in dialogOverride so dialogs only
Jan Djärv <jan.h.d@swipnet.se>
parents: 53564
diff changeset
553 "<KeyPress>Escape: lwlib_delete_dialog()";
109141
fa173b9bd9ce Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents: 109123
diff changeset
554 static void wm_delete_window (Widget w,
fa173b9bd9ce Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents: 109123
diff changeset
555 XEvent *event,
fa173b9bd9ce Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents: 109123
diff changeset
556 String *params,
fa173b9bd9ce Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents: 109123
diff changeset
557 Cardinal *num_params);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
558 static XtActionsRec xaw_actions [] = {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
559 {"lwlib_delete_dialog", wm_delete_window}
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
560 };
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
561 static Boolean actions_initted = False;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
562
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
563 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
564 static XtActionsRec button_actions[] =
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
565 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
566 { "my_reset", command_reset },
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
567 { "my_press", command_press },
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
568 };
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
569 char buttonTrans[] =
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
570 "<Leave>: reset() my_reset()\n"
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
571 "<Btn1Down>: set() my_press()\n"
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
572 "<Btn1Up>: my_reset() notify() unset()\n";
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
573 #endif
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
574
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
575 static Widget
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
576 make_dialog (name, parent, pop_up_p, shell_title, icon_name, text_input_slot,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
577 radio_box, list, left_buttons, right_buttons, instance)
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
578 char* name;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
579 Widget parent;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
580 Boolean pop_up_p;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
581 char* shell_title;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
582 char* icon_name;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
583 Boolean text_input_slot;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
584 Boolean radio_box;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
585 Boolean list;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
586 int left_buttons;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
587 int right_buttons;
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
588 widget_instance *instance;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
589 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
590 Arg av [20];
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
591 int ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
592 int i, bc;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
593 char button_name [255];
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
594 Widget shell;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
595 Widget dialog;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
596 Widget button;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
597 XtTranslations override;
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
598 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
599 XftFont *xft_font = 0;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
600 XtTranslations button_override;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
601 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
602
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
603 if (! pop_up_p) abort (); /* not implemented */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
604 if (text_input_slot) abort (); /* not implemented */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
605 if (radio_box) abort (); /* not implemented */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
606 if (list) abort (); /* not implemented */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
607
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
608 if (! actions_initted)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
609 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
610 XtAppContext app = XtWidgetToApplicationContext (parent);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
611 XtAppAddActions (app, xaw_actions,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
612 sizeof (xaw_actions) / sizeof (xaw_actions[0]));
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
613 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
614 XtAppAddActions (app, button_actions,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
615 sizeof (button_actions) / sizeof (button_actions[0]));
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
616 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
617 actions_initted = True;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
618 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
619
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
620 override = XtParseTranslationTable (overrideTrans);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
621
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
622 ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
623 XtSetArg (av[ac], XtNtitle, shell_title); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
624 XtSetArg (av[ac], XtNallowShellResize, True); ac++;
6623
1d60a75efa87 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6425
diff changeset
625
1d60a75efa87 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6425
diff changeset
626 /* Don't allow any geometry request from the user. */
1d60a75efa87 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6425
diff changeset
627 XtSetArg (av[ac], XtNgeometry, 0); ac++;
1d60a75efa87 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6425
diff changeset
628
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
629 shell = XtCreatePopupShell ("dialog", transientShellWidgetClass,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
630 parent, av, ac);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
631 XtOverrideTranslations (shell, override);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
632
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
633 ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
634 dialog = XtCreateManagedWidget (name, dialogWidgetClass, shell, av, ac);
53564
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
635 override = XtParseTranslationTable (dialogOverride);
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
636 XtOverrideTranslations (dialog, override);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
637
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
638 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
639 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
640 int num;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
641 Widget *ch = NULL;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
642 Widget w = 0;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
643 XtVaGetValues (dialog,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
644 XtNnumChildren, &num,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
645 XtNchildren, &ch, NULL);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
646 for (i = 0; i < num; ++i)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
647 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
648 if (!XtIsSubclass (ch[i], commandWidgetClass)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
649 && XtIsSubclass (ch[i], labelWidgetClass))
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
650 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
651 w = ch[i];
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
652 break;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
653 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
654 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
655 instance->xft_data = 0;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
656 instance->nr_xft_data = 0;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
657 if (w)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
658 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
659 XtResource rec[] =
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
660 { { "faceName", "FaceName", XtRString, sizeof(String), 0, XtRString,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
661 (XtPointer)"Sans-14" }};
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
662 char *faceName;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
663 XtVaGetSubresources (dialog, &faceName, "Dialog", "dialog",
108539
247a650c5ccd lwlib-Xaw.c (make_dialog): Remove extra arg to XtVaGetSubresources.
Jan D <jan.h.d@swipnet.se>
parents: 108023
diff changeset
664 rec, 1, (String)NULL);
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
665 if (strcmp ("none", faceName) != 0)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
666 xft_font = openFont (dialog, faceName);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
667 if (xft_font)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
668 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
669 instance->nr_xft_data = left_buttons + right_buttons + 1;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
670 instance->xft_data = calloc (instance->nr_xft_data,
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
671 sizeof(*instance->xft_data));
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
672
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
673 fill_xft_data (&instance->xft_data[0], w, xft_font);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
674 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
675 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
676
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
677 button_override = XtParseTranslationTable (buttonTrans);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
678 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
679 #endif
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
680
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
681 bc = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
682 button = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
683 for (i = 0; i < left_buttons; i++)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
684 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
685 ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
686 XtSetArg (av [ac], XtNfromHoriz, button); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
687 XtSetArg (av [ac], XtNleft, XtChainLeft); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
688 XtSetArg (av [ac], XtNright, XtChainLeft); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
689 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
690 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
691 XtSetArg (av [ac], XtNresizable, True); ac++;
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
692 #ifdef HAVE_XAW3D
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
693 if (DefaultDepthOfScreen (XtScreen (dialog)) >= 16)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
694 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
695 /* Turn of dithered shadow if we can. Looks bad */
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
696 XtSetArg (av [ac], "beNiceToColormap", False); ac++;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
697 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
698 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
699 sprintf (button_name, "button%d", ++bc);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
700 button = XtCreateManagedWidget (button_name, commandWidgetClass,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
701 dialog, av, ac);
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
702 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
703 if (xft_font)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
704 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
705 fill_xft_data (&instance->xft_data[bc], button, xft_font);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
706 XtOverrideTranslations (button, button_override);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
707 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
708 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
709 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
710
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
711 for (i = 0; i < right_buttons; i++)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
712 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
713 ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
714 XtSetArg (av [ac], XtNfromHoriz, button); ac++;
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
715 if (i == 0)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
716 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
717 /* Separator to the other buttons. */
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
718 XtSetArg (av [ac], XtNhorizDistance, 30); ac++;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
719 }
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
720 XtSetArg (av [ac], XtNleft, XtChainRight); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
721 XtSetArg (av [ac], XtNright, XtChainRight); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
722 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
723 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
724 XtSetArg (av [ac], XtNresizable, True); ac++;
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
725 #ifdef HAVE_XAW3D
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
726 if (DefaultDepthOfScreen (XtScreen (dialog)) >= 16)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
727 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
728 /* Turn of dithered shadow if we can. Looks bad */
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
729 XtSetArg (av [ac], "beNiceToColormap", False); ac++;
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
730 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
731 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
732 sprintf (button_name, "button%d", ++bc);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
733 button = XtCreateManagedWidget (button_name, commandWidgetClass,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
734 dialog, av, ac);
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
735 #ifdef HAVE_XFT
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
736 if (xft_font)
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
737 {
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
738 fill_xft_data (&instance->xft_data[bc], button, xft_font);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
739 XtOverrideTranslations (button, button_override);
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
740 }
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
741 #endif
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
742 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
743
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
744 return dialog;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
745 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
746
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
747 Widget
109123
384b3408c143 Convert function definitions in lwlib files to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108539
diff changeset
748 xaw_create_dialog (widget_instance *instance)
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
749 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
750 char *name = instance->info->type;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
751 Widget parent = instance->parent;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
752 Widget widget;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
753 Boolean pop_up_p = instance->pop_up_p;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
754 char *shell_name = 0;
42630
cb6cc5b71c35 (xaw_create_dialog): Initialize icon_name to suppress compiler warnings.
Pavel Janík <Pavel@Janik.cz>
parents: 41767
diff changeset
755 char *icon_name = 0;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
756 Boolean text_input_slot = False;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
757 Boolean radio_box = False;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
758 Boolean list = False;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
759 int total_buttons;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
760 int left_buttons = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
761 int right_buttons = 1;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
762
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
763 switch (name [0]) {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
764 case 'E': case 'e':
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
765 icon_name = "dbox-error";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
766 shell_name = "Error";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
767 break;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
768
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
769 case 'I': case 'i':
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
770 icon_name = "dbox-info";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
771 shell_name = "Information";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
772 break;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
773
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
774 case 'L': case 'l':
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
775 list = True;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
776 icon_name = "dbox-question";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
777 shell_name = "Prompt";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
778 break;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
779
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
780 case 'P': case 'p':
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
781 text_input_slot = True;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
782 icon_name = "dbox-question";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
783 shell_name = "Prompt";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
784 break;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
785
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
786 case 'Q': case 'q':
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
787 icon_name = "dbox-question";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
788 shell_name = "Question";
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
789 break;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
790 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48488
diff changeset
791
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
792 total_buttons = name [1] - '0';
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
793
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
794 if (name [3] == 'T' || name [3] == 't')
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
795 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
796 text_input_slot = False;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
797 radio_box = True;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
798 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
799 else if (name [3])
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
800 right_buttons = name [4] - '0';
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48488
diff changeset
801
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
802 left_buttons = total_buttons - right_buttons;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48488
diff changeset
803
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
804 widget = make_dialog (name, parent, pop_up_p,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
805 shell_name, icon_name, text_input_slot, radio_box,
107827
aa85632b7860 Use XFT in Lucid dialogs if available.
Jan D. <jan.h.d@swipnet.se>
parents: 106815
diff changeset
806 list, left_buttons, right_buttons, instance);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
807 return widget;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
808 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
809
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
810
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
811 static void
109123
384b3408c143 Convert function definitions in lwlib files to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108539
diff changeset
812 xaw_generic_callback (Widget widget, XtPointer closure, XtPointer call_data)
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
813 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
814 widget_instance *instance = (widget_instance *) closure;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
815 Widget instance_widget;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
816 LWLIB_ID id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
817 XtPointer user_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
818
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
819 lw_internal_update_other_instances (widget, closure, call_data);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
820
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
821 if (! instance)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
822 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
823 if (widget->core.being_destroyed)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
824 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
825
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
826 instance_widget = instance->widget;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
827 if (!instance_widget)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
828 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
829
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
830 id = instance->info->id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
831
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
832 #if 0
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
833 user_data = NULL;
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
834 XtVaGetValues (widget, XtNuserData, &user_data, NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
835 #else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
836 /* Damn! Athena doesn't give us a way to hang our own data on the
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
837 buttons, so we have to go find it... I guess this assumes that
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
838 all instances of a button have the same call data. */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
839 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
840 widget_value *val = instance->info->val->contents;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
841 char *name = XtName (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
842 while (val)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
843 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
844 if (val->name && !strcmp (val->name, name))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
845 break;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
846 val = val->next;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
847 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
848 if (! val) abort ();
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
849 user_data = val->call_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
850 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
851 #endif
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
852
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
853 if (instance->info->selection_cb)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
854 instance->info->selection_cb (widget, id, user_data);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
855 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
856
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
857 static void
109141
fa173b9bd9ce Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents: 109123
diff changeset
858 wm_delete_window (Widget w,
fa173b9bd9ce Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents: 109123
diff changeset
859 XEvent *event,
fa173b9bd9ce Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents: 109123
diff changeset
860 String *params,
fa173b9bd9ce Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents: 109123
diff changeset
861 Cardinal *num_params)
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
862 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
863 LWLIB_ID id;
25754
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
864 Cardinal nkids;
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
865 int i;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
866 Widget *kids = 0;
109141
fa173b9bd9ce Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents: 109123
diff changeset
867 Widget widget = 0, shell;
53564
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
868
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
869 if (XtIsSubclass (w, dialogWidgetClass))
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
870 shell = XtParent (w);
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
871 else
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
872 shell = w;
609ef1718642 Changes for lucid popup menus (keyboard traversal enabled) and dialogs
Jan Djärv <jan.h.d@swipnet.se>
parents: 52401
diff changeset
873
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
874 if (! XtIsSubclass (shell, shellWidgetClass))
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
875 abort ();
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
876 XtVaGetValues (shell, XtNnumChildren, &nkids, NULL);
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
877 XtVaGetValues (shell, XtNchildren, &kids, NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
878 if (!kids || !*kids)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
879 abort ();
25754
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
880 for (i = 0; i < nkids; i++)
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
881 {
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
882 widget = kids[i];
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
883 if (XtIsSubclass (widget, dialogWidgetClass))
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
884 break;
d4de526fb0e0 (wm_delete_window): Check all the shell's children,
Richard M. Stallman <rms@gnu.org>
parents: 14186
diff changeset
885 }
109141
fa173b9bd9ce Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents: 109123
diff changeset
886 if (! widget) return;
fa173b9bd9ce Fix some bad prototypes and formatting after conversion from K&R declaration.
Jan D <jan.h.d@swipnet.se>
parents: 109123
diff changeset
887
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
888 id = lw_get_widget_id (widget);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
889 if (! id) abort ();
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
890
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
891 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
892 widget_info *info = lw_get_widget_info (id);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
893 if (! info) abort ();
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
894 if (info->selection_cb)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
895 info->selection_cb (widget, id, (XtPointer) -1);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
896 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
897
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
898 lw_destroy_all_widgets (id);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
899 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
900
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
901
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
902 /* Scrollbars */
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
903
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
904 #if 0
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
905 static void
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
906 xaw_scrollbar_scroll (widget, closure, call_data)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
907 Widget widget;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
908 XtPointer closure;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
909 XtPointer call_data;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
910 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
911 widget_instance *instance = (widget_instance *) closure;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
912 LWLIB_ID id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
913 scroll_event event_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
914
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
915 if (!instance || widget->core.being_destroyed)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
916 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
917
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
918 id = instance->info->id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
919 event_data.slider_value = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
920 event_data.time = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
921
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
922 if ((int) call_data > 0)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
923 event_data.action = SCROLLBAR_PAGE_DOWN;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
924 else
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
925 event_data.action = SCROLLBAR_PAGE_UP;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
926
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
927 if (instance->info->pre_activate_cb)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
928 instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data);
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
929 }
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
930 #endif
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
931
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
932 #if 0
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
933 static void
6333
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
934 xaw_scrollbar_jump (widget, closure, call_data)
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
935 Widget widget;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
936 XtPointer closure;
f3fe542e8cd7 *** empty log message ***
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents: 6302
diff changeset
937 XtPointer call_data;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
938 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
939 widget_instance *instance = (widget_instance *) closure;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
940 LWLIB_ID id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
941 scroll_event event_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
942 scrollbar_values *val =
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
943 (scrollbar_values *) instance->info->val->scrollbar_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
944 float percent;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
945
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
946 if (!instance || widget->core.being_destroyed)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
947 return;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
948
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
949 id = instance->info->id;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
950
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
951 percent = * (float *) call_data;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
952 event_data.slider_value =
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
953 (int) (percent * (float) (val->maximum - val->minimum)) + val->minimum;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
954
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
955 event_data.time = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
956 event_data.action = SCROLLBAR_DRAG;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
957
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
958 if (instance->info->pre_activate_cb)
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
959 instance->info->pre_activate_cb (widget, id, (XtPointer) &event_data);
42999
0dd2c7d849f5 (xaw_update_scrollbar, xaw_scrollbar_scroll)
Pavel Janík <Pavel@Janik.cz>
parents: 42630
diff changeset
960 }
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
961 #endif
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
962
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
963 static Widget
109123
384b3408c143 Convert function definitions in lwlib files to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108539
diff changeset
964 xaw_create_scrollbar (widget_instance *instance)
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
965 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
966 #if 0
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
967 Arg av[20];
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
968 int ac = 0;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
969 Dimension width;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
970 Widget scrollbar;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
971
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
972 XtVaGetValues (instance->parent, XtNwidth, &width, NULL);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 48488
diff changeset
973
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
974 XtSetArg (av[ac], XtNshowGrip, 0); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
975 XtSetArg (av[ac], XtNresizeToPreferred, 1); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
976 XtSetArg (av[ac], XtNallowResize, True); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
977 XtSetArg (av[ac], XtNskipAdjust, True); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
978 XtSetArg (av[ac], XtNwidth, width); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
979 XtSetArg (av[ac], XtNmappedWhenManaged, True); ac++;
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
980
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
981 scrollbar =
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
982 XtCreateWidget (instance->info->name, scrollbarWidgetClass,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
983 instance->parent, av, ac);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
984
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
985 /* We have to force the border width to be 0 otherwise the
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
986 geometry manager likes to start looping for awhile... */
30571
aa1b8b4c369d Use NULL at the end of the
Gerd Moellmann <gerd@gnu.org>
parents: 29465
diff changeset
987 XtVaSetValues (scrollbar, XtNborderWidth, 0, NULL);
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
988
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
989 XtRemoveAllCallbacks (scrollbar, "jumpProc");
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
990 XtRemoveAllCallbacks (scrollbar, "scrollProc");
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
991
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
992 XtAddCallback (scrollbar, "jumpProc", xaw_scrollbar_jump,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
993 (XtPointer) instance);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
994 XtAddCallback (scrollbar, "scrollProc", xaw_scrollbar_scroll,
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
995 (XtPointer) instance);
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
996
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
997 return scrollbar;
39721
e33afc45e39d (xaw_create_scrollbar) [!0]: Return NULL.
Gerd Moellmann <gerd@gnu.org>
parents: 36438
diff changeset
998 #else
e33afc45e39d (xaw_create_scrollbar) [!0]: Return NULL.
Gerd Moellmann <gerd@gnu.org>
parents: 36438
diff changeset
999 return NULL;
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1000 #endif
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1001 }
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1002
8785
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1003 static Widget
109123
384b3408c143 Convert function definitions in lwlib files to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 108539
diff changeset
1004 xaw_create_main (widget_instance *instance)
8785
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1005 {
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1006 Arg al[1];
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1007 int ac;
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1008
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1009 /* Create a vertical Paned to hold menubar */
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1010 ac = 0;
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1011 XtSetArg (al[ac], XtNborderWidth, 0); ac++;
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1012 return XtCreateWidget (instance->info->name, panedWidgetClass,
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1013 instance->parent, al, ac);
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1014 }
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1015
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1016 widget_creation_entry
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1017 xaw_creation_table [] =
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1018 {
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1019 {"scrollbar", xaw_create_scrollbar},
8785
04ad11fb0a0f entered into RCS
Paul Reilly <pmr@pajato.com>
parents: 6833
diff changeset
1020 {"main", xaw_create_main},
6302
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1021 {NULL, NULL}
f407e83e1aa4 Initial revision
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
diff changeset
1022 };
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1023
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1024 /* arch-tag: fbbd3589-ae1c-41a0-9142-f628cfee6564
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
1025 (do not change this comment) */