1#ifndef CLVColumn_h 2#define CLVColumn_h 3 4#include <support/SupportDefs.h> 5#include <interface/PopUpMenu.h> 6 7//****************************************************************************************************** 8//**** PROJECT HEADER FILES AND CLASS NAME DECLARATIONS 9//****************************************************************************************************** 10class ColumnListView; 11class CLVColumn; 12class CLVListItem; 13 14 15//****************************************************************************************************** 16//**** CONSTANTS 17//****************************************************************************************************** 18//Flags 19enum 20{ 21 CLV_SORT_KEYABLE = 0x00000001, //Can be used as the sorting key 22 CLV_NOT_MOVABLE = 0x00000002, //Column can't be moved by user 23 CLV_NOT_RESIZABLE = 0x00000004, //Column can't be resized by user 24 CLV_LOCK_AT_BEGINNING = 0x00000008, //Movable columns may not be placed or moved by the user 25 //into a position before this one 26 CLV_LOCK_AT_END = 0x00000010, //Movable columns may not be placed or moved by the user 27 //into a position after this one 28 CLV_HIDDEN = 0x00000020, //This column is hidden initially 29 CLV_MERGE_WITH_RIGHT = 0x00000040, //Merge this column label with the one that follows it. 30 CLV_LOCK_WITH_RIGHT = 0x00000080, //Lock this column to the one that follows it such that 31 //if the column to the right is moved by the user, this 32 //one will move with it and vice versa 33 CLV_EXPANDER = 0x00000100, //Column contains an expander. You may only use one 34 //expander in a ColumnListView, and an expander may not be 35 //added to a non-hierarchal ColumnListView. It may not 36 //have a label. Its width is automatically set to 20.0. 37 //The only flags that affect it are CLV_NOT_MOVABLE, 38 //CLV_LOCK_AT_BEGINNING, CLV_NOT_SHOWN and 39 //CLV_LOCK_WITH_RIGHT. The others are set for you: 40 //CLV_NOT_RESIZABLE | CLV_MERGE_WITH_RIGHT 41 CLV_PUSH_PASS = 0x00000200 //Causes this column, if pushed by an expander to the 42 //left, to pass that push on and also push the next 43}; //column to the right. 44 45enum CLVSortMode 46{ 47 Ascending, 48 Descending, 49 NoSort 50}; 51 52 53//****************************************************************************************************** 54//**** ColumnListView CLASS DECLARATION 55//****************************************************************************************************** 56class CLVColumn 57{ 58 public: 59 //Constructor and destructor 60 CLVColumn( const char* label, 61 BPopUpMenu * popup = NULL, 62 float width = 20.0, 63 uint32 flags = 0L, 64 float min_width = 20.0); 65 virtual ~CLVColumn(); 66 67 //Archival stuff 68 /* Not implemented yet 69 CLVColumn(BMessage* archive); 70 static CLVColumn* Instantiate(BMessage* data); 71 virtual status_t Archive(BMessage* data, bool deep = true) const; 72 */ 73 74 //Functions 75 float Width() const; 76 virtual void SetWidth(float width); //Can be overridden to detect changes to the column width 77 //however since you are probably overriding 78 //ColumnListView and dealing with an array of columns 79 //anyway, it is probably more useful to override 80 //ColumnListView::ColumnWidthChanged to detect changes to 81 //column widths 82 uint32 Flags() const; 83 bool IsShown() const; 84 void SetShown(bool shown); 85 CLVSortMode SortMode() const; 86 void SetSortMode(CLVSortMode mode); 87 const char * GetLabel() const {return fLabel;} 88 BPopUpMenu * GetPopup() {return fPopup;} 89 90 private: 91 friend class ColumnListView; 92 friend class CLVColumnLabelView; 93 friend class CLVListItem; 94 95 const char *fLabel; 96 float fWidth; 97 float fMinWidth; 98 float fColumnBegin; 99 float fColumnEnd; 100 uint32 fFlags; 101 bool fPushedByExpander; 102 CLVSortMode fSortMode; 103 ColumnListView* fParent; 104 BPopUpMenu * fPopup; // added by jaf 105}; 106 107#endif 108