1 /* $XConsortium: FormP.h,v 1.22 94/04/17 20:12:09 kaleb Exp $ */
2 
3 /***********************************************************
4 
5 Copyright (c) 1987, 1988, 1994  X Consortium
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
20 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 
24 Except as contained in this notice, the name of the X Consortium shall not be
25 used in advertising or otherwise to promote the sale, use or other dealings
26 in this Software without prior written authorization from the X Consortium.
27 
28 
29 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
30 
31                         All Rights Reserved
32 
33 Permission to use, copy, modify, and distribute this software and its
34 documentation for any purpose and without fee is hereby granted,
35 provided that the above copyright notice appear in all copies and that
36 both that copyright notice and this permission notice appear in
37 supporting documentation, and that the name of Digital not be
38 used in advertising or publicity pertaining to distribution of the
39 software without specific, written prior permission.
40 
41 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
42 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
43 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
44 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
45 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
46 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
47 SOFTWARE.
48 
49 ******************************************************************/
50 
51 /* Form widget private definitions */
52 
53 #ifndef _XawFormP_h
54 #define _XawFormP_h
55 
56 #include <X11/Xaw3d/Form.h>
57 
58 #define XtREdgeType "EdgeType"
59 
60 typedef enum {LayoutPending, LayoutInProgress, LayoutDone} LayoutState;
61 #define XtInheritLayout ((Boolean (*)())_XtInherit)
62 
63 typedef struct {
64     Boolean	(*layout)(/* FormWidget, Dimension, Dimension */);
65 } FormClassPart;
66 
67 /*
68  * Layout(
69  *	FormWidget w	- the widget whose children are to be configured
70  *	Dimension w, h	- bounding box of layout to be calculated
71  *
72  *  Stores preferred geometry in w->form.preferred_{width,height}.
73  *  If w->form.resize_in_layout is True, then a geometry request
74  *  may be made for the preferred bounding box if necessary.
75  *
76  *  Returns True if a geometry request was granted, False otherwise.
77  */
78 
79 typedef struct _FormClassRec {
80     CoreClassPart	core_class;
81     CompositeClassPart	composite_class;
82     ConstraintClassPart	constraint_class;
83     FormClassPart	form_class;
84 } FormClassRec;
85 
86 extern FormClassRec formClassRec;
87 
88 typedef struct _FormPart {
89     /* resources */
90     int		default_spacing;    /* default distance between children */
91     /* private state */
92     Dimension	old_width, old_height; /* last known dimensions		 */
93     int		no_refigure;	    /* no re-layout while > 0		 */
94     Boolean	needs_relayout;	    /* next time no_refigure == 0	 */
95     Boolean	resize_in_layout;   /* should layout() do geom request?  */
96     Dimension	preferred_width, preferred_height; /* cached from layout */
97     Boolean     resize_is_no_op;    /* Causes resize to take not action. */
98 } FormPart;
99 
100 typedef struct _FormRec {
101     CorePart		core;
102     CompositePart	composite;
103     ConstraintPart	constraint;
104     FormPart		form;
105 } FormRec;
106 
107 typedef struct _FormConstraintsPart {
108 /*
109  * Constraint Resources.
110  */
111     XtEdgeType	top, bottom,	/* where to drag edge on resize		*/
112 		left, right;
113     int		dx;		/* desired horiz offset			*/
114     int		dy;		/* desired vertical offset		*/
115     Widget	horiz_base;	/* measure dx from here if non-null	*/
116     Widget	vert_base;	/* measure dy from here if non-null	*/
117     Boolean	allow_resize;	/* TRUE if child may request resize	*/
118 
119 /*
120  * Private contstraint resources.
121  */
122 
123 /*
124  * What the size of this child would be if we did not impose the
125  * constraint the width and height must be greater than zero (0).
126  */
127     short	virtual_width, virtual_height;
128 
129 /*
130  * Temporary Storage for children's new possible possition.
131  */
132 
133     Position new_x, new_y;
134 
135     LayoutState	layout_state;	/* temporary layout state		*/
136     Boolean	deferred_resize; /* was resized while no_refigure is set */
137 } FormConstraintsPart;
138 
139 typedef struct _FormConstraintsRec {
140     FormConstraintsPart	form;
141 } FormConstraintsRec, *FormConstraints;
142 
143 #endif /* _XawFormP_h */
144