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
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"
66 extern WidgetClass listtreeWidgetClass
;
68 typedef struct _ListTreeClassRec
*ListTreeWidgetClass
;
69 typedef struct _ListTreeRec
*ListTreeWidget
;
71 typedef enum _ListTreeItemType
{
72 ItemDetermineType
= 0,
73 ItemBranchType
= XtBRANCH
,
77 typedef struct _ListTreeItem
{
85 ListTreeItemType type
;
86 struct _ListTreeItem
*parent
,*firstchild
,*prevsibling
,*nextsibling
;
87 Pixmap openPixmap
,closedPixmap
;
91 typedef struct _ListTreeReturnStruct
{
97 } ListTreeReturnStruct
;
99 typedef struct _ListTreeMultiReturnStruct
{
100 ListTreeItem
**items
;
102 } ListTreeMultiReturnStruct
;
104 typedef struct _ListTreeActivateStruct
{
110 } ListTreeActivateStruct
;
112 typedef struct _ListTreeItemReturnStruct
{
116 } ListTreeItemReturnStruct
;
118 typedef struct _ListTreeDropStruct
{
123 } ListTreeDropStruct
;
126 ** Public function declarations
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
);
167 #endif /* _ListTree_H */