1class TreeItem : public CLVListItem
2{
3	public:
4		TreeItem(uint32 level, bool superitem, bool expanded, int32 resourceID, BView *headerView, ColumnListView *listView, char* text);
5		~TreeItem();
6		void DrawItemColumn(BView* owner, BRect item_column_rect, int32 column_index, bool complete);
7		void Update(BView *owner, const BFont *font);
8		static int MyCompare(const CLVListItem* a_Item1, const CLVListItem* a_Item2, int32 KeyColumn);
9
10		ColumnListView *GetAssociatedList()				{ return assocListView; }
11		void SetAssociatedList(ColumnListView *list)	{ assocListView = list; }
12
13		BView *GetAssociatedHeader()					{ return assocHeaderView; }
14		void SetAssociatedHeader(BView *header)			{ assocHeaderView = header; }
15
16		virtual void ItemSelected();
17		virtual void ItemExpanding();
18		virtual void ListItemSelected();
19		virtual void ListItemDeselected();
20		virtual void ListItemUpdated(int index, CLVListItem *item);
21		virtual bool HeaderMessageReceived(BMessage *msg);
22
23	protected:
24		void PurgeRows();
25		void PurgeColumns();
26		void PurgeHeader();
27
28	private:
29		void setIcon(int32 resourceID);
30
31		BView *assocHeaderView;
32		ColumnListView *assocListView;
33		BBitmap* fIcon;
34		char *fText;
35		float fTextOffset;
36};
37
38// ----- SmartTreeListView ----------------------------------------------------------------
39
40class SmartTreeListView : public ColumnListView
41{
42	public:
43		SmartTreeListView(BRect Frame, CLVContainerView** ContainerView,
44			const char* Name = NULL, uint32 ResizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
45			uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE,
46			list_view_type Type = B_SINGLE_SELECTION_LIST,
47			bool hierarchical = false, bool horizontal = true, bool vertical = true,
48			bool scroll_view_corner = true, border_style border = B_NO_BORDER,
49			const BFont* LabelFont = be_plain_font);
50
51		virtual ~SmartTreeListView();
52
53		void MouseUp(BPoint point);
54		void Expand(TreeItem *item);
55
56	private:
57		CLVContainerView *container;
58		int lastSelection;
59};
60