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