4 * BGUI Tree List View class
6 * (C) Copyright 1999 Manuel Lemos.
7 * (C) Copyright 1996-1999 Nick Christie.
11 * Revision 42.2 2004/06/16 20:16:49 verhaegs
12 * Use METHODPROTO, METHOD_END and REGFUNCPROTOn where needed.
14 * Revision 42.1 2000/05/15 19:29:08 stegerg
15 * replacements for REG macro
17 * Revision 42.0 2000/05/09 22:21:51 mlemos
18 * Bumped to revision 42.0 before handing BGUI to AROS team
20 * Revision 41.11 2000/05/09 20:35:37 mlemos
21 * Bumped to revision 41.11
23 * Revision 1.2 2000/05/09 20:00:35 mlemos
24 * Merged with the branch Manuel_Lemos_fixes.
26 * Revision 1.1.2.2 1999/05/31 01:15:50 mlemos
27 * Made the method functions take the arguments in the apropriate registers.
28 * Commented out debugging code.
30 * Revision 1.1.2.1 1999/02/21 04:07:50 mlemos
31 * Nick Christie sources.
37 /************************************************************************
38 ******************* TREEVIEW CLASS: MISCELLANEOUS *********************
39 ************************************************************************/
41 /************************************************************************
42 ****************************** INCLUDES *******************************
43 ************************************************************************/
45 #include "TreeViewPrivate.h"
48 /************************************************************************
49 ************************** LOCAL DEFINITIONS **************************
50 ************************************************************************/
53 /************************************************************************
54 ************************* EXTERNAL REFERENCES *************************
55 ************************************************************************/
58 * Functions from TVUtil are listed in TVUtil.h
61 /************************************************************************
62 ***************************** PROTOTYPES ******************************
63 ************************************************************************/
66 /************************************************************************
67 ***************************** LOCAL DATA ******************************
68 ************************************************************************/
71 /************************************************************************
72 ***************************** TV_CLEAR() ******************************
73 ************************************************************************/
75 METHOD(TV_Clear
, struct tvCommand
*, tvc
)
79 tv
= INST_DATA(cl
,obj
);
81 DoMethod(tv
->tv_Listview
,LVM_CLEAR
,tvc
->tvc_GInfo
);
82 TV_FreeTreeNodeList(tv
,RootList(tv
));
83 NewList(RootList(tv
));
84 tv
->tv_NumEntries
= 0;
90 /************************************************************************
91 ****************************** TV_LOCK() ******************************
92 ************************************************************************/
94 METHOD(TV_Lock
, Msg
, msg
)
98 tv
= INST_DATA(cl
,obj
);
100 if (!tv
->tv_LockCount
)
101 DoMethod(tv
->tv_Listview
,LVM_LOCKLIST
,NULL
);
109 /************************************************************************
110 ***************************** TV_UNLOCK() *****************************
111 ************************************************************************/
113 METHOD(TV_Unlock
, struct tvCommand
*, tvc
)
117 tv
= INST_DATA(cl
,obj
);
119 if (tv
->tv_LockCount
)
123 if (!tv
->tv_LockCount
)
124 DoMethod(tv
->tv_Listview
,LVM_UNLOCKLIST
,tvc
->tvc_GInfo
);
131 /************************************************************************
132 ****************************** TV_SORT() ******************************
133 *************************************************************************
136 *************************************************************************/
138 METHOD(TV_Sort
, struct tvCommand
*, tvc
)
144 /************************************************************************
145 ***************************** TV_REDRAW() *****************************
146 *************************************************************************
147 * STUB! TV_Redraw is using LVM_REFRESH for the moment because of lv bugs.
149 *************************************************************************/
151 METHOD(TV_Redraw
, struct tvCommand
*, tvc
)
155 tv
= INST_DATA(cl
,obj
);
157 return(DoMethod(tv
->tv_Listview
,LVM_REFRESH
,tvc
->tvc_GInfo
));
161 /************************************************************************
162 **************************** TV_REFRESH() *****************************
163 ************************************************************************/
165 METHOD(TV_Refresh
, struct tvCommand
*, tvc
)
169 tv
= INST_DATA(cl
,obj
);
171 return(DoMethod(tv
->tv_Listview
,LVM_REFRESH
,tvc
->tvc_GInfo
));
175 /************************************************************************
176 **************************** TV_REBUILD() *****************************
177 *************************************************************************
178 * For debugging use only, clears the listview and reconstructs the
179 * entries that should be in it from the tree.
181 *************************************************************************/
183 METHOD(TV_Rebuild
, struct tvCommand
*, tvc
)
189 tv
= INST_DATA(cl
,obj
);
191 DoMethod(tv
->tv_Listview
,LVM_CLEAR
,NULL
);
193 tn
= FirstChildIn(RootList(tv
));
199 KPrintF("TVM_REBUILD: Parent:%-16s Node:%-16s\n",
200 tn->tn_Parent ? (STRPTR) tn->tn_Parent->tn_Entry : "Root",
204 ok
= (BOOL
) DoMethod(tv
->tv_Listview
,LVM_ADDSINGLE
,NULL
,tn
,LVAP_TAIL
,0);
205 tn
= TV_GetNextTreeNode(tn
,TVF_VISIBLE
,0,~0);
210 KPrintF("TVM_REBUILD: *** Failed to add to listview! ***\n");
213 DoMethod(tv
->tv_Listview
,LVM_REFRESH
,tvc
->tvc_GInfo
);