1#ifndef CLVColumnLabelView_h
2#define CLVColumnLabelView_h
3
4#include <support/SupportDefs.h>
5#include <InterfaceKit.h>
6
7//******************************************************************************************************
8//**** PROJECT HEADER FILES AND CLASS NAME DECLARATIONS
9//******************************************************************************************************
10class ColumnListView;
11class CLVColumn;
12
13
14//******************************************************************************************************
15//**** CLASS AND STRUCTURE DECLARATIONS, ASSOCIATED CONSTANTS AND STATIC FUNCTIONS
16//******************************************************************************************************
17struct CLVDragGroup
18{
19	int32 GroupStartDispListIndex;		//Indices in the column display list where this group starts
20	int32 GroupStopDispListIndex;		//and finishes
21	float GroupBegin,GroupEnd;			//-1.0 if whole group is hidden
22	CLVColumn* LastColumnShown;
23	bool AllLockBeginning;
24	bool AllLockEnd;
25	bool Shown;							//False if none of the columns in this group are shown
26	uint32 Flags;						//Uses CLV_NOT_MOVABLE, CLV_LOCK_AT_BEGINNING, CLV_LOCK_AT_END
27};
28
29
30class CLVColumnLabelView : public BView
31{
32	public:
33		//Constructor and destructor
34		CLVColumnLabelView(BRect Bounds,ColumnListView* Parent,const BFont* Font);
35		~CLVColumnLabelView();
36
37		//BView overrides
38		void Draw(BRect UpdateRect);
39		void MouseDown(BPoint Point);
40		void MessageReceived(BMessage *message);
41
42	private:
43		friend class ColumnListView;
44		friend class CLVColumn;
45
46		float fFontAscent;
47		BList* fDisplayList;
48
49		//Column select and drag stuff
50		CLVColumn* fColumnClicked;
51		BPoint fPreviousMousePos;
52		BPoint fMouseClickedPos;
53		bool fColumnDragging;
54		bool fColumnResizing;
55		BList fDragGroups;					//Groups of CLVColumns that must drag together
56		int32 fDragGroup;					//Index into DragGroups of the group being dragged by user
57		CLVDragGroup* fTheDragGroup;
58		CLVDragGroup* fTheShownGroupBefore;
59		CLVDragGroup* fTheShownGroupAfter;
60		int32 fSnapGroupBefore,				//Index into DragGroups of TheShownGroupBefore and
61			fSnapGroupAfter;				//TheShownGroupAfter, if the group the user is dragging is
62											//allowed to snap there, otherwise -1
63		float fDragBoxMouseHoldOffset,fResizeMouseHoldOffset;
64		float fDragBoxWidth;				//Can include multiple columns; depends on CLV_LOCK_WITH_RIGHT
65		float fPrevDragOutlineLeft,fPrevDragOutlineRight;
66		float fSnapMin,fSnapMax;			//-1.0 indicates the column can't snap in the given direction
67		ColumnListView* fParent;
68
69		//Private functions
70		void ShiftDragGroup(int32 NewPos);
71		void UpdateDragGroups();
72		void SetSnapMinMax();
73};
74
75#endif
76
77