annotate lwlib/xlwradio.c @ 872:79c6ff3eef26

[xemacs-hg @ 2002-06-20 21:18:01 by ben] font changes etc.; some 21.4 changes mule/mule-msw-init-late.el: Specify charset->windows-registry conversion. mule/mule-x-init.el: Delete extra mule font additions here. Put them in faces.c. cl-macs.el: Document better. font-lock.el: Move Lisp function regexp to lisp-mode.el. lisp-mode.el: Various indentation fixes: Handle flet functions better. Handle argument lists in defuns and flets. Handle quoted lists, e.g. property lists -- don't indent like function calls. Distinguish between lambdas and other lists. lisp-mode.el: Handle this form. faces.el, font-menu.el, font.el, gtk-faces.el, msw-faces.el, msw-font-menu.el, x-faces.el, x-init.el: Major overhaul of face-handling code: -- Fix lots of bogus code in msw-faces.el, msw-font-menu.el, font-menu.el that was "truenaming" font specs -- i.e. in the process of frobbing a particular field in a general user-specified font spec with wildcarded fields, sticking in particular values for all the remaining wildcarded fields. This bug was rampant everywhere except in x-faces.el (the oldest and only correctly written code). This also means that we need to work with font names at all times and not font instances, because a font instance is essentially a truenamed font. -- Total rewrite of extremely junky code in msw-faces.el. Work with names as well as font instances, and return names; stop truenaming when canonicalizing and frobbing; fix handling of the combined style field, i.e. weight/slant (also fixed in font.el). -- Totally rewrite the frobbing functions in faces.el. This time, we frob all the instantiators rather than just computing a single instance value and working backwards. That way, e.g., `bold' will work for all charsets that have bold available, rather than only for whatever charset was part of the computed font instance (another example of the truename virus). Also fix up code to look at the fallbacks (all of them) when no global value present, so we don't need to put something in the global value. Intelligently handle a request to frob a buffer locale, rather than signalling an error. When frobbing instantiators, try hard to figure out what device type is associated with them, and frob each according to its own proper device type. Correctly handle inheritance vectors given as instantiators. Preserve existing tags when putting back frobbed instantiators. Extract out general specifier-frobbing code into specifier.el. Document everything cleanly. Do lots of other things better, etc. -- Don't duplicatively set a global specification for the default font -- it's already in the fallback and we no longer need a default global specification present. Delete various code in x-faces.el and msw-faces.el that duplicated the lists of fonts in faces.c. -- init-global-faces was not being called at all under MS Windows! Major bogosity. That caused device-specific values to get stuck into all the fonts, making it very hard to change them -- setting global specs caused nothing to happen. -- Correct weight names in font.el. -- Lots more font fixups in objects*.c. Printer.el: Warning fix. specifier.el: Add more args to map-specifier. Add various "heuristic" specifier functions to aid in creation of specifier-munging code such as in faces.el. subr.el: New functions. lwlib.c: Fix warning. config.inc.samp: Clean up, add args to control fastcall (not yet supported! the changes needed are in another ws of mine), profile support, vc6 support, union-type. xemacs.dsp, xemacs.mak: Semi-major overhaul. Fix bug where dump-id was always getting recomputed, forcing a redump even when nothing changed. Add support for fastcall. Support edit-and-continue (on by default) with vc6. Use incremental linking when doing a debug compilation. Add support for profiling. Consolidate the various debug flags. Partial support for "batch-compiling" -- compiling many files on a single invocation of the compiler. Doesn't seem to help that much for me, so it's not finished or enabled by default. Remove HAVE_MSW_C_DIRED, we always do. Correct some sloppy use of directories. s/cygwin32.h: Allow pdump to work under Cygwin (mmap is broken, so need to undefine HAVE_MMAP). s/win32-common.h, s/windowsnt.h: Support for fastcall. Add WIN32_ANY for identifying all Win32 variants (Cygwin, native, MinGW). Both of these are properly used in another ws. alloc.c, balloon-x.c, buffer.c, bytecode.c, callint.c, cm.c, cmdloop.c, cmds.c, console-gtk.c, console-gtk.h, console-msw.c, console-msw.h, console-stream.c, console-stream.h, console-tty.c, console-tty.h, console-x.c, console-x.h, console.c, console.h, device-gtk.c, device-msw.c, device-tty.c, device-x.c, device.c, device.h, devslots.h, dialog-gtk.c, dialog-msw.c, dialog-x.c, dialog.c, dired-msw.c, editfns.c, emacs.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, event-unixoid.c, events.c, extents.c, extents.h, faces.c, fileio.c, fns.c, frame-gtk.c, frame-msw.c, frame-tty.c, frame-x.c, frame.c, frame.h, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gui-gtk.c, gui-msw.c, gui-x.c, gui.c, gutter.c, input-method-xlib.c, intl-encap-win32.c, intl-win32.c, keymap.c, lisp.h, macros.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, menubar.h, minibuf.c, mule-charset.c, nt.c, objects-gtk.c, objects-gtk.h, objects-msw.c, objects-msw.h, objects-tty.c, objects-tty.h, objects-x.c, objects-x.h, objects.c, objects.h, postgresql.c, print.c, process.h, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, redisplay.h, scrollbar-gtk.c, scrollbar-msw.c, scrollbar-x.c, scrollbar.c, select-gtk.c, select-msw.c, select-x.c, select.c, signal.c, sound.c, specifier.c, symbols.c, syntax.c, sysdep.c, syssignal.h, syswindows.h, toolbar-common.c, toolbar-gtk.c, toolbar-msw.c, toolbar-x.c, toolbar.c, unicode.c, window.c, window.h: The following are the major changes made: (1) Separation of various header files into an external and an internal version, similar to the existing separation of process.h and procimpl.h. Eventually this should be done for all Lisp objects. The external version has the same name as currently; the internal adds -impl. The external file has XFOO() macros for objects, but the structure is opaque and defined only in the internal file. It's now reasonable to move all prototypes in lisp.h into the appropriate external file, and this should be done. Currently, separation has been done on extents.h, objects*.h, console.h, device.h, frame.h, and window.h. For c/d/f/w, the most basic properties are available in the external header file, with the macros resolving to functions. In the internal header file, the macros are redefined to directly access the structure. Also, the global MARK_FOO_CHANGED macros have been made into functions so that they can be accessed without needing to include lots of -impl headers -- they are used in almost exclusively in non-time-critical functions, and take up enough time that the function overhead will be negligible. Similarly, the function overhead from making the basic properties mentioned above into functions is negligible, and code that does heavy accessing of c/d/f/w structures inevitably ends up needing the internal header files, anyway. (2) More face changes. -- Major rewrite of objects-msw.c. Now handles wildcard specs properly, rather than "truenaming" (or even worse, signalling an error, which previously happened with some of the fallbacks if you tried to use them in make-font-instance!). -- Split charset matching of fonts into two stages -- one to find a font specifically designed for a particular charset (by examining its registry), the second to find a Unicode font that can support the charset. This needs to proceed as two complete, separate instantiations in order to work properly (otherwise many of the fonts in the HELLO page look wrong). This should also make it easy to support iso10646 (Unicode) fonts under X. -- All default values for fonts are now completely specified in the fallbacks. Stuff from mule-x-init.el has all been moved here, merged with the existing specs, and totally rethought so you get sensible results. (HELLO now looks much better!). -- Generalize the "default X/GTK device" stuff into a per-device-type "default device". -- Add mswindows-{set-}charset-registry. In time, charset<->code-page conversion functions will be removed. -- Wrap protective code around calls to compute device specifier tags, and do this computation before calling the face initialization code because the latter may need these tags to be correctly updated. (3) Other changes. EmacsFrame.c, glyphs-msw.c, eval.c, gui-x.c, intl-encap-win32.c, search.c, signal.c, toolbar-msw.c, unicode.c: Warning fixes. config.h.in: #undefs meant to be frobbed by configure *MUST* go inside of #ifndef WIN32_NO_CONFIGURE, and everything else *MUST* go outside! eval.c: Let detailed backtraces be detailed. specifier.c: Don't override user's print-string-length/print-length settings. glyphs.c: New function image-instance-instantiator. config.h.in, sysdep.c: Changes for fastcall. sysdep.c, nt.c: Fix up a previous botched patch that tried to add support for both EEXIST and EACCES. IF THE BOTCHED PATCH WENT INTO 21.4, THIS FIXUP NEEDS TO GO IN, TOO. search.c: Fix *evil* crash due to incorrect synching of syntax-cache code with 21.1. THIS SHOULD GO INTO 21.4.
author ben
date Thu, 20 Jun 2002 21:19:10 +0000
parents c33ae14dd6d0
children c2569faae8ed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
1 /* Radio Widget for XEmacs.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
2 Copyright (C) 1999 Edward A. Falk
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
3
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
4 This file is part of XEmacs.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
5
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
9 later version.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
10
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
14 for more details.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
15
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
20
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
21 /* Synched up with: Radio.c 1.1 */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
22
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
23 /*
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
24 * Radio.c - Radio button widget
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
25 *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
26 * Author: Edward A. Falk
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
27 * falk@falconer.vip.best.com
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
28 *
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
29 * Date: June 30, 1997
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
30 *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
31 *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
32 * Overview: This widget is identical to the Toggle widget in behavior,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
33 * but completely different in appearance. This widget looks like a small
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
34 * diamond-shaped button with a label to the right.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
35 *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
36 * To make this work, we subclass the Toggle widget to inherit its behavior
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
37 * and to inherit the label-drawing function from which Toggle is
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
38 * subclassed. We then completely replace the Expose, Set, Unset
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
39 * and Highlight member functions.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
40 *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
41 * The Set and Unset actions are slightly unorthodox. In Toggle's
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
42 * ClassInit function, Toggle searches the Command actions list and
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
43 * "steals" the Set and Unset functions, caching pointers to them in its
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
44 * class record. It then calls these functions from its own ToggleSet
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
45 * and Toggle actions.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
46 *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
47 * We, in turn, override the Set() and Unset() actions in our own ClassRec.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
48 */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
49
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
50
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
51 #include <config.h>
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
52 #include <stdio.h>
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
53
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
54 #include <X11/IntrinsicP.h>
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
55 #include <X11/StringDefs.h>
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
56 #include ATHENA_XawInit_h_
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
57 #include "../src/xmu.h"
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
58 #include "xlwradioP.h"
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
59
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
60 #define BOX_SIZE 13
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
61
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
62 #define rclass(w) ((RadioWidgetClass)((w)->core.widget_class))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
63
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
64
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
65 #ifdef _ThreeDP_h
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
66 #define swid(rw) ((rw)->threeD.shadow_width)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
67 #else
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
68 #define swid(rw) ((rw)->core.border_width)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
69 #endif
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
70
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
71 #define bsize(rw) (rclass(rw)->radio_class.dsize)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
72 #define bs(rw) (bsize(rw) + 2*swid(rw))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
73
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
74
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
75
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
76 /****************************************************************
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
77 *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
78 * Full class record constant
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
79 *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
80 ****************************************************************/
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
81
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
82 /* The translations table from Toggle do not need to be
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
83 * overridden by Radio
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
84 */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
85
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
86
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
87 /* Member functions */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
88
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
89 static void RadioInit (Widget, Widget, ArgList, Cardinal *);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
90 static void RadioExpose (Widget, XEvent *, Region);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
91 static void RadioResize (Widget);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
92 static void RadioDestroy (Widget, XtPointer, XtPointer);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
93 static void RadioClassInit (void);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
94 static void RadioClassPartInit (WidgetClass);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
95 static Boolean RadioSetValues (Widget, Widget, Widget, ArgList, Cardinal *);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
96 static void DrawDiamond (Widget);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
97 static XtGeometryResult RadioQueryGeometry (Widget, XtWidgetGeometry *,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
98 XtWidgetGeometry *);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
99
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
100 /* Action procs */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
101
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
102 static void RadioHighlight (Widget, XEvent *, String *, Cardinal *);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
103 static void RadioUnhighlight (Widget, XEvent *, String *, Cardinal *);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
104
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
105 /* internal privates */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
106
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
107 static void RadioSize (RadioWidget, Dimension *, Dimension *);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
108
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
109 /* The actions table from Toggle is almost perfect, but we need
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
110 * to override Highlight, Set, and Unset.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
111 */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
112
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
113 static XtActionsRec actionsList[] =
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
114 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
115 {"highlight", RadioHighlight},
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
116 {"unhighlight", RadioUnhighlight},
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
117 };
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
118
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
119 #define SuperClass ((ToggleWidgetClass)&toggleClassRec)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
120
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
121 RadioClassRec radioClassRec = {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
122 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
123 (WidgetClass) SuperClass, /* superclass */
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
124 "Radio", /* class_name */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
125 sizeof(RadioRec), /* size */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
126 RadioClassInit, /* class_initialize */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
127 RadioClassPartInit, /* class_part_initialize */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
128 FALSE, /* class_inited */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
129 RadioInit, /* initialize */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
130 NULL, /* initialize_hook */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
131 XtInheritRealize, /* realize */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
132 actionsList, /* actions */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
133 XtNumber(actionsList), /* num_actions */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
134 NULL, /* resources */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
135 0, /* resource_count */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
136 NULLQUARK, /* xrm_class */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
137 TRUE, /* compress_motion */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
138 TRUE, /* compress_exposure */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
139 TRUE, /* compress_enterleave */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
140 FALSE, /* visible_interest */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
141 NULL, /* destroy */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
142 RadioResize, /* resize */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
143 RadioExpose, /* expose */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
144 RadioSetValues, /* set_values */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
145 NULL, /* set_values_hook */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
146 XtInheritSetValuesAlmost, /* set_values_almost */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
147 NULL, /* get_values_hook */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
148 NULL, /* accept_focus */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
149 XtVersion, /* version */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
150 NULL, /* callback_private */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
151 XtInheritTranslations, /* tm_table */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
152 RadioQueryGeometry, /* query_geometry */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
153 XtInheritDisplayAccelerator, /* display_accelerator */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
154 NULL /* extension */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
155 }, /* CoreClass fields initialization */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
156 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
157 XtInheritChangeSensitive /* change_sensitive */
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
158 }, /* SimpleClass fields initialization */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
159 #ifdef _ThreeDP_h
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
160 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
161 XtInheritXaw3dShadowDraw /* field not used */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
162 }, /* ThreeDClass fields initialization */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
163 #endif
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
164 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
165 0 /* field not used */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
166 }, /* LabelClass fields initialization */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
167 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
168 0 /* field not used */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
169 }, /* CommandClass fields initialization */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
170 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
171 RadioSet, /* Set Procedure. */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
172 RadioUnset, /* Unset Procedure. */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
173 NULL /* extension. */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
174 }, /* ToggleClass fields initialization */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
175 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
176 BOX_SIZE,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
177 DrawDiamond, /* draw procedure */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
178 NULL /* extension. */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
179 } /* RadioClass fields initialization */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
180 };
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
181
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
182 /* for public consumption */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
183 WidgetClass radioWidgetClass = (WidgetClass) &radioClassRec;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
184
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
185
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
186
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
187
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
188
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
189
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
190 /****************************************************************
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
191 *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
192 * Class Methods
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
193 *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
194 ****************************************************************/
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
195
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
196 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
197 RadioClassInit (void)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
198 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
199 XawInitializeWidgetSet();
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
200 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
201
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
202 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
203 RadioClassPartInit (WidgetClass class)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
204 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
205 RadioWidgetClass c = (RadioWidgetClass) class ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
206 RadioWidgetClass super = (RadioWidgetClass)c->core_class.superclass ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
207
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
208 if( c->radio_class.drawDiamond == NULL ||
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
209 c->radio_class.drawDiamond == XtInheritDrawDiamond )
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
210 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
211 c->radio_class.drawDiamond = super->radio_class.drawDiamond ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
212 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
213 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
214
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
215
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
216
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
217
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
218 /*ARGSUSED*/
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
219 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
220 RadioInit (Widget request,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
221 Widget new,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
222 ArgList args,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
223 Cardinal *num_args)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
224 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
225 RadioWidget rw = (RadioWidget) new;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
226 RadioWidget rw_req = (RadioWidget) request;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
227 Dimension w,h ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
228
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
229 /* Select initial size for the widget */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
230 if( rw_req->core.width == 0 || rw_req->core.height == 0 )
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
231 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
232 RadioSize(rw, &w,&h) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
233 if( rw_req->core.width == 0 )
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
234 rw->core.width = w ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
235 if( rw_req->core.height == 0 )
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
236 rw->core.height = h ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
237 rw->core.widget_class->core_class.resize(new) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
238 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
239 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
240
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
241 /* Function Name: RadioDestroy
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
242 * Description: Destroy Callback for radio widget.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
243 * Arguments: w - the radio widget that is being destroyed.
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
244 * junk, garbage - not used.
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
245 * Returns: none.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
246 */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
247
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
248 /* ARGSUSED */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
249 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
250 RadioDestroy (Widget w,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
251 XtPointer junk,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
252 XtPointer garbage)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
253 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
254 /* TODO: get rid of this */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
255 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
256
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
257
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
258 /* React to size change from manager. Label widget will compute some internal
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
259 * stuff, but we need to override. This code requires knowledge of the
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
260 * internals of the Label widget.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
261 */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
262
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
263 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
264 RadioResize (Widget w)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
265 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
266 RadioWidget rw = (RadioWidget)w ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
267
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
268 /* call parent resize proc */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
269 SuperClass->core_class.resize(w) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
270
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
271 /* override label offset */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
272
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
273 switch( rw->label.justify ) {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
274 case XtJustifyLeft:
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
275 rw->label.label_x += (bs(rw) + rw->label.internal_width) ;
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
276 break ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
277 case XtJustifyRight:
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
278 break ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
279 case XtJustifyCenter:
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
280 default:
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
281 rw->label.label_x += (bs(rw) + rw->label.internal_width)/2;
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
282 break ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
283 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
284 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
285
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
286
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
287 /*
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
288 * Repaint the widget window.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
289 */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
290
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
291 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
292 RadioExpose (Widget w,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
293 XEvent *event,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
294 Region region)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
295 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
296 RadioWidget rw = (RadioWidget) w ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
297 Display *dpy = XtDisplay(w) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
298 Window win = XtWindow(w) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
299 GC gc ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
300 Pixmap left_bitmap ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
301 extern WidgetClass labelWidgetClass ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
302
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
303 /* Note: the Label widget examines the region to decide if anything
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
304 * needs to be drawn. I'm not sure that this is worth the effort,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
305 * but it bears thinking on.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
306 */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
307
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
308 /* Command widget may sometimes override the label GC in order
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
309 * to draw inverse video. We don't use inverse video, so we need
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
310 * to restore the label's normal GC.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
311 */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
312 rw->label.normal_GC = rw->command.normal_GC ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
313
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
314
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
315 /* Let label widget draw the label. If there was an lbm_x
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
316 * field, we could let Label draw the bitmap too. But there
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
317 * isn't, so we need to temporarily remove the bitmap and
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
318 * draw it ourself later.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
319 */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
320 left_bitmap = rw->label.left_bitmap ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
321 rw->label.left_bitmap = None ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
322 labelWidgetClass->core_class.expose(w,event,region) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
323 rw->label.left_bitmap = left_bitmap ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
324
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
325 /* now manually draw the left bitmap. TODO: 3-d look, xaw-xpm */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
326 gc = XtIsSensitive(w) ? rw->label.normal_GC : rw->label.gray_GC ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
327 if( left_bitmap != None && rw->label.lbm_width > 0 )
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
328 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
329 /* TODO: handle pixmaps */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
330 XCopyPlane(dpy, left_bitmap, win, gc,
458
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 442
diff changeset
331 0,0, rw->label.lbm_width, rw->label.lbm_height,
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 442
diff changeset
332 (int) rw->label.internal_width*2 + bs(rw),
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 442
diff changeset
333 (int) rw->label.internal_height + rw->label.lbm_y,
c33ae14dd6d0 Import from CVS: tag r21-2-44
cvs
parents: 442
diff changeset
334 1UL) ;
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
335 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
336
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
337 /* Finally, the button itself */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
338 ((RadioWidgetClass)(w->core.widget_class))->radio_class.drawDiamond(w) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
339 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
340
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
341
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
342
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
343
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
344 /************************************************************
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
345 *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
346 * Set specified arguments into widget
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
347 *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
348 ***********************************************************/
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
349
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
350
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
351 /* ARGSUSED */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
352 static Boolean
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
353 RadioSetValues (Widget current,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
354 Widget request,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
355 Widget new,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
356 ArgList args,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
357 Cardinal *num_args)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
358 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
359 RadioWidget oldrw = (RadioWidget) current;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
360 RadioWidget newrw = (RadioWidget) new;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
361
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
362 /* Need to find out if the size of the widget changed. Set new size
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
363 * if it did and resize is permitted. One way to determine of the
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
364 * widget changed size would be to scan the args list. Another way
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
365 * is to compare the old and new widgets and see if any of several
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
366 * size-related fields have been changed. The Label widget chose the
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
367 * former method, but I choose the latter.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
368 */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
369
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
370 if( newrw->label.resize &&
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
371 ( newrw->core.width != oldrw->core.width ||
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
372 newrw->core.height != oldrw->core.height ||
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
373 newrw->core.border_width != oldrw->core.border_width ) )
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
374 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
375 RadioSize(newrw, &newrw->core.width, &newrw->core.height) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
376 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
377
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
378 /* The label set values routine can resize the widget. We need to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
379 * recalculate if this is true.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
380 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
381 if (newrw->label.label_x != oldrw->label.label_x)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
382 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
383 RadioResize (new);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
384 }
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
385 return FALSE ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
386 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
387
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
388 static XtGeometryResult
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
389 RadioQueryGeometry (Widget w,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
390 XtWidgetGeometry *intended,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
391 XtWidgetGeometry *preferred)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
392 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
393 RadioWidget rw = (RadioWidget) w;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
394
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
395 preferred->request_mode = CWWidth | CWHeight;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
396 RadioSize(rw, &preferred->width, &preferred->height) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
397
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
398 if ( ((intended->request_mode & (CWWidth | CWHeight))
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
399 == (CWWidth | CWHeight)) &&
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
400 intended->width == preferred->width &&
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
401 intended->height == preferred->height)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
402 return XtGeometryYes;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
403 else if (preferred->width == w->core.width &&
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
404 preferred->height == w->core.height)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
405 return XtGeometryNo;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
406 else
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
407 return XtGeometryAlmost;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
408 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
409
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
410
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
411
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
412
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
413
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
414 /************************************************************
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
415 *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
416 * Action Procedures
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
417 *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
418 ************************************************************/
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
419
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
420 /*
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
421 * Draw the highlight border around the widget. The Command widget
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
422 * did this by drawing through a mask. We do it by just drawing the
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
423 * border.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
424 */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
425
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
426 static void
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
427 DrawHighlight (Widget w,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
428 GC gc)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
429 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
430 RadioWidget rw = (RadioWidget)w;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
431 XRectangle rects[4] ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
432 Dimension ht = rw->command.highlight_thickness ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
433
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
434 if( ht <= 0 ||
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
435 ht > rw->core.width/2 ||
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
436 ht > rw->core.height/2 )
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
437 return ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
438
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
439 if( ! XtIsRealized(w) )
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
440 return ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
441
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
442 rects[0].x = 0 ; rects[0].y = 0 ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
443 rects[0].width = rw->core.width ; rects[0].height = ht ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
444 rects[1].x = 0 ; rects[1].y = rw->core.height - ht ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
445 rects[1].width = rw->core.width ; rects[1].height = ht ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
446 rects[2].x = 0 ; rects[2].y = ht ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
447 rects[2].width = ht ; rects[2].height = rw->core.height - ht*2 ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
448 rects[3].x = rw->core.width - ht ; rects[3].y = ht ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
449 rects[3].width = ht ; rects[3].height = rw->core.height - ht*2 ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
450 XFillRectangles( XtDisplay(w), XtWindow(w), gc, rects, 4) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
451 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
452
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
453 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
454 RadioHighlight (Widget w,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
455 XEvent *event,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
456 String *params,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
457 Cardinal *num_params)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
458 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
459 RadioWidget rw = (RadioWidget)w;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
460 DrawHighlight(w, rw->command.normal_GC) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
461 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
462
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
463
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
464 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
465 RadioUnhighlight (Widget w,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
466 XEvent *event,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
467 String *params,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
468 Cardinal *num_params)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
469 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
470 RadioWidget rw = (RadioWidget)w;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
471 DrawHighlight(w, rw->command.inverse_GC) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
472 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
473
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
474
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
475 /* ARGSUSED */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
476 void
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
477 RadioSet (Widget w,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
478 XEvent *event,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
479 String *params, /* unused */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
480 Cardinal *num_params) /* unused */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
481 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
482 RadioWidget rw = (RadioWidget)w;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
483 RadioWidgetClass class = (RadioWidgetClass) w->core.widget_class ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
484
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
485 if( rw->command.set )
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
486 return ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
487
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
488 rw->command.set = TRUE ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
489 if( XtIsRealized(w) )
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
490 class->radio_class.drawDiamond(w) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
491 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
492
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
493
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
494 /* ARGSUSED */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 434
diff changeset
495 void
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
496 RadioUnset (Widget w,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
497 XEvent *event,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
498 String *params, /* unused */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
499 Cardinal *num_params) /* unused */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
500 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
501 RadioWidget rw = (RadioWidget)w;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
502 RadioWidgetClass class = (RadioWidgetClass) w->core.widget_class ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
503
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
504 if( ! rw->command.set )
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
505 return ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
506
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
507 rw->command.set = FALSE ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
508 if( XtIsRealized(w) )
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
509 class->radio_class.drawDiamond(w) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
510 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
511
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
512
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
513
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
514
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
515 /************************************************************
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
516 *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
517 * Internal Procedures
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
518 *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
519 ************************************************************/
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
520
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
521
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
522 /* Size of widget. Width is size of box plus width of border around
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
523 * box plus width of label plus three margins plus the size of the left
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
524 * bitmap, if any. Height is max(box,bitmap,label) plus two margins.
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
525 */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
526
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
527 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
528 RadioSize (RadioWidget rw,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
529 Dimension *w,
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
530 Dimension *h)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
531 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
532 *w = rw->label.label_width + bs(rw) + LEFT_OFFSET(rw) +
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
533 3 * rw->label.internal_width ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
534 *h = Max( rw->label.label_height, bs(rw) ) +
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
535 2 * rw->label.internal_width ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
536 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
537
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
538
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
539 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
540 DrawDiamond (Widget w)
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
541 {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
542 RadioWidget rw = (RadioWidget) w ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
543 Display *dpy = XtDisplay(w) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
544 Window win = XtWindow(w) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
545 GC gc, gci ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
546
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
547 XPoint pts[5] ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
548 Dimension del = bsize(rw)/2 ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
549 Position x,y ; /* diamond center */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
550 #ifdef _ThreeDP_h
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
551 int i=0;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
552 Dimension s = swid(rw) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
553 GC top, bot, ctr ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
554 #endif
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
555 gc = XtIsSensitive(w) ? rw->command.normal_GC : rw->label.gray_GC ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
556
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
557 gci = rw->command.set ? rw->command.normal_GC : rw->command.inverse_GC ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
558
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
559 x = rw->label.internal_width + bs(rw)/2 ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
560 y = rw->core.height/2 ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
561
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
562 #ifdef _ThreeDP_h
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
563 if( ! rw->command.set ) {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
564 top = rw->threeD.top_shadow_GC ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
565 bot = rw->threeD.bot_shadow_GC ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
566 ctr = gc ; /* TODO */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
567 } else {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
568 top = rw->threeD.bot_shadow_GC ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
569 bot = rw->threeD.top_shadow_GC ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
570 ctr = gc ; /* TODO */
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
571 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
572 #endif
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
573
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
574 pts[0].x = x - del ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
575 pts[0].y = y ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
576 pts[1].x = x ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
577 pts[1].y = y - del ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
578 pts[2].x = x + del ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
579 pts[2].y = y ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
580 pts[3].x = x ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
581 pts[3].y = y + del ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
582 pts[4] = pts[0] ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
583 XFillPolygon(dpy,win,gci, pts,4, Convex, CoordModeOrigin) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
584
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
585 #ifdef _ThreeDP_h
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
586 for(i=0; i<s; ++i) {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
587 XDrawLine(dpy,win,bot, x-i-del,y, x,y+del+i) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
588 XDrawLine(dpy,win,bot, x+del+i,y, x,y+del+i) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
589 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
590 for(i=0; i<s; ++i) {
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
591 XDrawLine(dpy,win,top, x-del-i,y, x,y-del-i) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
592 XDrawLine(dpy,win,top, x+del+i,y, x,y-del-i) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
593 }
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
594 #else
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
595 XDrawLines(dpy,win,gc, pts,5, CoordModeOrigin) ;
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
596 #endif
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents:
diff changeset
597 }