delint: unused on AROS
[AROS-Contrib.git] / bgui / gadgets / TreeView / TVMisc.c
blob00e4e3f570aeb7ab3424cefdafeb674cacbc03fa
1 /*
2 * @(#) $Header$
4 * BGUI Tree List View class
6 * (C) Copyright 1999 Manuel Lemos.
7 * (C) Copyright 1996-1999 Nick Christie.
8 * All Rights Reserved.
10 * $Log$
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"
46 #include "TVUtil.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)
77 TVData *tv;
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;
86 return(0);
88 METHOD_END
90 /************************************************************************
91 ****************************** TV_LOCK() ******************************
92 ************************************************************************/
94 METHOD(TV_Lock, Msg, msg)
96 TVData *tv;
98 tv = INST_DATA(cl,obj);
100 if (!tv->tv_LockCount)
101 DoMethod(tv->tv_Listview,LVM_LOCKLIST,NULL);
103 tv->tv_LockCount++;
105 return(0);
107 METHOD_END
109 /************************************************************************
110 ***************************** TV_UNLOCK() *****************************
111 ************************************************************************/
113 METHOD(TV_Unlock, struct tvCommand *, tvc)
115 TVData *tv;
117 tv = INST_DATA(cl,obj);
119 if (tv->tv_LockCount)
121 tv->tv_LockCount--;
123 if (!tv->tv_LockCount)
124 DoMethod(tv->tv_Listview,LVM_UNLOCKLIST,tvc->tvc_GInfo);
127 return(0);
129 METHOD_END
131 /************************************************************************
132 ****************************** TV_SORT() ******************************
133 *************************************************************************
134 * STUB! TV_SORT
136 *************************************************************************/
138 METHOD(TV_Sort, struct tvCommand *, tvc)
140 return(0);
142 METHOD_END
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)
153 TVData *tv;
155 tv = INST_DATA(cl,obj);
157 return(DoMethod(tv->tv_Listview,LVM_REFRESH,tvc->tvc_GInfo));
159 METHOD_END
161 /************************************************************************
162 **************************** TV_REFRESH() *****************************
163 ************************************************************************/
165 METHOD(TV_Refresh, struct tvCommand *, tvc)
167 TVData *tv;
169 tv = INST_DATA(cl,obj);
171 return(DoMethod(tv->tv_Listview,LVM_REFRESH,tvc->tvc_GInfo));
173 METHOD_END
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)
185 TVData *tv;
186 TNPTR tn;
187 BOOL ok;
189 tv = INST_DATA(cl,obj);
191 DoMethod(tv->tv_Listview,LVM_CLEAR,NULL);
193 tn = FirstChildIn(RootList(tv));
194 ok = TRUE;
196 while(tn && ok)
198 /* debug
199 KPrintF("TVM_REBUILD: Parent:%-16s Node:%-16s\n",
200 tn->tn_Parent ? (STRPTR) tn->tn_Parent->tn_Entry : "Root",
201 tn->tn_Entry);
204 ok = (BOOL) DoMethod(tv->tv_Listview,LVM_ADDSINGLE,NULL,tn,LVAP_TAIL,0);
205 tn = TV_GetNextTreeNode(tn,TVF_VISIBLE,0,~0);
208 /* debug
209 if (!ok)
210 KPrintF("TVM_REBUILD: *** Failed to add to listview! ***\n");
213 DoMethod(tv->tv_Listview,LVM_REFRESH,tvc->tvc_GInfo);
215 return((ULONG) ok);
217 METHOD_END