1 /**
2  *
3  * $Header: /cvsroot/lesstif/lesstif/include/Motif-2.1/Xm/NotebookP.h,v 1.1 2004/08/28 19:23:25 dannybackx Exp $
4  *
5  * Copyright (C) 1995 Free Software Foundation, Inc.
6  * Copyright (C) 1995-2000 LessTif Development Team
7  *
8  * This file is part of the GNU LessTif Library.
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Library General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU Library General Public
21  * License along with this library; if not, write to the Free
22  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  *
24  **/
25 
26 #ifndef _XM_NOTEBOOKP_H
27 #define _XM_NOTEBOOKP_H
28 
29 #include <Xm/ManagerP.h>
30 #include <Xm/Notebook.h>
31 #include <Xm/ScrollFrameT.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /* Notebook's constraint info. fields */
38 typedef struct _XmNotebookConstraintPart
39 {
40     int page_number;
41     unsigned char child_type;
42     Boolean resizable;
43     Boolean active;
44 } XmNotebookConstraintPart, *XmNotebookConstraint;
45 
46 typedef struct _XmNotebookConstraintRec
47 {
48     XmManagerConstraintPart manager;
49     XmNotebookConstraintPart notebook;
50 } XmNotebookConstraintRec, *XmNotebookConstraintPtr;
51 
52 /* Define the notebook instance part */
53 typedef struct {
54         int current_page_number;
55 	int first_page_number;
56 	int last_page_number;
57 	unsigned char orientation;
58 	unsigned char back_page_pos;
59 	Cardinal back_page_number;
60 	Dimension back_page_size;
61 	Pixel back_page_foreground;
62 	Pixel back_page_background;
63 	Pixel frame_background;
64 	unsigned char binding_type;
65 	Pixmap binding_pixmap;
66 	Pixmap spiral_pixmap;
67 	Dimension binding_width;
68 	Dimension margin_width;
69 	Dimension margin_height;
70 	Dimension major_spacing;
71 	Dimension minor_spacing;
72 	Dimension shadow_thickness;
73 	XtCallbackList page_change_callback;
74 	Widget scroller;
75 	Widget scroller_child;
76 	Widget next_major;
77 	Widget prev_major;
78 	Widget next_minor;
79 	Widget prev_minor;
80 	Dimension real_binding_width;
81 	Dimension real_back_page_number;
82 	Dimension page_width;
83 	Dimension page_height;
84 	Dimension status_width;
85 	Dimension status_height;
86 	Dimension major_width;
87 	Dimension major_height;
88 	Dimension minor_width;
89 	Dimension minor_height;
90 	Dimension scroller_width;
91 	Dimension scroller_height;
92 	Dimension major_scroller_width;
93 	Dimension major_scroller_height;
94 	Dimension minor_scroller_width;
95 	Dimension minor_scroller_height;
96 	Dimension frame_width;
97 	Dimension frame_height;
98 	Widget first_major;
99 	Widget old_top_major;
100 	Widget top_major;
101 	Widget last_major;
102 	Widget first_minor;
103 	Widget old_top_minor;
104 	Widget top_minor;
105 	Widget last_minor;
106 	Widget constraint_child;
107 	Dimension major_shadow_thickness;
108 	Dimension minor_shadow_thickness;
109 	Widget major_shadow_child;
110 	Widget minor_shadow_child;
111 	Boolean in_setshadow;
112 	unsigned char major_pos;
113 	unsigned char minor_pos;
114 	unsigned char binding_pos;
115 	unsigned char which_tab;
116 	int last_alloc_num;
117 	unsigned char scroller_status;
118 	unsigned short need_scroller;
119 	Boolean dynamic_last_page_num;
120 	Boolean in_callback;
121 	GC back_page_gc;
122 	GC frame_gc;
123 	GC binding_gc;
124 	GC foreground_gc;
125 	GC background_gc;
126 	Boolean first_change_managed;
127 	XmScrollFrameData scroll_frame_data;
128 } XmNotebookPart;
129 
130 /* Define the full instance record */
131 typedef struct _XmNotebookRec {
132     CorePart core;
133     CompositePart composite;
134     ConstraintPart constraint;
135     XmManagerPart manager;
136     XmNotebookPart notebook;
137 } XmNotebookRec;
138 
139 /* Define class part structure */
140 typedef struct {
141     XtPointer extension;
142 } XmNotebookClassPart;
143 
144 /* Define the full class record */
145 typedef struct _XmNotebookClassRec {
146     CoreClassPart core_class;
147     CompositeClassPart composite_class;
148     ConstraintClassPart constraint_class;
149     XmManagerClassPart manager_class;
150     XmNotebookClassPart notebook_class;
151 } XmNotebookClassRec;
152 
153 XMLIBEXPORT extern XmNotebookClassRec xmNotebookClassRec;
154 
155 /*
156  * actions
157  */
158 
159 /*
160  * Access macros
161  */
162 #define NB_FirstPageNumber(w)		\
163 			(((XmNotebookWidget)w)->notebook.first_page_number)
164 #define NB_LastPageNumber(w)		\
165 			(((XmNotebookWidget)w)->notebook.last_page_number)
166 #define NB_Orientation(w)		\
167 			(((XmNotebookWidget)w)->notebook.orientation)
168 #define NB_BackPagePos(w)		\
169 			(((XmNotebookWidget)w)->notebook.back_page_pos)
170 #define NB_BackPageNumber(w)		\
171 			(((XmNotebookWidget)w)->notebook.back_page_number)
172 #define NB_BackPageSize(w)		\
173 			(((XmNotebookWidget)w)->notebook.back_page_size)
174 #define NB_BackPageForeground(w)	\
175 			(((XmNotebookWidget)w)->notebook.back_page_foreground)
176 #define NB_BackPageBackground(w)	\
177 			(((XmNotebookWidget)w)->notebook.back_page_background)
178 #define NB_FrameBackground(w)		\
179 			(((XmNotebookWidget)w)->notebook.frame_background)
180 #define NB_BindingType(w)		\
181 			(((XmNotebookWidget)w)->notebook.binding_type)
182 #define NB_BindingPixmap(w)		\
183 			(((XmNotebookWidget)w)->notebook.binding_pixmap)
184 #define NB_SpiralPixmap(w)		\
185 			(((XmNotebookWidget)w)->notebook.spiral_pixmap)
186 #define NB_BindingWidth(w)		\
187 			(((XmNotebookWidget)w)->notebook.binding_width)
188 #define NB_MarginWidth(w)		\
189 			(((XmNotebookWidget)w)->notebook.margin_width)
190 #define NB_MarginHeight(w)		\
191 			(((XmNotebookWidget)w)->notebook.margin_height)
192 #define NB_MajorSpacing(w)		\
193 			(((XmNotebookWidget)w)->notebook.major_spacing)
194 #define NB_MinorSpacing(w)		\
195 			(((XmNotebookWidget)w)->notebook.minor_spacing)
196 #define NB_ShadowThickness(w)		\
197 			(((XmNotebookWidget)w)->notebook.shadow_thickness)
198 #define NB_PageChangeCallback(w)	\
199 			(((XmNotebookWidget)w)->notebook.page_change_callback)
200 #define NB_Scroller(w)			\
201 			(((XmNotebookWidget)w)->notebook.scroller)
202 #define NB_ScrollerChild(w)		\
203 			(((XmNotebookWidget)w)->notebook.scroller_child)
204 #define NB_NextMajor(w)			\
205 			(((XmNotebookWidget)w)->notebook.next_major)
206 #define NB_PrevMajor(w)			\
207 			(((XmNotebookWidget)w)->notebook.prev_major)
208 #define NB_NextMinor(w)			\
209 			(((XmNotebookWidget)w)->notebook.next_minor)
210 #define NB_PrevMinor(w)			\
211 			(((XmNotebookWidget)w)->notebook.prev_minor)
212 #define NB_RealBindingWidth(w)		\
213 			(((XmNotebookWidget)w)->notebook.real_binding_width)
214 #define NB_RealBackPageNumber(w)	\
215 			(((XmNotebookWidget)w)->notebook.real_back_page_number)
216 #define NB_PageWidth(w)			\
217 			(((XmNotebookWidget)w)->notebook.page_width)
218 #define NB_PageHeight(w)		\
219 			(((XmNotebookWidget)w)->notebook.page_height)
220 #define NB_StatusWidth(w)		\
221 			(((XmNotebookWidget)w)->notebook.status_width)
222 #define NB_StatusHeight(w)		\
223 			(((XmNotebookWidget)w)->notebook.status_height)
224 #define NB_MajorWidth(w)		\
225 			(((XmNotebookWidget)w)->notebook.major_width)
226 #define NB_MajorHeight(w)		\
227 			(((XmNotebookWidget)w)->notebook.major_height)
228 #define NB_MinorWidth(w)		\
229 			(((XmNotebookWidget)w)->notebook.minor_width)
230 #define NB_MinorHeight(w)		\
231 			(((XmNotebookWidget)w)->notebook.minor_height)
232 #define NB_ScrollerWidth(w)		\
233 			(((XmNotebookWidget)w)->notebook.scroller_width)
234 #define NB_ScrollerHeight(w)		\
235 			(((XmNotebookWidget)w)->notebook.scroller_height)
236 #define NB_MajorScrollerWidth(w)	\
237 			(((XmNotebookWidget)w)->notebook.major_scroller_width)
238 #define NB_MajorScrollerHeight(w)	\
239 			(((XmNotebookWidget)w)->notebook.major_scroller_height)
240 #define NB_MinorScrollerWidth(w)	\
241 			(((XmNotebookWidget)w)->notebook.minor_scroller_width)
242 #define NB_MinorScrollerHeight(w)	\
243 			(((XmNotebookWidget)w)->notebook.minor_scroller_height)
244 #define NB_FrameWidth(w)		\
245 			(((XmNotebookWidget)w)->notebook.frame_width)
246 #define NB_FrameHeight(w)		\
247 			(((XmNotebookWidget)w)->notebook.frame_height)
248 #define NB_FirstMajor(w)		\
249 			(((XmNotebookWidget)w)->notebook.first_major)
250 #define NB_OldTopMajor(w)		\
251 			(((XmNotebookWidget)w)->notebook.old_top_major)
252 #define NB_TopMajor(w)			\
253 			(((XmNotebookWidget)w)->notebook.top_major)
254 #define NB_LastMajor(w)			\
255 			(((XmNotebookWidget)w)->notebook.last_major)
256 #define NB_FirstMinor(w)		\
257 			(((XmNotebookWidget)w)->notebook.first_minor)
258 #define NB_OldTopMinor(w)		\
259 			(((XmNotebookWidget)w)->notebook.old_top_minor)
260 #define NB_TopMinor(w)			\
261 			(((XmNotebookWidget)w)->notebook.top_minor)
262 #define NB_LastMinor(w)			\
263 			(((XmNotebookWidget)w)->notebook.last_minor)
264 #define NB_ConstraintChild(w)		\
265 			(((XmNotebookWidget)w)->notebook.constraint_child)
266 #define NB_MajorShadowThickness(w)	\
267 			(((XmNotebookWidget)w)->notebook.major_shadow_thickness)
268 #define NB_MinorShadowThickness(w)	\
269 			(((XmNotebookWidget)w)->notebook.minor_shadow_thickness)
270 #define NB_MajorShadowChild(w)		\
271 			(((XmNotebookWidget)w)->notebook.major_shadow_child)
272 #define NB_MinorShadowChild(w)		\
273 			(((XmNotebookWidget)w)->notebook.minor_shadow_child)
274 #define NB_InSetshadow(w)		\
275 			(((XmNotebookWidget)w)->notebook.in_setshadow)
276 #define NB_MajorPos(w)			\
277 			(((XmNotebookWidget)w)->notebook.major_pos)
278 #define NB_MinorPos(w)			\
279 			(((XmNotebookWidget)w)->notebook.minor_pos)
280 #define NB_BindingPos(w)		\
281 			(((XmNotebookWidget)w)->notebook.binding_pos)
282 #define NB_WhichTab(w)			\
283 			(((XmNotebookWidget)w)->notebook.which_tab)
284 #define NB_LastAllocNum(w)		\
285 			(((XmNotebookWidget)w)->notebook.last_alloc_num)
286 #define NB_ScrollerStatus(w)		\
287 			(((XmNotebookWidget)w)->notebook.scroller_status)
288 #define NB_NeedScroller(w)		\
289 			(((XmNotebookWidget)w)->notebook.need_scroller)
290 #define NB_DynamicLastPageNum(w)	\
291 			(((XmNotebookWidget)w)->notebook.dynamic_last_page_num)
292 #define NB_InCallback(w)		\
293 			(((XmNotebookWidget)w)->notebook.in_callback)
294 #define NB_BackPageGc(w)		\
295 			(((XmNotebookWidget)w)->notebook.back_page_gc)
296 #define NB_FrameGc(w)			\
297 			(((XmNotebookWidget)w)->notebook.frame_gc)
298 #define NB_BindingGc(w)			\
299 			(((XmNotebookWidget)w)->notebook.binding_gc)
300 #define NB_ForegroundGc(w)		\
301 			(((XmNotebookWidget)w)->notebook.foreground_gc)
302 #define NB_BackgroundGc(w)		\
303 			(((XmNotebookWidget)w)->notebook.background_gc)
304 #define NB_FirstChangeManaged(w)	\
305 			(((XmNotebookWidget)w)->notebook.first_change_managed)
306 #define NB_ScrollFrameData(w)		\
307 			(((XmNotebookWidget)w)->notebook.scroll_frame_data)
308 #define	NB_CurrentPageNumber(w)		\
309 			(((XmNotebookWidget)w)->notebook.current_page_number)
310 
311 /* For Constraint resources */
312 /* Note the NBC*() need a Notebook child as argument. */
313 
314 #define NB_GetConstraintRec(w) \
315     ((XmNotebookConstraint)(&((XmNotebookConstraintPtr) \
316     (w)->core.constraints)->notebook))
317 
318 #define	NBC_PageNumber(w)	(NB_GetConstraintRec(w)->page_number)
319 #define	NBC_ChildType(w)	(NB_GetConstraintRec(w)->child_type)
320 #define	NBC_Resizable(w)	(NB_GetConstraintRec(w)->resizable)
321 #define	NBC_Active(w)		(NB_GetConstraintRec(w)->active)
322 
323 /*
324  * The end
325  */
326 #ifdef __cplusplus
327 }
328 #endif
329 
330 #endif /* _XM_NOTEBOOKP_H */
331