1 /* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef TABLE_COLUMN_H 6 #define TABLE_COLUMN_H 7 8 #include <InterfaceDefs.h> 9 #include <Rect.h> 10 11 #include <Variant.h> 12 13 14 class BString; 15 class BView; 16 17 18 class TableColumn { 19 public: 20 TableColumn(int32 modelIndex, float width, 21 float minWidth, float maxWidth, 22 alignment align); 23 virtual ~TableColumn(); 24 ModelIndex()25 int32 ModelIndex() const { return fModelIndex; } 26 Width()27 float Width() const { return fWidth; } MinWidth()28 float MinWidth() const { return fMinWidth; } MaxWidth()29 float MaxWidth() const { return fMaxWidth; } 30 Alignment()31 alignment Alignment() const { return fAlignment; } 32 33 virtual void GetColumnName(BString* into) const; 34 35 virtual void DrawTitle(BRect rect, BView* targetView); 36 virtual void DrawValue(const BVariant& value, BRect rect, 37 BView* targetView); 38 virtual int CompareValues(const BVariant& a, 39 const BVariant& b); 40 virtual float GetPreferredWidth(const BVariant& value, 41 BView* parent) const; 42 43 private: 44 int32 fModelIndex; 45 float fWidth; 46 float fMinWidth; 47 float fMaxWidth; 48 alignment fAlignment; 49 }; 50 51 52 #endif // TABLE_COLUMN_H 53