Toggle.h revision 421c997b
1/*
2 *
3Copyright 1989, 1994, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24 */
25
26/*
27 * ToggleP.h - Private definitions for Toggle widget
28 *
29 * Author: Chris D. Peterson
30 *         MIT X Consortium
31 *         kit@expo.lcs.mit.edu
32 *
33 * Date:   January 12, 1989
34 */
35
36#ifndef _XawToggle_h
37#define _XawToggle_h
38
39#include <X11/Xaw/Command.h>
40
41/* Resources:
42
43 Name		     Class		RepType		Default Value
44 ----		     -----		-------		-------------
45 radioGroup          RadioGroup         Widget          NULL              +
46 radioData           RadioData          Pointer         (XPointer) Widget  ++
47 state               State              Boolean         Off
48
49 background	     Background		Pixel		XtDefaultBackground
50 bitmap		     Pixmap		Pixmap		None
51 border		     BorderColor	Pixel		XtDefaultForeground
52 borderWidth	     BorderWidth	Dimension	1
53 callback	     Callback		Pointer		NULL
54 cursor		     Cursor		Cursor		None
55 destroyCallback     Callback		Pointer		NULL
56 displayList	     DisplayList	XawDisplayList*	NULL
57 font		     Font		XFontStructx*	XtDefaultFont
58 foreground	     Foreground		Pixel		XtDefaultForeground
59 height		     Height		Dimension	text height
60 highlightThickness  Thickness		Dimension	2
61 insensitiveBorder   Insensitive	Pixmap		Gray
62 internalHeight	     Height		Dimension	2
63 internalWidth	     Width		Dimension	4
64 justify	     Justify		XtJustify	XtJustifyCenter
65 label		     Label		String		NULL
66 mappedWhenManaged   MappedWhenManaged	Boolean		True
67 resize		     Resize		Boolean		True
68 sensitive	     Sensitive		Boolean		True
69 width		     Width		Dimension	text width
70 x		     Position		Position	0
71 y		     Position		Position	0
72
73+ To use the toggle as a radio toggle button, set this resource to point to
74  any other widget in the radio group.
75
76++ This is the data returned from a call to XtToggleGetCurrent, by default
77   this is set to the name of toggle widget.
78
79*/
80
81/*
82 * These should be in StringDefs.h but aren't so we will define
83 * them here if they are needed
84 */
85#define XtCWidget "Widget"
86#define XtCState "State"
87#define XtCRadioGroup "RadioGroup"
88#define XtCRadioData "RadioData"
89
90#ifndef _XtStringDefs_h_
91#define XtRWidget "Widget"
92#endif
93
94#define XtNstate "state"
95#define XtNradioGroup "radioGroup"
96#define XtNradioData "radioData"
97
98extern WidgetClass               toggleWidgetClass;
99
100typedef struct _ToggleClassRec   *ToggleWidgetClass;
101typedef struct _ToggleRec        *ToggleWidget;
102
103/*
104 * Public Functions
105 */
106
107_XFUNCPROTOBEGIN
108
109/*
110 * Function:
111 *	XawToggleChangeRadioGroup
112 *
113 * Parameters:
114 *	w	    - toggle widget to change lists
115 *	radio_group - any widget in the new list
116 *
117 * Description:
118 *	Allows a toggle widget to change radio lists.
119 */
120void XawToggleChangeRadioGroup
121(
122 Widget		w,
123 Widget		radio_group
124 );
125
126/*
127 * Function:
128 *	XawToggleGetCurrent
129 *
130 * Parameters:
131 *	radio_group - any toggle widget in the toggle list
132 *
133 * Description:
134 *	  Returns the RadioData associated with the toggle
135 *                   widget that is currently active in a toggle list.
136 * Returns:
137 *	The XtNradioData associated with the toggle widget
138 */
139
140XtPointer XawToggleGetCurrent
141(
142 Widget		radio_group
143 );
144
145/*
146 * Function:
147 *	XawToggleSetCurrent
148 *
149 * Parameters:
150 *	radio_group - any toggle widget in the toggle list
151 *	radio_data - radio data of the toggle widget to set
152 *
153 * Description:
154 *	Sets the Toggle widget associated with the radio_data specified.
155 */
156void XawToggleSetCurrent
157(
158 Widget		radio_group,
159 XtPointer	radio_data
160 );
161
162/*
163 * Function:
164 *	XawToggleUnsetCurrent
165 *
166 * Parameters:
167 *	radio_group - any toggle widget in the toggle list
168 *
169 * Description:
170 *	Unsets all Toggles in the radio_group specified.
171 */
172void XawToggleUnsetCurrent
173(
174 Widget		radio_group
175 );
176
177_XFUNCPROTOEND
178
179#endif /* _XawToggle_h */
180