TreeP.h revision 7a84e134
17a84e134Smrg/*
27a84e134Smrg * $Xorg: TreeP.h,v 1.4 2001/02/09 02:03:47 xorgcvs Exp $
37a84e134Smrg *
47a84e134Smrg
57a84e134SmrgCopyright 1990, 1998  The Open Group
67a84e134Smrg
77a84e134SmrgPermission to use, copy, modify, distribute, and sell this software and its
87a84e134Smrgdocumentation for any purpose is hereby granted without fee, provided that
97a84e134Smrgthe above copyright notice appear in all copies and that both that
107a84e134Smrgcopyright notice and this permission notice appear in supporting
117a84e134Smrgdocumentation.
127a84e134Smrg
137a84e134SmrgThe above copyright notice and this permission notice shall be included in
147a84e134Smrgall copies or substantial portions of the Software.
157a84e134Smrg
167a84e134SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
177a84e134SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
187a84e134SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
197a84e134SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
207a84e134SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
217a84e134SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
227a84e134Smrg
237a84e134SmrgExcept as contained in this notice, the name of The Open Group shall not be
247a84e134Smrgused in advertising or otherwise to promote the sale, use or other dealings
257a84e134Smrgin this Software without prior written authorization from The Open Group.
267a84e134Smrg
277a84e134Smrg * Copyright 1989 Prentice Hall
287a84e134Smrg *
297a84e134Smrg * Permission to use, copy, modify, and distribute this software for any
307a84e134Smrg * purpose and without fee is hereby granted, provided that the above
317a84e134Smrg * copyright notice appear in all copies and that both the copyright notice
327a84e134Smrg * and this permission notice appear in supporting documentation.
337a84e134Smrg *
347a84e134Smrg * Prentice Hall and the authors disclaim all warranties with regard
357a84e134Smrg * to this software, including all implied warranties of merchantability and
367a84e134Smrg * fitness.  In no event shall Prentice Hall or the authors be liable
377a84e134Smrg * for any special, indirect or cosequential damages or any damages whatsoever
387a84e134Smrg * resulting from loss of use, data or profits, whether in an action of
397a84e134Smrg * contract, negligence or other tortious action, arising out of or in
407a84e134Smrg * connection with the use or performance of this software.
417a84e134Smrg *
427a84e134Smrg * Authors:  Jim Fulton, MIT X Consortium,
437a84e134Smrg *           based on a version by Douglas Young, Prentice Hall
447a84e134Smrg *
457a84e134Smrg * This widget is based on the Tree widget described on pages 397-419 of
467a84e134Smrg * Douglas Young's book "The X Window System, Programming and Applications
477a84e134Smrg * with Xt OSF/Motif Edition."  The layout code has been rewritten to use
487a84e134Smrg * additional blank space to make the structure of the graph easier to see
497a84e134Smrg * as well as to support vertical trees.
507a84e134Smrg */
517a84e134Smrg/* $XFree86: xc/lib/Xaw/TreeP.h,v 1.6 2001/01/17 19:42:35 dawes Exp $ */
527a84e134Smrg
537a84e134Smrg
547a84e134Smrg#ifndef _XawTreeP_h
557a84e134Smrg#define _XawTreeP_h
567a84e134Smrg
577a84e134Smrg#include <X11/Xaw/Tree.h>
587a84e134Smrg
597a84e134Smrgtypedef struct _TreeClassPart {
607a84e134Smrg    XtPointer extension;
617a84e134Smrg} TreeClassPart;
627a84e134Smrg
637a84e134Smrgtypedef struct _TreeClassRec {
647a84e134Smrg    CoreClassPart core_class;
657a84e134Smrg    CompositeClassPart composite_class;
667a84e134Smrg    ConstraintClassPart constraint_class;
677a84e134Smrg    TreeClassPart tree_class;
687a84e134Smrg} TreeClassRec;
697a84e134Smrg
707a84e134Smrgextern TreeClassRec treeClassRec;
717a84e134Smrg
727a84e134Smrgtypedef struct {
737a84e134Smrg    /* fields available through resources */
747a84e134Smrg    Dimension hpad;			/* hSpace/HSpace */
757a84e134Smrg    Dimension vpad;			/* vSpace/VSpace */
767a84e134Smrg    Dimension line_width;		/* lineWidth/LineWidth */
777a84e134Smrg    Pixel foreground;			/* foreground/Foreground */
787a84e134Smrg    XtGravity gravity;			/* gravity/Gravity */
797a84e134Smrg    Boolean auto_reconfigure;		/* autoReconfigure/AutoReconfigure */
807a84e134Smrg    /* private fields */
817a84e134Smrg    GC gc;				/* used to draw lines */
827a84e134Smrg    Widget tree_root;			/* hidden root off all children */
837a84e134Smrg    Dimension *largest;			/* list of largest per depth */
847a84e134Smrg    int n_largest;			/* number of elements in largest */
857a84e134Smrg    Dimension maxwidth, maxheight;	/* for shrink wrapping */
867a84e134Smrg#ifndef OLDXAW
877a84e134Smrg    XawDisplayList *display_list;
887a84e134Smrg    XtPointer pad[4];	/* for future use and keep binary compatability */
897a84e134Smrg#endif
907a84e134Smrg} TreePart;
917a84e134Smrg
927a84e134Smrg
937a84e134Smrgtypedef struct _TreeRec {
947a84e134Smrg    CorePart core;
957a84e134Smrg    CompositePart composite;
967a84e134Smrg    ConstraintPart constraint;
977a84e134Smrg    TreePart tree;
987a84e134Smrg}  TreeRec;
997a84e134Smrg
1007a84e134Smrg
1017a84e134Smrg/*
1027a84e134Smrg * structure attached to all children
1037a84e134Smrg */
1047a84e134Smrgtypedef struct _TreeConstraintsPart {
1057a84e134Smrg    /* resources */
1067a84e134Smrg    Widget parent;			/* treeParent/TreeParent */
1077a84e134Smrg    GC gc;				/* treeGC/TreeGC */
1087a84e134Smrg    /* private data */
1097a84e134Smrg    Widget *children;
1107a84e134Smrg    int n_children;
1117a84e134Smrg    int max_children;
1127a84e134Smrg    Dimension bbsubwidth, bbsubheight;	/* bounding box of sub tree */
1137a84e134Smrg    Dimension bbwidth, bbheight;	/* bounding box including node */
1147a84e134Smrg    Position x, y;
1157a84e134Smrg#ifndef OLDXAW
1167a84e134Smrg    XtPointer pad[2];	/* leave some space for future optimizations, and
1177a84e134Smrg			 * keep binary compatability
1187a84e134Smrg			 */
1197a84e134Smrg#endif
1207a84e134Smrg} TreeConstraintsPart;
1217a84e134Smrg
1227a84e134Smrgtypedef struct _TreeConstraintsRec {
1237a84e134Smrg   TreeConstraintsPart tree;
1247a84e134Smrg} TreeConstraintsRec, *TreeConstraints;
1257a84e134Smrg
1267a84e134Smrg
1277a84e134Smrg/*
1287a84e134Smrg * useful macros
1297a84e134Smrg */
1307a84e134Smrg
1317a84e134Smrg#define TREE_CONSTRAINT(w) \
1327a84e134Smrg                   ((TreeConstraints)((w)->core.constraints))
1337a84e134Smrg
1347a84e134Smrg#define TREE_INITIAL_DEPTH 10		/* for allocating largest array */
1357a84e134Smrg#define TREE_HORIZONTAL_DEFAULT_SPACING 20
1367a84e134Smrg#define TREE_VERTICAL_DEFAULT_SPACING 6
1377a84e134Smrg
1387a84e134Smrg#endif /* _XawTreeP_h */
1397a84e134Smrg
1407a84e134Smrg
1417a84e134Smrg
142