Set set length on assignment.
[grace.git] / src / ListTreeP.h
blob76d75d283e4ddcf2c0ac760a144172af0e82267e
1 /*-----------------------------------------------------------------------------
2 * ListTree A list widget that displays a file manager style tree
4 * Copyright (c) 1996 Robert W. McMullen
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * Author: Rob McMullen <rwmcm@mail.ae.utexas.edu>
22 * http://www.ae.utexas.edu/~rwmcm
25 #ifndef _ListTreeP_H
26 #define _ListTreeP_H
28 #include <Xm/Xm.h>
29 #include <Xm/XmP.h>
30 #include <Xm/DrawP.h>
31 #include <Xm/PrimitiveP.h>
32 #include <Xm/ScrollBar.h>
33 #include <Xm/ScrolledW.h>
34 #include <Xm/DragDrop.h>
36 #include "ListTree.h"
38 /* LessTif definitions that are convenient for Motif */
39 #ifndef Prim_HighlightThickness
40 #define Prim_HighlightThickness(w) \
41 (((XmPrimitiveWidget)(w))->primitive.highlight_thickness)
42 #endif
44 #ifndef Prim_ShadowThickness
45 #define Prim_ShadowThickness(w) \
46 (((XmPrimitiveWidget)(w))->primitive.shadow_thickness)
47 #endif
49 #ifndef Prim_TopShadowGC
50 #define Prim_TopShadowGC(w) \
51 (((XmPrimitiveWidget)(w))->primitive.top_shadow_GC)
52 #endif
54 #ifndef Prim_BottomShadowGC
55 #define Prim_BottomShadowGC(w) \
56 (((XmPrimitiveWidget)(w))->primitive.bottom_shadow_GC)
57 #endif
60 #define ListTreeRET_ALLOC 10
62 #define TIMER_CLEAR 0
63 #define TIMER_SINGLE 1
64 #define TIMER_DOUBLE 2
65 #define TIMER_WAITING 3
67 typedef struct {
68 int dummy; /* keep compiler happy with dummy field */
69 } ListTreeClassPart;
71 typedef struct _ListTreeClassRec {
72 CoreClassPart core_class;
73 XmPrimitiveClassPart primitive_class;
74 ListTreeClassPart ListTree_class;
75 } ListTreeClassRec;
77 extern ListTreeClassRec listtreeClassRec;
79 typedef struct {
80 Pixmap bitmap;
81 Pixmap pix;
82 int width, height;
83 int xoff;
84 } Pixinfo;
86 typedef struct {
87 /* Public stuff ... */
88 long foreground_pixel;
89 XFontStruct *font;
90 int NumItems;
91 Dimension HSpacing;
92 Dimension VSpacing;
93 /* Dimension LabelSpacing; */
94 Dimension Margin;
95 Dimension Indent;
96 Pixinfo Open;
97 Pixinfo Closed;
98 Pixinfo Leaf;
99 Pixinfo LeafOpen;
100 Dimension LineWidth;
101 Boolean HighlightPath;
102 Boolean ClickPixmapToOpen;
103 Boolean DoIncrementalHighlightCallback;
105 XtCallbackList HighlightCallback;
106 XtCallbackList ActivateCallback;
107 XtCallbackList MenuCallback;
108 XtCallbackList DestroyItemCallback;
109 XtCallbackList DropCallback;
111 /* Private stuff ... */
112 GC drawGC;
113 GC highlightGC;
114 Pixinfo ItemPix; /* temporary storage for GetItemPix */
115 int exposeTop, exposeBot;
116 int pixWidth;
117 int preferredWidth, preferredHeight;
118 ListTreeItem *first, /* always points to a top level entry */
119 *highlighted, *drop_highlighted;
121 XtIntervalId timer_id; /* timer for double click test */
122 ListTreeItem *timer_item; /* item to make sure both clicks */
123 /* occurred on the same item */
124 int timer_type; /* flag for type of click that just happened */
125 int timer_y;
126 int timer_x;
127 int multi_click_time;
129 ListTreeItem **ret_item_list;
130 int ret_item_count;
131 int ret_item_alloc;
133 Boolean Refresh;
134 Boolean HasFocus;
136 /* New stuff for maintaining its own scrolling state */
137 Widget mom; /* scrolled window */
138 Widget hsb; /* horizontal scrollbar */
139 Widget vsb; /* vertical scrollbar */
140 Dimension viewX;
141 Dimension viewY;
142 Dimension viewWidth;
143 Dimension viewHeight;
144 int XOffset;
145 int hsbPos;
146 int hsbMax;
148 int lastXOffset;
149 int topItemPos; /* position of topItem in itemCount */
150 int bottomItemPos; /* last position drawn in window */
151 int lastItemPos; /* last value of topItempos */
152 ListTreeItem *topItem; /* first visible item on screen */
153 int itemCount; /* total number of open ListTreeItems */
154 Dimension itemHeight;
155 Dimension maxPixHeight;
156 int visibleCount; /* number currently visible on screen */
157 Boolean recount;
159 } ListTreePart;
161 typedef struct _ListTreeRec {
162 CorePart core;
163 XmPrimitivePart primitive;
164 ListTreePart list;
165 } ListTreeRec;
168 #endif /* _ListTreeP_H */