Mercurial > hg > xemacs-beta
comparison lwlib/xlwradio.c @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 9d177e8d4150 |
children | c33ae14dd6d0 |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
23 /* | 23 /* |
24 * Radio.c - Radio button widget | 24 * Radio.c - Radio button widget |
25 * | 25 * |
26 * Author: Edward A. Falk | 26 * Author: Edward A. Falk |
27 * falk@falconer.vip.best.com | 27 * falk@falconer.vip.best.com |
28 * | 28 * |
29 * Date: June 30, 1997 | 29 * Date: June 30, 1997 |
30 * | 30 * |
31 * | 31 * |
32 * Overview: This widget is identical to the Toggle widget in behavior, | 32 * Overview: This widget is identical to the Toggle widget in behavior, |
33 * but completely different in appearance. This widget looks like a small | 33 * but completely different in appearance. This widget looks like a small |
51 #include <config.h> | 51 #include <config.h> |
52 #include <stdio.h> | 52 #include <stdio.h> |
53 | 53 |
54 #include <X11/IntrinsicP.h> | 54 #include <X11/IntrinsicP.h> |
55 #include <X11/StringDefs.h> | 55 #include <X11/StringDefs.h> |
56 #include ATHENA_INCLUDE(XawInit.h) | 56 #include ATHENA_XawInit_h_ |
57 #include "../src/xmu.h" | 57 #include "../src/xmu.h" |
58 #include "xlwradioP.h" | 58 #include "xlwradioP.h" |
59 | 59 |
60 #define BOX_SIZE 13 | 60 #define BOX_SIZE 13 |
61 | 61 |
118 | 118 |
119 #define SuperClass ((ToggleWidgetClass)&toggleClassRec) | 119 #define SuperClass ((ToggleWidgetClass)&toggleClassRec) |
120 | 120 |
121 RadioClassRec radioClassRec = { | 121 RadioClassRec radioClassRec = { |
122 { | 122 { |
123 (WidgetClass) SuperClass, /* superclass */ | 123 (WidgetClass) SuperClass, /* superclass */ |
124 "Radio", /* class_name */ | 124 "Radio", /* class_name */ |
125 sizeof(RadioRec), /* size */ | 125 sizeof(RadioRec), /* size */ |
126 RadioClassInit, /* class_initialize */ | 126 RadioClassInit, /* class_initialize */ |
127 RadioClassPartInit, /* class_part_initialize */ | 127 RadioClassPartInit, /* class_part_initialize */ |
128 FALSE, /* class_inited */ | 128 FALSE, /* class_inited */ |
152 RadioQueryGeometry, /* query_geometry */ | 152 RadioQueryGeometry, /* query_geometry */ |
153 XtInheritDisplayAccelerator, /* display_accelerator */ | 153 XtInheritDisplayAccelerator, /* display_accelerator */ |
154 NULL /* extension */ | 154 NULL /* extension */ |
155 }, /* CoreClass fields initialization */ | 155 }, /* CoreClass fields initialization */ |
156 { | 156 { |
157 XtInheritChangeSensitive /* change_sensitive */ | 157 XtInheritChangeSensitive /* change_sensitive */ |
158 }, /* SimpleClass fields initialization */ | 158 }, /* SimpleClass fields initialization */ |
159 #ifdef _ThreeDP_h | 159 #ifdef _ThreeDP_h |
160 { | 160 { |
161 XtInheritXaw3dShadowDraw /* field not used */ | 161 XtInheritXaw3dShadowDraw /* field not used */ |
162 }, /* ThreeDClass fields initialization */ | 162 }, /* ThreeDClass fields initialization */ |
239 } | 239 } |
240 | 240 |
241 /* Function Name: RadioDestroy | 241 /* Function Name: RadioDestroy |
242 * Description: Destroy Callback for radio widget. | 242 * Description: Destroy Callback for radio widget. |
243 * Arguments: w - the radio widget that is being destroyed. | 243 * Arguments: w - the radio widget that is being destroyed. |
244 * junk, grabage - not used. | 244 * junk, garbage - not used. |
245 * Returns: none. | 245 * Returns: none. |
246 */ | 246 */ |
247 | 247 |
248 /* ARGSUSED */ | 248 /* ARGSUSED */ |
249 static void | 249 static void |
270 | 270 |
271 /* override label offset */ | 271 /* override label offset */ |
272 | 272 |
273 switch( rw->label.justify ) { | 273 switch( rw->label.justify ) { |
274 case XtJustifyLeft: | 274 case XtJustifyLeft: |
275 rw->label.label_x += bs(rw) + rw->label.internal_width ; | 275 rw->label.label_x += (bs(rw) + rw->label.internal_width) ; |
276 break ; | 276 break ; |
277 case XtJustifyRight: | 277 case XtJustifyRight: |
278 break ; | 278 break ; |
279 case XtJustifyCenter: | 279 case XtJustifyCenter: |
280 default: | 280 default: |
281 rw->label.label_x += (bs(rw) + rw->label.internal_width)/2 ; | 281 rw->label.label_x += (bs(rw) + rw->label.internal_width)/2; |
282 break ; | 282 break ; |
283 } | 283 } |
284 } | 284 } |
285 | 285 |
286 | 286 |
373 newrw->core.border_width != oldrw->core.border_width ) ) | 373 newrw->core.border_width != oldrw->core.border_width ) ) |
374 { | 374 { |
375 RadioSize(newrw, &newrw->core.width, &newrw->core.height) ; | 375 RadioSize(newrw, &newrw->core.width, &newrw->core.height) ; |
376 } | 376 } |
377 | 377 |
378 /* The label set values routine can resize the widget. We need to | |
379 * recalculate if this is true. | |
380 */ | |
381 if (newrw->label.label_x != oldrw->label.label_x) | |
382 { | |
383 RadioResize (new); | |
384 } | |
378 return FALSE ; | 385 return FALSE ; |
379 } | 386 } |
380 | 387 |
381 static XtGeometryResult | 388 static XtGeometryResult |
382 RadioQueryGeometry (Widget w, | 389 RadioQueryGeometry (Widget w, |
414 * Draw the highlight border around the widget. The Command widget | 421 * Draw the highlight border around the widget. The Command widget |
415 * did this by drawing through a mask. We do it by just drawing the | 422 * did this by drawing through a mask. We do it by just drawing the |
416 * border. | 423 * border. |
417 */ | 424 */ |
418 | 425 |
419 static void | 426 static void |
420 DrawHighlight (Widget w, | 427 DrawHighlight (Widget w, |
421 GC gc) | 428 GC gc) |
422 { | 429 { |
423 RadioWidget rw = (RadioWidget)w; | 430 RadioWidget rw = (RadioWidget)w; |
424 XRectangle rects[4] ; | 431 XRectangle rects[4] ; |
464 DrawHighlight(w, rw->command.inverse_GC) ; | 471 DrawHighlight(w, rw->command.inverse_GC) ; |
465 } | 472 } |
466 | 473 |
467 | 474 |
468 /* ARGSUSED */ | 475 /* ARGSUSED */ |
469 void | 476 void |
470 RadioSet (Widget w, | 477 RadioSet (Widget w, |
471 XEvent *event, | 478 XEvent *event, |
472 String *params, /* unused */ | 479 String *params, /* unused */ |
473 Cardinal *num_params) /* unused */ | 480 Cardinal *num_params) /* unused */ |
474 { | 481 { |
483 class->radio_class.drawDiamond(w) ; | 490 class->radio_class.drawDiamond(w) ; |
484 } | 491 } |
485 | 492 |
486 | 493 |
487 /* ARGSUSED */ | 494 /* ARGSUSED */ |
488 void | 495 void |
489 RadioUnset (Widget w, | 496 RadioUnset (Widget w, |
490 XEvent *event, | 497 XEvent *event, |
491 String *params, /* unused */ | 498 String *params, /* unused */ |
492 Cardinal *num_params) /* unused */ | 499 Cardinal *num_params) /* unused */ |
493 { | 500 { |