1 /* 2 * $XConsortium: LayoutP.h,v 1.2 92/01/22 18:03:08 keith Exp $ 3 * 4 * Copyright 1991 Massachusetts Institute of Technology 5 * 6 * Permission to use, copy, modify, distribute, and sell this software and its 7 * documentation for any purpose is hereby granted without fee, provided that 8 * the above copyright notice appear in all copies and that both that 9 * copyright notice and this permission notice appear in supporting 10 * documentation, and that the name of M.I.T. not be used in advertising or 11 * publicity pertaining to distribution of the software without specific, 12 * written prior permission. M.I.T. makes no representations about the 13 * suitability of this software for any purpose. It is provided "as is" 14 * without express or implied warranty. 15 * 16 * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. 18 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 19 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 20 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 21 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 22 * 23 * Author: Keith Packard, MIT X Consortium 24 */ 25 26 /* 27 modified by Johannes Plass (plass@thep.physik.uni-mainz.de) 28 ###jp### 02/06 29 */ 30 31 #ifndef _XawLayoutP_h 32 #define _XawLayoutP_h 33 34 #include "paths.h" 35 #include "Aaa.h" 36 #include INC_X11(ConstrainP.h) 37 38 typedef enum _BoxType { BoxBox, WidgetBox, GlueBox, VariableBox } BoxType; 39 40 typedef enum _LayoutDirection { 41 LayoutHorizontal = 0, LayoutVertical = 1 42 } LayoutDirection; 43 44 typedef enum _Operator { 45 Plus, Minus, Times, Divide, Percent 46 } Operator; 47 48 typedef enum _ExprType { 49 Constant, 50 Binary, 51 Unary, 52 Width, 53 Height, 54 Variable 55 } ExprType; 56 57 typedef struct _Expr *ExprPtr; 58 59 typedef struct _Expr { 60 ExprType type; 61 union { 62 double constant; 63 struct { 64 Operator op; 65 ExprPtr left, right; 66 } binary; 67 struct { 68 Operator op; 69 ExprPtr down; 70 } unary; 71 XrmQuark width; 72 XrmQuark height; 73 XrmQuark variable; 74 } u; 75 } ExprRec; 76 77 typedef struct _Glue { 78 int order; 79 double value; 80 ExprPtr expr; 81 } GlueRec, *GluePtr; 82 83 typedef struct _BoxParams { 84 GlueRec stretch[2]; 85 GlueRec shrink[2]; 86 } BoxParamsRec, *BoxParamsPtr; 87 88 typedef struct _Box *BoxPtr; 89 90 typedef BoxPtr LayoutPtr; 91 92 typedef struct _Box { 93 BoxPtr nextSibling; 94 BoxPtr parent; 95 BoxParamsRec params; 96 int size[2]; 97 int natural[2]; 98 BoxType type; 99 union { 100 struct { 101 BoxPtr firstChild; 102 LayoutDirection dir; 103 } box; 104 struct { 105 XrmQuark quark; 106 Widget widget; 107 } widget; 108 struct { 109 ExprPtr expr; 110 } glue; 111 struct { 112 XrmQuark quark; 113 ExprPtr expr; 114 } variable; 115 } u; 116 } LBoxRec; /* this conflicted with Box's BoxRec, besides, it's not used anywhere */ 117 118 typedef struct _SubInfo { 119 int naturalSize[2]; 120 int naturalBw; 121 Boolean allow_resize; 122 Dimension forced_width; 123 Dimension forced_height; 124 } SubInfoRec, *SubInfoPtr; 125 126 /********************************************************************* 127 * 128 * Aaa Widget Private Data 129 * 130 *********************************************************************/ 131 132 /* New fields for the Aaa widget class record */ 133 134 typedef struct _AaaClassPart { 135 int foo; /* keep compiler happy. */ 136 } AaaClassPart; 137 138 /* Full Class record declaration */ 139 typedef struct _AaaClassRec { 140 CoreClassPart core_class; 141 CompositeClassPart composite_class; 142 ConstraintClassPart constraint_class; 143 AaaClassPart aaa_class; 144 } AaaClassRec; 145 146 extern AaaClassRec aaaClassRec; 147 148 typedef struct _AaaConstraintsRec { 149 SubInfoRec aaa; 150 } AaaConstraintsRec, *AaaConstraints; 151 152 #define SubInfo(w) (&(((AaaConstraints) (w)->core.constraints)->aaa)) 153 154 /* New Fields for the Aaa widget record */ 155 156 typedef struct { 157 /* resources */ 158 LayoutPtr layout; 159 Boolean debug; 160 Boolean resize_width; 161 Boolean resize_height; 162 Dimension maximum_width; 163 Dimension maximum_height; 164 Dimension minimum_width; 165 Dimension minimum_height; 166 } AaaPart; 167 168 /************************************************************************** 169 * 170 * Full instance record declaration 171 * 172 **************************************************************************/ 173 174 typedef struct _AaaRec { 175 CorePart core; 176 CompositePart composite; 177 ConstraintPart constraint; 178 AaaPart aaa; 179 } AaaRec; 180 #endif 181 182 183