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