xref: /haiku/headers/os/interface/ListItem.h (revision d3d8b26997fac34a84981e6d2b649521de2cc45a)
1 /*
2  * Copyright 2006, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _LIST_ITEM_H
6 #define _LIST_ITEM_H
7 
8 
9 #include <Archivable.h>
10 #include <Rect.h>
11 
12 class BFont;
13 class BMessage;
14 class BOutlineListView;
15 class BView;
16 
17 
18 class BListItem : public BArchivable {
19 	public:
20 							BListItem(uint32 outlineLevel = 0, bool expanded = true);
21 							BListItem(BMessage* archive);
22 		virtual				~BListItem();
23 
24 		virtual	status_t	Archive(BMessage* archive, bool deep = true) const;
25 
26 		float				Height() const;
27 		float				Width() const;
28 		bool				IsSelected() const;
29 		void				Select();
30 		void				Deselect();
31 
32 		virtual	void		SetEnabled(bool enabled);
33 		bool				IsEnabled() const;
34 
35 		void				SetHeight(float height);
36 		void				SetWidth(float width);
37 		virtual	void		DrawItem(BView* owner, BRect frame,
38 								bool complete = false) = 0;
39 		virtual	void		Update(BView* owner, const BFont* font);
40 
41 		virtual status_t	Perform(perform_code code, void* arg);
42 
43 		bool				IsExpanded() const;
44 		void				SetExpanded(bool expanded);
45 		uint32				OutlineLevel() const;
46 
47 	private:
48 		friend class BOutlineListView;
49 
50 		bool				HasSubitems() const;
51 
52 		virtual	void		_ReservedListItem1();
53 		virtual	void		_ReservedListItem2();
54 
55 							BListItem(const BListItem& item);
56 		BListItem&			operator=(const BListItem& item);
57 
58 		bool				IsItemVisible() const;
59 		void				SetItemVisible(bool visible);
60 
61 	private:
62 		uint32				_reserved[1];
63 		BList*				fTemporaryList;
64 		float				fWidth;
65 		float				fHeight;
66 		uint32				fLevel;
67 		bool				fSelected;
68 		bool				fEnabled;
69 		bool				fExpanded;
70 		bool				fHasSubitems : 1;
71 		bool				fVisible : 1;
72 };
73 
74 #include <StringItem.h>
75 	// to maintain source compatibility
76 
77 #endif	// _LIST_ITEM_H
78