annotate lwlib/xlwradio.c @ 406:b8cc9ab3f761 r21-2-33

Import from CVS: tag r21-2-33
author cvs
date Mon, 13 Aug 2007 11:17:09 +0200
parents 74fd4e045ea6
children de805c49cfc1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
1 /* Radio Widget for XEmacs.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
2 Copyright (C) 1999 Edward A. Falk
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
3
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
4 This file is part of XEmacs.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
5
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
9 later version.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
10
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
14 for more details.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
15
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
20
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
21 /* Synched up with: Radio.c 1.1 */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
22
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
23 /*
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
24 * Radio.c - Radio button widget
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
25 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
26 * Author: Edward A. Falk
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
27 * falk@falconer.vip.best.com
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
28 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
29 * Date: June 30, 1997
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
30 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
31 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
32 * Overview: This widget is identical to the Toggle widget in behavior,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
33 * but completely different in appearance. This widget looks like a small
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
34 * diamond-shaped button with a label to the right.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
35 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
36 * To make this work, we subclass the Toggle widget to inherit its behavior
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
37 * and to inherit the label-drawing function from which Toggle is
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
38 * subclassed. We then completely replace the Expose, Set, Unset
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
39 * and Highlight member functions.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
40 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
41 * The Set and Unset actions are slightly unorthodox. In Toggle's
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
42 * ClassInit function, Toggle searches the Command actions list and
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
43 * "steals" the Set and Unset functions, caching pointers to them in its
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
44 * class record. It then calls these functions from its own ToggleSet
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
45 * and Toggle actions.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
46 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
47 * We, in turn, override the Set() and Unset() actions in our own ClassRec.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
48 */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
49
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
50
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
51 #include <config.h>
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
52 #include <stdio.h>
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
53
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
54 #include <X11/IntrinsicP.h>
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
55 #include <X11/StringDefs.h>
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
56 #include ATHENA_INCLUDE(XawInit.h)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
57 #include "../src/xmu.h"
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
58 #include "xlwradioP.h"
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
59
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
60 #define BOX_SIZE 13
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
61
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
62 #define rclass(w) ((RadioWidgetClass)((w)->core.widget_class))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
63
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
64
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
65 #ifdef _ThreeDP_h
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
66 #define swid(rw) ((rw)->threeD.shadow_width)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
67 #else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
68 #define swid(rw) ((rw)->core.border_width)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
69 #endif
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
70
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
71 #define bsize(rw) (rclass(rw)->radio_class.dsize)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
72 #define bs(rw) (bsize(rw) + 2*swid(rw))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
73
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
74
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
75
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
76 /****************************************************************
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
77 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
78 * Full class record constant
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
79 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
80 ****************************************************************/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
81
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
82 /* The translations table from Toggle do not need to be
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
83 * overridden by Radio
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
84 */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
85
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
86
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
87 /* Member functions */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
88
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
89 static void RadioInit (Widget, Widget, ArgList, Cardinal *);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
90 static void RadioExpose (Widget, XEvent *, Region);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
91 static void RadioResize (Widget);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
92 static void RadioDestroy (Widget, XtPointer, XtPointer);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
93 static void RadioClassInit (void);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
94 static void RadioClassPartInit (WidgetClass);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
95 static Boolean RadioSetValues (Widget, Widget, Widget, ArgList, Cardinal *);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
96 static void DrawDiamond (Widget);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
97 static XtGeometryResult RadioQueryGeometry (Widget, XtWidgetGeometry *,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
98 XtWidgetGeometry *);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
99
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
100 /* Action procs */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
101
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
102 static void RadioHighlight (Widget, XEvent *, String *, Cardinal *);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
103 static void RadioUnhighlight (Widget, XEvent *, String *, Cardinal *);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
104
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
105 /* internal privates */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
106
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
107 static void RadioSize (RadioWidget, Dimension *, Dimension *);
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
108
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
109 /* The actions table from Toggle is almost perfect, but we need
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
110 * to override Highlight, Set, and Unset.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
111 */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
112
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
113 static XtActionsRec actionsList[] =
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
114 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
115 {"highlight", RadioHighlight},
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
116 {"unhighlight", RadioUnhighlight},
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
117 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
118
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
119 #define SuperClass ((ToggleWidgetClass)&toggleClassRec)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
120
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
121 RadioClassRec radioClassRec = {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
122 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
123 (WidgetClass) SuperClass, /* superclass */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
124 "Radio", /* class_name */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
125 sizeof(RadioRec), /* size */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
126 RadioClassInit, /* class_initialize */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
127 RadioClassPartInit, /* class_part_initialize */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
128 FALSE, /* class_inited */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
129 RadioInit, /* initialize */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
130 NULL, /* initialize_hook */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
131 XtInheritRealize, /* realize */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
132 actionsList, /* actions */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
133 XtNumber(actionsList), /* num_actions */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
134 NULL, /* resources */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
135 0, /* resource_count */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
136 NULLQUARK, /* xrm_class */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
137 TRUE, /* compress_motion */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
138 TRUE, /* compress_exposure */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
139 TRUE, /* compress_enterleave */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
140 FALSE, /* visible_interest */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
141 NULL, /* destroy */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
142 RadioResize, /* resize */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
143 RadioExpose, /* expose */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
144 RadioSetValues, /* set_values */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
145 NULL, /* set_values_hook */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
146 XtInheritSetValuesAlmost, /* set_values_almost */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
147 NULL, /* get_values_hook */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
148 NULL, /* accept_focus */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
149 XtVersion, /* version */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
150 NULL, /* callback_private */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
151 XtInheritTranslations, /* tm_table */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
152 RadioQueryGeometry, /* query_geometry */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
153 XtInheritDisplayAccelerator, /* display_accelerator */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
154 NULL /* extension */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
155 }, /* CoreClass fields initialization */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
156 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
157 XtInheritChangeSensitive /* change_sensitive */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
158 }, /* SimpleClass fields initialization */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
159 #ifdef _ThreeDP_h
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
160 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
161 XtInheritXaw3dShadowDraw /* field not used */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
162 }, /* ThreeDClass fields initialization */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
163 #endif
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
164 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
165 0 /* field not used */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
166 }, /* LabelClass fields initialization */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
167 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
168 0 /* field not used */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
169 }, /* CommandClass fields initialization */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
170 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
171 RadioSet, /* Set Procedure. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
172 RadioUnset, /* Unset Procedure. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
173 NULL /* extension. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
174 }, /* ToggleClass fields initialization */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
175 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
176 BOX_SIZE,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
177 DrawDiamond, /* draw procedure */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
178 NULL /* extension. */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
179 } /* RadioClass fields initialization */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
180 };
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
181
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
182 /* for public consumption */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
183 WidgetClass radioWidgetClass = (WidgetClass) &radioClassRec;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
184
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
185
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
186
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
187
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
188
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
189
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
190 /****************************************************************
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
191 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
192 * Class Methods
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
193 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
194 ****************************************************************/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
195
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
196 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
197 RadioClassInit (void)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
198 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
199 XawInitializeWidgetSet();
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
200 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
201
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
202 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
203 RadioClassPartInit (WidgetClass class)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
204 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
205 RadioWidgetClass c = (RadioWidgetClass) class ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
206 RadioWidgetClass super = (RadioWidgetClass)c->core_class.superclass ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
207
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
208 if( c->radio_class.drawDiamond == NULL ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
209 c->radio_class.drawDiamond == XtInheritDrawDiamond )
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
210 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
211 c->radio_class.drawDiamond = super->radio_class.drawDiamond ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
212 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
213 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
214
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
215
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
216
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
217
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
218 /*ARGSUSED*/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
219 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
220 RadioInit (Widget request,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
221 Widget new,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
222 ArgList args,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
223 Cardinal *num_args)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
224 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
225 RadioWidget rw = (RadioWidget) new;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
226 RadioWidget rw_req = (RadioWidget) request;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
227 Dimension w,h ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
228
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
229 /* Select initial size for the widget */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
230 if( rw_req->core.width == 0 || rw_req->core.height == 0 )
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
231 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
232 RadioSize(rw, &w,&h) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
233 if( rw_req->core.width == 0 )
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
234 rw->core.width = w ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
235 if( rw_req->core.height == 0 )
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
236 rw->core.height = h ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
237 rw->core.widget_class->core_class.resize(new) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
238 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
239 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
240
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
241 /* Function Name: RadioDestroy
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
242 * Description: Destroy Callback for radio widget.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
243 * Arguments: w - the radio widget that is being destroyed.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
244 * junk, grabage - not used.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
245 * Returns: none.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
246 */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
247
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
248 /* ARGSUSED */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
249 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
250 RadioDestroy (Widget w,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
251 XtPointer junk,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
252 XtPointer garbage)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
253 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
254 /* TODO: get rid of this */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
255 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
256
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
257
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
258 /* React to size change from manager. Label widget will compute some internal
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
259 * stuff, but we need to override. This code requires knowledge of the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
260 * internals of the Label widget.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
261 */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
262
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
263 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
264 RadioResize (Widget w)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
265 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
266 RadioWidget rw = (RadioWidget)w ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
267
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
268 /* call parent resize proc */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
269 SuperClass->core_class.resize(w) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
270
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
271 /* override label offset */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
272
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
273 switch( rw->label.justify ) {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
274 case XtJustifyLeft:
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 398
diff changeset
275 rw->label.label_x += (bs(rw) + rw->label.internal_width) ;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
276 break ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
277 case XtJustifyRight:
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
278 break ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
279 case XtJustifyCenter:
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
280 default:
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 398
diff changeset
281 rw->label.label_x += (bs(rw) + rw->label.internal_width)/2;
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
282 break ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
283 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
284 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
285
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
286
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
287 /*
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
288 * Repaint the widget window.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
289 */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
290
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
291 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
292 RadioExpose (Widget w,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
293 XEvent *event,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
294 Region region)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
295 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
296 RadioWidget rw = (RadioWidget) w ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
297 Display *dpy = XtDisplay(w) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
298 Window win = XtWindow(w) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
299 GC gc ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
300 Pixmap left_bitmap ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
301 extern WidgetClass labelWidgetClass ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
302
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
303 /* Note: the Label widget examines the region to decide if anything
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
304 * needs to be drawn. I'm not sure that this is worth the effort,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
305 * but it bears thinking on.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
306 */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
307
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
308 /* Command widget may sometimes override the label GC in order
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
309 * to draw inverse video. We don't use inverse video, so we need
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
310 * to restore the label's normal GC.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
311 */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
312 rw->label.normal_GC = rw->command.normal_GC ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
313
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
314
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
315 /* Let label widget draw the label. If there was an lbm_x
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
316 * field, we could let Label draw the bitmap too. But there
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
317 * isn't, so we need to temporarily remove the bitmap and
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
318 * draw it ourself later.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
319 */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
320 left_bitmap = rw->label.left_bitmap ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
321 rw->label.left_bitmap = None ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
322 labelWidgetClass->core_class.expose(w,event,region) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
323 rw->label.left_bitmap = left_bitmap ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
324
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
325 /* now manually draw the left bitmap. TODO: 3-d look, xaw-xpm */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
326 gc = XtIsSensitive(w) ? rw->label.normal_GC : rw->label.gray_GC ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
327 if( left_bitmap != None && rw->label.lbm_width > 0 )
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
328 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
329 /* TODO: handle pixmaps */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
330 XCopyPlane(dpy, left_bitmap, win, gc,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
331 0,0, rw->label.lbm_width, rw->label.lbm_height,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
332 (int) rw->label.internal_width*2 + bs(rw),
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
333 (int) rw->label.internal_height + rw->label.lbm_y,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
334 (u_long) 1L) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
335 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
336
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
337 /* Finally, the button itself */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
338 ((RadioWidgetClass)(w->core.widget_class))->radio_class.drawDiamond(w) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
339 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
340
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
341
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
342
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
343
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
344 /************************************************************
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
345 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
346 * Set specified arguments into widget
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
347 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
348 ***********************************************************/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
349
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
350
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
351 /* ARGSUSED */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
352 static Boolean
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
353 RadioSetValues (Widget current,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
354 Widget request,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
355 Widget new,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
356 ArgList args,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
357 Cardinal *num_args)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
358 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
359 RadioWidget oldrw = (RadioWidget) current;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
360 RadioWidget newrw = (RadioWidget) new;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
361
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
362 /* Need to find out if the size of the widget changed. Set new size
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
363 * if it did and resize is permitted. One way to determine of the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
364 * widget changed size would be to scan the args list. Another way
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
365 * is to compare the old and new widgets and see if any of several
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
366 * size-related fields have been changed. The Label widget chose the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
367 * former method, but I choose the latter.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
368 */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
369
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
370 if( newrw->label.resize &&
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
371 ( newrw->core.width != oldrw->core.width ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
372 newrw->core.height != oldrw->core.height ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
373 newrw->core.border_width != oldrw->core.border_width ) )
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
374 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
375 RadioSize(newrw, &newrw->core.width, &newrw->core.height) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
376 }
406
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 398
diff changeset
377
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 398
diff changeset
378 /* The label set values routine can resize the widget. We need to
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 398
diff changeset
379 * recalculate if this is true.
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 398
diff changeset
380 */
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 398
diff changeset
381 if (newrw->label.label_x != oldrw->label.label_x)
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 398
diff changeset
382 {
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 398
diff changeset
383 RadioResize (new);
b8cc9ab3f761 Import from CVS: tag r21-2-33
cvs
parents: 398
diff changeset
384 }
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
385 return FALSE ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
386 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
387
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
388 static XtGeometryResult
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
389 RadioQueryGeometry (Widget w,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
390 XtWidgetGeometry *intended,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
391 XtWidgetGeometry *preferred)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
392 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
393 RadioWidget rw = (RadioWidget) w;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
394
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
395 preferred->request_mode = CWWidth | CWHeight;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
396 RadioSize(rw, &preferred->width, &preferred->height) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
397
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
398 if ( ((intended->request_mode & (CWWidth | CWHeight))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
399 == (CWWidth | CWHeight)) &&
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
400 intended->width == preferred->width &&
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
401 intended->height == preferred->height)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
402 return XtGeometryYes;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
403 else if (preferred->width == w->core.width &&
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
404 preferred->height == w->core.height)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
405 return XtGeometryNo;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
406 else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
407 return XtGeometryAlmost;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
408 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
409
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
410
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
411
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
412
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
413
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
414 /************************************************************
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
415 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
416 * Action Procedures
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
417 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
418 ************************************************************/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
419
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
420 /*
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
421 * Draw the highlight border around the widget. The Command widget
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
422 * did this by drawing through a mask. We do it by just drawing the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
423 * border.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
424 */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
425
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
426 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
427 DrawHighlight (Widget w,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
428 GC gc)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
429 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
430 RadioWidget rw = (RadioWidget)w;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
431 XRectangle rects[4] ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
432 Dimension ht = rw->command.highlight_thickness ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
433
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
434 if( ht <= 0 ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
435 ht > rw->core.width/2 ||
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
436 ht > rw->core.height/2 )
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
437 return ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
438
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
439 if( ! XtIsRealized(w) )
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
440 return ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
441
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
442 rects[0].x = 0 ; rects[0].y = 0 ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
443 rects[0].width = rw->core.width ; rects[0].height = ht ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
444 rects[1].x = 0 ; rects[1].y = rw->core.height - ht ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
445 rects[1].width = rw->core.width ; rects[1].height = ht ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
446 rects[2].x = 0 ; rects[2].y = ht ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
447 rects[2].width = ht ; rects[2].height = rw->core.height - ht*2 ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
448 rects[3].x = rw->core.width - ht ; rects[3].y = ht ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
449 rects[3].width = ht ; rects[3].height = rw->core.height - ht*2 ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
450 XFillRectangles( XtDisplay(w), XtWindow(w), gc, rects, 4) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
451 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
452
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
453 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
454 RadioHighlight (Widget w,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
455 XEvent *event,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
456 String *params,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
457 Cardinal *num_params)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
458 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
459 RadioWidget rw = (RadioWidget)w;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
460 DrawHighlight(w, rw->command.normal_GC) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
461 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
462
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
463
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
464 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
465 RadioUnhighlight (Widget w,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
466 XEvent *event,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
467 String *params,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
468 Cardinal *num_params)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
469 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
470 RadioWidget rw = (RadioWidget)w;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
471 DrawHighlight(w, rw->command.inverse_GC) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
472 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
473
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
474
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
475 /* ARGSUSED */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
476 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
477 RadioSet (Widget w,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
478 XEvent *event,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
479 String *params, /* unused */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
480 Cardinal *num_params) /* unused */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
481 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
482 RadioWidget rw = (RadioWidget)w;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
483 RadioWidgetClass class = (RadioWidgetClass) w->core.widget_class ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
484
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
485 if( rw->command.set )
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
486 return ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
487
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
488 rw->command.set = TRUE ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
489 if( XtIsRealized(w) )
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
490 class->radio_class.drawDiamond(w) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
491 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
492
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
493
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
494 /* ARGSUSED */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
495 void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
496 RadioUnset (Widget w,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
497 XEvent *event,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
498 String *params, /* unused */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
499 Cardinal *num_params) /* unused */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
500 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
501 RadioWidget rw = (RadioWidget)w;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
502 RadioWidgetClass class = (RadioWidgetClass) w->core.widget_class ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
503
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
504 if( ! rw->command.set )
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
505 return ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
506
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
507 rw->command.set = FALSE ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
508 if( XtIsRealized(w) )
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
509 class->radio_class.drawDiamond(w) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
510 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
511
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
512
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
513
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
514
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
515 /************************************************************
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
516 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
517 * Internal Procedures
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
518 *
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
519 ************************************************************/
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
520
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
521
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
522 /* Size of widget. Width is size of box plus width of border around
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
523 * box plus width of label plus three margins plus the size of the left
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
524 * bitmap, if any. Height is max(box,bitmap,label) plus two margins.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
525 */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
526
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
527 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
528 RadioSize (RadioWidget rw,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
529 Dimension *w,
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
530 Dimension *h)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
531 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
532 *w = rw->label.label_width + bs(rw) + LEFT_OFFSET(rw) +
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
533 3 * rw->label.internal_width ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
534 *h = Max( rw->label.label_height, bs(rw) ) +
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
535 2 * rw->label.internal_width ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
536 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
537
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
538
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
539 static void
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
540 DrawDiamond (Widget w)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
541 {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
542 RadioWidget rw = (RadioWidget) w ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
543 Display *dpy = XtDisplay(w) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
544 Window win = XtWindow(w) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
545 GC gc, gci ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
546
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
547 XPoint pts[5] ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
548 Dimension del = bsize(rw)/2 ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
549 Position x,y ; /* diamond center */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
550 #ifdef _ThreeDP_h
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
551 int i=0;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
552 Dimension s = swid(rw) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
553 GC top, bot, ctr ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
554 #endif
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
555 gc = XtIsSensitive(w) ? rw->command.normal_GC : rw->label.gray_GC ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
556
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
557 gci = rw->command.set ? rw->command.normal_GC : rw->command.inverse_GC ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
558
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
559 x = rw->label.internal_width + bs(rw)/2 ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
560 y = rw->core.height/2 ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
561
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
562 #ifdef _ThreeDP_h
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
563 if( ! rw->command.set ) {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
564 top = rw->threeD.top_shadow_GC ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
565 bot = rw->threeD.bot_shadow_GC ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
566 ctr = gc ; /* TODO */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
567 } else {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
568 top = rw->threeD.bot_shadow_GC ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
569 bot = rw->threeD.top_shadow_GC ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
570 ctr = gc ; /* TODO */
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
571 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
572 #endif
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
573
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
574 pts[0].x = x - del ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
575 pts[0].y = y ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
576 pts[1].x = x ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
577 pts[1].y = y - del ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
578 pts[2].x = x + del ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
579 pts[2].y = y ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
580 pts[3].x = x ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
581 pts[3].y = y + del ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
582 pts[4] = pts[0] ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
583 XFillPolygon(dpy,win,gci, pts,4, Convex, CoordModeOrigin) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
584
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
585 #ifdef _ThreeDP_h
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
586 for(i=0; i<s; ++i) {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
587 XDrawLine(dpy,win,bot, x-i-del,y, x,y+del+i) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
588 XDrawLine(dpy,win,bot, x+del+i,y, x,y+del+i) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
589 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
590 for(i=0; i<s; ++i) {
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
591 XDrawLine(dpy,win,top, x-del-i,y, x,y-del-i) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
592 XDrawLine(dpy,win,top, x+del+i,y, x,y-del-i) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
593 }
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
594 #else
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
595 XDrawLines(dpy,win,gc, pts,5, CoordModeOrigin) ;
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
596 #endif
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
597 }