2 * Copyright (c) 1998-2007 Matthijs Hollemans
3 * All rights reserved. Distributed under the terms of the MIT License.
6 #include "GrepListView.h"
10 ResultItem::ResultItem(const entry_ref
& ref
)
11 : BStringItem("", 0, false),
20 GrepListView::GrepListView()
21 : BOutlineListView("SearchResults",
22 B_MULTIPLE_SELECTION_LIST
,
23 B_WILL_DRAW
| B_NAVIGABLE
)
29 GrepListView::FindItem(const entry_ref
& ref
, int32
* _index
) const
31 int32 count
= FullListCountItems();
32 for (int32 i
= 0; i
< count
; i
++) {
33 ResultItem
* item
= dynamic_cast<ResultItem
*>(FullListItemAt(i
));
36 if (item
->ref
== ref
) {
47 GrepListView::RemoveResults(const entry_ref
& ref
, bool completeItem
)
50 ResultItem
* item
= FindItem(ref
, &index
);
54 // remove all the sub items
56 BListItem
* subItem
= FullListItemAt(index
+ 1);
57 if (subItem
&& subItem
->OutlineLevel() > 0)
58 delete RemoveItem(index
+ 1);
64 // remove file item itself
65 delete RemoveItem(index
);