xref: /haiku/headers/os/interface/ListItem.h (revision d5cd5d63ff0ad395989db6cf4841a64d5b545d1d)
1 /*******************************************************************************
2 /
3 /	File:			ListItem.h
4 /
5 /   Description:    BListView represents a one-dimensional list view.
6 /
7 /	Copyright 1996-98, Be Incorporated, All Rights Reserved
8 /
9 *******************************************************************************/
10 
11 #ifndef _LIST_ITEM_H
12 #define _LIST_ITEM_H
13 
14 #include <BeBuild.h>
15 #include <Archivable.h>
16 #include <Rect.h>
17 
18 class BFont;
19 class BMessage;
20 class BOutlineListView;
21 class BView;
22 
23 /*----------------------------------------------------------------*/
24 /*----- BListItem class ------------------------------------------*/
25 
26 class BListItem : public BArchivable {
27 public:
28 					BListItem(uint32 outlineLevel = 0, bool expanded = true);
29 					BListItem(BMessage *data);
30 virtual				~BListItem();
31 virtual	status_t	Archive(BMessage *data, bool deep = true) const;
32 
33 		float		Height() const;
34 		float		Width() const;
35 		bool		IsSelected() const;
36 		void		Select();
37 		void		Deselect();
38 
39 virtual	void		SetEnabled(bool on);
40 		bool		IsEnabled() const;
41 
42 		void		SetHeight(float height);
43 		void		SetWidth(float width);
44 virtual	void		DrawItem(BView *owner,
45 							BRect bounds,
46 							bool complete = false) = 0;
47 virtual	void		Update(BView *owner, const BFont *font);
48 
49 virtual status_t	Perform(perform_code d, void *arg);
50 
51 		bool 		IsExpanded() const;
52 		void 		SetExpanded(bool expanded);
53 		uint32 		OutlineLevel() const;
54 
55 /*----- Private or reserved -----------------------------------------*/
56 private:
57 friend class BOutlineListView;
58 
59 		bool 		HasSubitems() const;
60 
61 virtual	void		_ReservedListItem1();
62 virtual	void		_ReservedListItem2();
63 
64 					BListItem(const BListItem &);
65 		BListItem	&operator=(const BListItem &);
66 
67 		/* calls used by BOutlineListView*/
68 		bool 		IsItemVisible() const;
69 		void 		SetItemVisible(bool);
70 
71 		uint32		_reserved[2];
72 		float		fWidth;
73 		float		fHeight;
74 		uint32 		fLevel;
75 		bool		fSelected;
76 		bool		fEnabled;
77 		bool 		fExpanded;
78 		bool 		fHasSubitems : 1;
79 		bool 		fVisible : 1;
80 };
81 
82 
83 /*-------------------------------------------------------------*/
84 
85 #include <StringItem.h> /* to maintain compatibility */
86 
87 #endif /* _LIST_ITEM_H */
88