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