| 1 | /* |
| 2 | |
| 3 | Copyright 1990, 1998 The Open Group |
| 4 | |
| 5 | Permission to use, copy, modify, distribute, and sell this software and its |
| 6 | documentation for any purpose is hereby granted without fee, provided that |
| 7 | the above copyright notice appear in all copies and that both that |
| 8 | copyright notice and this permission notice appear in supporting |
| 9 | documentation. |
| 10 | |
| 11 | The above copyright notice and this permission notice shall be included in |
| 12 | all copies or substantial portions of the Software. |
| 13 | |
| 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 17 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
| 18 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 20 | |
| 21 | Except as contained in this notice, the name of The Open Group shall not be |
| 22 | used in advertising or otherwise to promote the sale, use or other dealings |
| 23 | in this Software without prior written authorization from The Open Group. |
| 24 | |
| 25 | * Copyright 1989 Prentice Hall |
| 26 | * |
| 27 | * Permission to use, copy, modify, and distribute this software for any |
| 28 | * purpose and without fee is hereby granted, provided that the above |
| 29 | * copyright notice appear in all copies and that both the copyright notice |
| 30 | * and this permission notice appear in supporting documentation. |
| 31 | * |
| 32 | * Prentice Hall and the authors disclaim all warranties with regard |
| 33 | * to this software, including all implied warranties of merchantability and |
| 34 | * fitness. In no event shall Prentice Hall or the authors be liable |
| 35 | * for any special, indirect or cosequential damages or any damages whatsoever |
| 36 | * resulting from loss of use, data or profits, whether in an action of |
| 37 | * contract, negligence or other tortious action, arising out of or in |
| 38 | * connection with the use or performance of this software. |
| 39 | * |
| 40 | * Authors: Jim Fulton, MIT X Consortium, |
| 41 | * based on a version by Douglas Young, Prentice Hall |
| 42 | * |
| 43 | * This widget is based on the Tree widget described on pages 397-419 of |
| 44 | * Douglas Young's book "The X Window System, Programming and Applications |
| 45 | * with Xt OSF/Motif Edition." The layout code has been rewritten to use |
| 46 | * additional blank space to make the structure of the graph easier to see |
| 47 | * as well as to support vertical trees. |
| 48 | */ |
| 49 | |
| 50 | #ifndef _XawTreeP_h |
| 51 | #define _XawTreeP_h |
| 52 | |
| 53 | #include <X11/Xaw/Tree.h> |
| 54 | |
| 55 | typedef struct _TreeClassPart { |
| 56 | XtPointer extension; |
| 57 | } TreeClassPart; |
| 58 | |
| 59 | typedef struct _TreeClassRec { |
| 60 | CoreClassPart core_class; |
| 61 | CompositeClassPart composite_class; |
| 62 | ConstraintClassPart constraint_class; |
| 63 | TreeClassPart tree_class; |
| 64 | } TreeClassRec; |
| 65 | |
| 66 | extern TreeClassRec treeClassRec; |
| 67 | |
| 68 | typedef struct { |
| 69 | /* fields available through resources */ |
| 70 | Dimension hpad; /* hSpace/HSpace */ |
| 71 | Dimension vpad; /* vSpace/VSpace */ |
| 72 | Dimension line_width; /* lineWidth/LineWidth */ |
| 73 | Pixel foreground; /* foreground/Foreground */ |
| 74 | XtGravity gravity; /* gravity/Gravity */ |
| 75 | Boolean auto_reconfigure; /* autoReconfigure/AutoReconfigure */ |
| 76 | /* private fields */ |
| 77 | GC gc; /* used to draw lines */ |
| 78 | Widget tree_root; /* hidden root off all children */ |
| 79 | Dimension *largest; /* list of largest per depth */ |
| 80 | int n_largest; /* number of elements in largest */ |
| 81 | Dimension maxwidth, maxheight; /* for shrink wrapping */ |
| 82 | #ifndef OLDXAW |
| 83 | XawDisplayList *display_list; |
| 84 | XtPointer pad[4]; /* for future use and keep binary compatibility */ |
| 85 | #endif |
| 86 | } TreePart; |
| 87 | |
| 88 | |
| 89 | typedef struct _TreeRec { |
| 90 | CorePart core; |
| 91 | CompositePart composite; |
| 92 | ConstraintPart constraint; |
| 93 | TreePart tree; |
| 94 | } TreeRec; |
| 95 | |
| 96 | |
| 97 | /* |
| 98 | * structure attached to all children |
| 99 | */ |
| 100 | typedef struct _TreeConstraintsPart { |
| 101 | /* resources */ |
| 102 | Widget parent; /* treeParent/TreeParent */ |
| 103 | GC gc; /* treeGC/TreeGC */ |
| 104 | /* private data */ |
| 105 | Widget *children; |
| 106 | int n_children; |
| 107 | int max_children; |
| 108 | Dimension bbsubwidth, bbsubheight; /* bounding box of sub tree */ |
| 109 | Dimension bbwidth, bbheight; /* bounding box including node */ |
| 110 | Position x, y; |
| 111 | #ifndef OLDXAW |
| 112 | XtPointer pad[2]; /* leave some space for future optimizations, and |
| 113 | * keep binary compatibility |
| 114 | */ |
| 115 | #endif |
| 116 | } TreeConstraintsPart; |
| 117 | |
| 118 | typedef struct _TreeConstraintsRec { |
| 119 | TreeConstraintsPart tree; |
| 120 | } TreeConstraintsRec, *TreeConstraints; |
| 121 | |
| 122 | |
| 123 | /* |
| 124 | * useful macros |
| 125 | */ |
| 126 | |
| 127 | #define TREE_CONSTRAINT(w) \ |
| 128 | ((TreeConstraints)((w)->core.constraints)) |
| 129 | |
| 130 | #define TREE_INITIAL_DEPTH 10 /* for allocating largest array */ |
| 131 | #define TREE_HORIZONTAL_DEFAULT_SPACING 20 |
| 132 | #define TREE_VERTICAL_DEFAULT_SPACING 6 |
| 133 | |
| 134 | #endif /* _XawTreeP_h */ |
| 135 | |
| 136 | |
| 137 |