Set set length on assignment.
[grace.git] / src / ListTree.h
blob29532925b3638bfd896f8b79fcc58a85398bda40
1 /*-----------------------------------------------------------------------------
3 * ListTree A list widget that displays a file manager style tree
5 * Copyright (c) 1996 Robert W. McMullen
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * Author: Rob McMullen <rwmcm@mail.ae.utexas.edu>
23 * http://www.ae.utexas.edu/~rwmcm
26 #ifndef _ListTree_H
27 #define _ListTree_H
29 #include <X11/Core.h>
30 #include <Xm/Xm.h>
31 #include <Xm/XmP.h>
33 #define _ListTree_WIDGET_VERSION 3.0
35 #define XtNmargin "margin"
36 #define XtNindent "indent"
37 #define XtNspacing "spacing"
38 #define XtNhorizontalSpacing "horizontalSpacing"
39 #define XtNverticalSpacing "verticalSpacing"
40 #define XtNlineWidth "lineWidth"
41 #define XtNtopItemPosition "topItemPosition"
42 #define XtNvisibleItemCount "visibleItemCount"
43 #define XtNhighlightPath "highlightPath"
44 #define XtNclickPixmapToOpen "clickPixmapToOpen"
45 #define XtNdoIncrementalHighlightCallback "incCallback"
46 #define XtNbranchPixmap "branchPixmap"
47 #define XtNbranchOpenPixmap "branchOpenPixmap"
48 #define XtNleafPixmap "leafPixmap"
49 #define XtNleafOpenPixmap "leafOpenPixmap"
50 #define XtNactivateCallback "activateCallback"
51 #define XtNhighlightCallback "highlightCallback"
52 #define XtNmenuCallback "menuCallback"
53 #define XtNdestroyItemCallback "destroyItemCallback"
54 #define XtNdropCallback "dropCallback"
56 #define XtBRANCH 1
57 #define XtLEAF 2
58 #define XtMENU 3
59 #define XtDESTROY 4
60 #define XtDROP 5
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
66 extern WidgetClass listtreeWidgetClass;
68 typedef struct _ListTreeClassRec *ListTreeWidgetClass;
69 typedef struct _ListTreeRec *ListTreeWidget;
71 typedef enum _ListTreeItemType {
72 ItemDetermineType = 0,
73 ItemBranchType = XtBRANCH,
74 ItemLeafType = XtLEAF
75 } ListTreeItemType;
77 typedef struct _ListTreeItem {
78 Boolean open;
79 Boolean highlighted;
80 char *text;
81 int length;
82 int x,y,ytext;
83 int count;
84 Dimension height;
85 ListTreeItemType type;
86 struct _ListTreeItem *parent,*firstchild,*prevsibling,*nextsibling;
87 Pixmap openPixmap,closedPixmap;
88 XtPointer user_data;
89 } ListTreeItem;
91 typedef struct _ListTreeReturnStruct {
92 int reason;
93 ListTreeItem *item;
94 ListTreeItem **path;
95 int count;
96 Boolean open;
97 } ListTreeReturnStruct;
99 typedef struct _ListTreeMultiReturnStruct {
100 ListTreeItem **items;
101 int count;
102 } ListTreeMultiReturnStruct;
104 typedef struct _ListTreeActivateStruct {
105 int reason;
106 ListTreeItem *item;
107 Boolean open;
108 ListTreeItem **path;
109 int count;
110 } ListTreeActivateStruct;
112 typedef struct _ListTreeItemReturnStruct {
113 int reason;
114 ListTreeItem *item;
115 XEvent *event;
116 } ListTreeItemReturnStruct;
118 typedef struct _ListTreeDropStruct {
119 int reason;
120 ListTreeItem *item;
121 char ok;
122 char operation;
123 } ListTreeDropStruct;
126 ** Public function declarations
129 /* ListTree.c */
130 void ListTreeRefresh (Widget w);
131 void ListTreeRefreshOff (Widget w);
132 void ListTreeRefreshOn (Widget w);
133 ListTreeItem *ListTreeAdd (Widget w, ListTreeItem *parent, char *string);
134 ListTreeItem *ListTreeAddType (Widget w, ListTreeItem *parent, char *string, ListTreeItemType type);
135 ListTreeItem *ListTreeAddBranch (Widget w, ListTreeItem *parent, char *string);
136 ListTreeItem *ListTreeAddLeaf (Widget w, ListTreeItem *parent, char *string);
137 ListTreeItem *ListTreeInsert (Widget w, ListTreeItem *parent, char *string, int row);
138 void ListTreeSetItemPixmaps (Widget w, ListTreeItem *item, Pixmap openPixmap, Pixmap closedPixmap);
139 void ListTreeRenameItem (Widget w, ListTreeItem *item, char *string);
140 int ListTreeDelete (Widget w, ListTreeItem *item);
141 int ListTreeDeleteChildren (Widget w, ListTreeItem *item);
142 int ListTreeReparent (Widget w, ListTreeItem *item, ListTreeItem *newparent);
143 int ListTreeReparentChildren (Widget w, ListTreeItem *item, ListTreeItem *newparent);
144 int ListTreeOrderSiblings (Widget w, ListTreeItem *item);
145 int ListTreeOrderChildren (Widget w, ListTreeItem *item);
146 int ListTreeUserOrderChildren (Widget w, ListTreeItem *item, int (*func)(const void *, const void *));
147 int ListTreeUserOrderSiblings (Widget w, ListTreeItem *item, int (*func)(const void *, const void *));
148 ListTreeItem *ListTreeFindSiblingName (Widget w, ListTreeItem *item, char *name);
149 ListTreeItem *ListTreeFindChildName (Widget w, ListTreeItem *item, char *name);
150 void ListTreeHighlightItem (Widget w, ListTreeItem *item);
151 void ListTreeHighlightItemMultiple(Widget w, ListTreeItem * item);
152 ListTreeItem *ListTreeFirstItem (Widget w);
153 void ListTreeClearHighlighted(Widget w);
154 void ListTreeGetHighlighted(Widget w,ListTreeMultiReturnStruct *ret);
155 void ListTreeSetHighlighted(Widget w,ListTreeItem **items,
156 int count,Boolean clear);
158 void ListTreeSetPos(Widget w, ListTreeItem *item);
159 void ListTreeSetBottomPos(Widget aw, ListTreeItem *item);
161 Widget XmCreateScrolledListTree (Widget parent, char *name, Arg *args, Cardinal count);
163 #ifdef __cplusplus
165 #endif
167 #endif /* _ListTree_H */