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