1*d734a8ceSbeveloper /******************************************************************************* 2*d734a8ceSbeveloper / 3*d734a8ceSbeveloper / File: OutlineListView.h 4*d734a8ceSbeveloper / 5*d734a8ceSbeveloper / Description: BOutlineListView represents a "nestable" list view. 6*d734a8ceSbeveloper / 7*d734a8ceSbeveloper / Copyright 1997-98, Be Incorporated, All Rights Reserved 8*d734a8ceSbeveloper / 9*d734a8ceSbeveloper *******************************************************************************/ 10*d734a8ceSbeveloper 11*d734a8ceSbeveloper #ifndef _OUTLINE_LIST_VIEW_H 12*d734a8ceSbeveloper #define _OUTLINE_LIST_VIEW_H 13*d734a8ceSbeveloper 14*d734a8ceSbeveloper #include <BeBuild.h> 15*d734a8ceSbeveloper #include <ListView.h> 16*d734a8ceSbeveloper 17*d734a8ceSbeveloper class BListItem; 18*d734a8ceSbeveloper 19*d734a8ceSbeveloper /*----------------------------------------------------------------*/ 20*d734a8ceSbeveloper /*----- BOutlineListView class -----------------------------------*/ 21*d734a8ceSbeveloper 22*d734a8ceSbeveloper class BOutlineListView : public BListView { 23*d734a8ceSbeveloper public: 24*d734a8ceSbeveloper BOutlineListView(BRect frame, 25*d734a8ceSbeveloper const char * name, 26*d734a8ceSbeveloper list_view_type type = B_SINGLE_SELECTION_LIST, 27*d734a8ceSbeveloper uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP, 28*d734a8ceSbeveloper uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS 29*d734a8ceSbeveloper | B_NAVIGABLE); 30*d734a8ceSbeveloper BOutlineListView(BMessage *data); 31*d734a8ceSbeveloper virtual ~BOutlineListView(); 32*d734a8ceSbeveloper 33*d734a8ceSbeveloper static BArchivable *Instantiate(BMessage *data); 34*d734a8ceSbeveloper virtual status_t Archive(BMessage *data, bool deep = true) const; 35*d734a8ceSbeveloper 36*d734a8ceSbeveloper virtual void MouseDown(BPoint where); 37*d734a8ceSbeveloper virtual void KeyDown(const char *bytes, int32 numBytes); 38*d734a8ceSbeveloper virtual void FrameMoved(BPoint new_position); 39*d734a8ceSbeveloper virtual void FrameResized(float new_width, float new_height); 40*d734a8ceSbeveloper virtual void MouseUp(BPoint where); 41*d734a8ceSbeveloper 42*d734a8ceSbeveloper virtual bool AddUnder(BListItem *item, BListItem *underItem); 43*d734a8ceSbeveloper 44*d734a8ceSbeveloper virtual bool AddItem(BListItem *item); 45*d734a8ceSbeveloper virtual bool AddItem(BListItem *item, int32 fullListIndex); 46*d734a8ceSbeveloper virtual bool AddList(BList *newItems); 47*d734a8ceSbeveloper virtual bool AddList(BList *newItems, int32 fullListIndex); 48*d734a8ceSbeveloper 49*d734a8ceSbeveloper virtual bool RemoveItem(BListItem *item); 50*d734a8ceSbeveloper virtual BListItem *RemoveItem(int32 fullListIndex); 51*d734a8ceSbeveloper virtual bool RemoveItems(int32 fullListIndex, int32 count); 52*d734a8ceSbeveloper 53*d734a8ceSbeveloper 54*d734a8ceSbeveloper /* The following calls operator on the full outlinelist */ 55*d734a8ceSbeveloper BListItem *FullListItemAt(int32 fullListIndex) const; 56*d734a8ceSbeveloper int32 FullListIndexOf(BPoint point) const; 57*d734a8ceSbeveloper int32 FullListIndexOf(BListItem *item) const; 58*d734a8ceSbeveloper BListItem *FullListFirstItem() const; 59*d734a8ceSbeveloper BListItem *FullListLastItem() const; 60*d734a8ceSbeveloper bool FullListHasItem(BListItem *item) const; 61*d734a8ceSbeveloper int32 FullListCountItems() const; 62*d734a8ceSbeveloper int32 FullListCurrentSelection(int32 index = 0) const; 63*d734a8ceSbeveloper virtual void MakeEmpty(); 64*d734a8ceSbeveloper bool FullListIsEmpty() const; 65*d734a8ceSbeveloper void FullListDoForEach(bool (*func)(BListItem *)); 66*d734a8ceSbeveloper void FullListDoForEach(bool (*func)(BListItem *, void *), void*); 67*d734a8ceSbeveloper 68*d734a8ceSbeveloper BListItem *Superitem(const BListItem *item); 69*d734a8ceSbeveloper 70*d734a8ceSbeveloper void Expand(BListItem *item); 71*d734a8ceSbeveloper void Collapse(BListItem *item); 72*d734a8ceSbeveloper 73*d734a8ceSbeveloper bool IsExpanded(int32 fullListIndex); 74*d734a8ceSbeveloper 75*d734a8ceSbeveloper virtual BHandler *ResolveSpecifier(BMessage *msg, 76*d734a8ceSbeveloper int32 index, 77*d734a8ceSbeveloper BMessage *specifier, 78*d734a8ceSbeveloper int32 form, 79*d734a8ceSbeveloper const char *property); 80*d734a8ceSbeveloper virtual status_t GetSupportedSuites(BMessage *data); 81*d734a8ceSbeveloper virtual status_t Perform(perform_code d, void *arg); 82*d734a8ceSbeveloper 83*d734a8ceSbeveloper virtual void ResizeToPreferred(); 84*d734a8ceSbeveloper virtual void GetPreferredSize(float *width, float *height); 85*d734a8ceSbeveloper virtual void MakeFocus(bool state = true); 86*d734a8ceSbeveloper virtual void AllAttached(); 87*d734a8ceSbeveloper virtual void AllDetached(); 88*d734a8ceSbeveloper virtual void DetachedFromWindow(); 89*d734a8ceSbeveloper 90*d734a8ceSbeveloper 91*d734a8ceSbeveloper 92*d734a8ceSbeveloper void FullListSortItems(int (*compareFunc)(const BListItem *, 93*d734a8ceSbeveloper const BListItem *)); 94*d734a8ceSbeveloper void SortItemsUnder(BListItem *underItem, 95*d734a8ceSbeveloper bool oneLevelOnly, 96*d734a8ceSbeveloper int (*compareFunc)(const BListItem *, 97*d734a8ceSbeveloper const BListItem*)); 98*d734a8ceSbeveloper int32 CountItemsUnder(BListItem *under, bool oneLevelOnly) const; 99*d734a8ceSbeveloper BListItem *EachItemUnder(BListItem *underItem, 100*d734a8ceSbeveloper bool oneLevelOnly, 101*d734a8ceSbeveloper BListItem *(*eachFunc)(BListItem *, void *), 102*d734a8ceSbeveloper void *); 103*d734a8ceSbeveloper BListItem *ItemUnderAt(BListItem *underItem, 104*d734a8ceSbeveloper bool oneLevelOnly, 105*d734a8ceSbeveloper int32 index) const; 106*d734a8ceSbeveloper 107*d734a8ceSbeveloper protected: 108*d734a8ceSbeveloper 109*d734a8ceSbeveloper virtual bool DoMiscellaneous(MiscCode code, MiscData * data); 110*d734a8ceSbeveloper virtual void MessageReceived(BMessage *); 111*d734a8ceSbeveloper 112*d734a8ceSbeveloper /*----- Private or reserved -----------------------------------------*/ 113*d734a8ceSbeveloper private: 114*d734a8ceSbeveloper virtual void _ReservedOutlineListView1(); 115*d734a8ceSbeveloper virtual void _ReservedOutlineListView2(); 116*d734a8ceSbeveloper virtual void _ReservedOutlineListView3(); 117*d734a8ceSbeveloper virtual void _ReservedOutlineListView4(); 118*d734a8ceSbeveloper 119*d734a8ceSbeveloper typedef BListView _inherited; 120*d734a8ceSbeveloper 121*d734a8ceSbeveloper int32 FullListIndex(int32 index) const; 122*d734a8ceSbeveloper int32 ListViewIndex(int32 index) const; 123*d734a8ceSbeveloper 124*d734a8ceSbeveloper #if !_PR3_COMPATIBLE_ 125*d734a8ceSbeveloper protected: 126*d734a8ceSbeveloper #endif 127*d734a8ceSbeveloper virtual void ExpandOrCollapse(BListItem *underItem, bool expand); 128*d734a8ceSbeveloper 129*d734a8ceSbeveloper private: 130*d734a8ceSbeveloper 131*d734a8ceSbeveloper virtual BRect LatchRect(BRect itemRect, int32 level) const; 132*d734a8ceSbeveloper virtual void DrawLatch(BRect itemRect, int32 level, bool collapsed, 133*d734a8ceSbeveloper bool highlighted, bool misTracked); 134*d734a8ceSbeveloper virtual void DrawItem(BListItem *i, BRect cRect, bool complete = false); 135*d734a8ceSbeveloper 136*d734a8ceSbeveloper BListItem *RemoveCommon(int32 fullListIndex); 137*d734a8ceSbeveloper BListItem *RemoveOne(int32 fullListIndex); 138*d734a8ceSbeveloper 139*d734a8ceSbeveloper static void TrackInLatchItem(void *); 140*d734a8ceSbeveloper static void TrackOutLatchItem(void *); 141*d734a8ceSbeveloper 142*d734a8ceSbeveloper bool OutlineSwapItems(int32 a, int32 b); 143*d734a8ceSbeveloper bool OutlineMoveItem(int32 from, int32 to); 144*d734a8ceSbeveloper bool OutlineReplaceItem(int32 index, BListItem *item); 145*d734a8ceSbeveloper void CommonMoveItems(int32 from, int32 count, int32 to); 146*d734a8ceSbeveloper BListItem *SuperitemForIndex(int32 fullListIndex, int32 level); 147*d734a8ceSbeveloper int32 FindPreviousVisibleIndex(int32 fullListIndex); 148*d734a8ceSbeveloper 149*d734a8ceSbeveloper BList fullList; 150*d734a8ceSbeveloper uint32 _reserved[2]; 151*d734a8ceSbeveloper }; 152*d734a8ceSbeveloper 153*d734a8ceSbeveloper /*----------------------------------------------------------------*/ 154*d734a8ceSbeveloper /*----------------------------------------------------------------*/ 155*d734a8ceSbeveloper 156*d734a8ceSbeveloper #endif /* _OUTLINE_LIST_VIEW_H */ 157