* Introduced methods ResizeColumnToPreferred() and

ResizeAllColumnsToPreferred().
* Automatic white space cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30683 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-05-09 18:47:19 +00:00
parent b8b22908a4
commit d571c5835d
2 changed files with 298 additions and 254 deletions

View File

@ -96,14 +96,14 @@ enum ColumnListViewColor {
B_COLOR_HEADER_TEXT = 9, B_COLOR_HEADER_TEXT = 9,
B_COLOR_SEPARATOR_LINE = 10, B_COLOR_SEPARATOR_LINE = 10,
B_COLOR_SEPARATOR_BORDER = 11, B_COLOR_SEPARATOR_BORDER = 11,
B_COLOR_TOTAL = 12 B_COLOR_TOTAL = 12
}; };
enum ColumnListViewFont { enum ColumnListViewFont {
B_FONT_ROW = 0, B_FONT_ROW = 0,
B_FONT_HEADER = 1, B_FONT_HEADER = 1,
B_FONT_TOTAL = 2 B_FONT_TOTAL = 2
}; };
@ -144,7 +144,7 @@ private:
BPrivate:: BPrivate::
BRowContainer* fChildList; BRowContainer* fChildList;
bool fIsExpanded; bool fIsExpanded;
float fHeight; float fHeight;
BRow* fNextSelected; BRow* fNextSelected;
BRow* fPrevSelected; BRow* fPrevSelected;
BRow* fParent; BRow* fParent;
@ -166,7 +166,7 @@ public:
float maxWidth, float maxWidth,
alignment align = B_ALIGN_LEFT); alignment align = B_ALIGN_LEFT);
virtual ~BColumn(); virtual ~BColumn();
float Width() const; float Width() const;
void SetWidth(float width); void SetWidth(float width);
float MinWidth() const; float MinWidth() const;
@ -176,7 +176,7 @@ public:
virtual void DrawField(BField* field, BRect rect, virtual void DrawField(BField* field, BRect rect,
BView* targetView); BView* targetView);
virtual int CompareFields(BField* field1, BField* field2); virtual int CompareFields(BField* field1, BField* field2);
virtual void MouseMoved(BColumnListView* parent, BRow* row, virtual void MouseMoved(BColumnListView* parent, BRow* row,
BField* field, BRect fieldRect, BField* field, BRect fieldRect,
BPoint point, uint32 buttons, int32 code); BPoint point, uint32 buttons, int32 code);
@ -185,25 +185,25 @@ public:
BPoint point, uint32 buttons); BPoint point, uint32 buttons);
virtual void MouseUp(BColumnListView* parent, BRow* row, virtual void MouseUp(BColumnListView* parent, BRow* row,
BField* field); BField* field);
virtual void GetColumnName(BString* into) const; virtual void GetColumnName(BString* into) const;
virtual float GetPreferredWidth(BField* field, virtual float GetPreferredWidth(BField* field,
BView* parent) const; BView* parent) const;
bool IsVisible() const; bool IsVisible() const;
void SetVisible(bool); void SetVisible(bool);
bool WantsEvents() const; bool WantsEvents() const;
void SetWantsEvents(bool); void SetWantsEvents(bool);
bool ShowHeading() const; bool ShowHeading() const;
void SetShowHeading(bool); void SetShowHeading(bool);
alignment Alignment() const; alignment Alignment() const;
void SetAlignment(alignment); void SetAlignment(alignment);
int32 LogicalFieldNum() const; int32 LogicalFieldNum() const;
/*! /*!
\param field The BField derivative to validate. \param field The BField derivative to validate.
@ -219,10 +219,10 @@ public:
logical field index where it occured. logical field index where it occured.
\note Do not call the inherited version of this, it just returns \note Do not call the inherited version of this, it just returns
true; true;
*/ */
virtual bool AcceptsField(const BField* field) const; virtual bool AcceptsField(const BField* field) const;
private: private:
float fWidth; float fWidth;
float fMinWidth; float fMinWidth;
@ -234,7 +234,7 @@ private:
bool fWantsEvents; bool fWantsEvents;
bool fShowHeading; bool fShowHeading;
alignment fAlignment; alignment fAlignment;
friend class BPrivate::OutlineView; friend class BPrivate::OutlineView;
friend class BColumnListView; friend class BColumnListView;
friend class BPrivate::TitleView; friend class BPrivate::TitleView;
@ -265,8 +265,8 @@ public:
void SetFocusRow(int32 index, bool select = false); void SetFocusRow(int32 index, bool select = false);
void SetFocusRow(BRow* row, bool select = false); void SetFocusRow(BRow* row, bool select = false);
void SetMouseTrackingEnabled(bool); void SetMouseTrackingEnabled(bool);
// Selection // Selection
list_view_type SelectionMode() const; list_view_type SelectionMode() const;
void Deselect(BRow* row); void Deselect(BRow* row);
void AddToSelection(BRow* row); void AddToSelection(BRow* row);
@ -276,7 +276,7 @@ public:
virtual void SetSelectionMessage(BMessage* message); virtual void SetSelectionMessage(BMessage* message);
BMessage* SelectionMessage(); BMessage* SelectionMessage();
uint32 SelectionCommand() const; uint32 SelectionCommand() const;
void SetSelectionMode(list_view_type type); void SetSelectionMode(list_view_type type);
// list_view_type is defined in ListView.h. // list_view_type is defined in ListView.h.
// Sorting // Sorting
@ -290,7 +290,7 @@ public:
void AddStatusView(BView* view); void AddStatusView(BView* view);
BView* RemoveStatusView(); BView* RemoveStatusView();
// Column Manipulation // Column Manipulation
void AddColumn(BColumn* column, void AddColumn(BColumn* column,
int32 logicalFieldIndex); int32 logicalFieldIndex);
void MoveColumn(BColumn* column, int32 index); void MoveColumn(BColumn* column, int32 index);
@ -299,9 +299,11 @@ public:
BColumn* ColumnAt(int32 index) const; BColumn* ColumnAt(int32 index) const;
void SetColumnVisible(BColumn* column, void SetColumnVisible(BColumn* column,
bool isVisible); bool isVisible);
void SetColumnVisible(int32, bool); void SetColumnVisible(int32, bool);
bool IsColumnVisible(int32) const; bool IsColumnVisible(int32) const;
void SetColumnFlags(column_flags flags); void SetColumnFlags(column_flags flags);
void ResizeColumnToPreferred(int32 index);
void ResizeAllColumnsToPreferred();
// Row manipulation // Row manipulation
const BRow* RowAt(int32 index, BRow *parent = 0) const; const BRow* RowAt(int32 index, BRow *parent = 0) const;
@ -316,14 +318,14 @@ public:
void AddRow(BRow* row, BRow* parent = NULL); void AddRow(BRow* row, BRow* parent = NULL);
void AddRow(BRow* row, int32 index, void AddRow(BRow* row, int32 index,
BRow* parent = NULL); BRow* parent = NULL);
void ScrollTo(const BRow* Row); void ScrollTo(const BRow* Row);
void ScrollTo(BPoint point); void ScrollTo(BPoint point);
// Does not delete row or children at this time. // Does not delete row or children at this time.
// todo: Make delete row and children // todo: Make delete row and children
void RemoveRow(BRow* row); void RemoveRow(BRow* row);
void UpdateRow(BRow* row); void UpdateRow(BRow* row);
void Clear(); void Clear();
@ -334,12 +336,12 @@ public:
uint32 mask = B_FONT_ALL); uint32 mask = B_FONT_ALL);
virtual void SetHighColor(rgb_color); virtual void SetHighColor(rgb_color);
void SetSelectionColor(rgb_color); void SetSelectionColor(rgb_color);
void SetBackgroundColor(rgb_color); void SetBackgroundColor(rgb_color);
void SetEditColor(rgb_color); void SetEditColor(rgb_color);
const rgb_color SelectionColor() const; const rgb_color SelectionColor() const;
const rgb_color BackgroundColor() const; const rgb_color BackgroundColor() const;
const rgb_color EditColor() const; const rgb_color EditColor() const;
// Appearance (NEW STYLE) // Appearance (NEW STYLE)
void SetColor(ColumnListViewColor colorIndex, void SetColor(ColumnListViewColor colorIndex,
rgb_color color); rgb_color color);
@ -349,10 +351,10 @@ public:
rgb_color Color(ColumnListViewColor colorIndex) const; rgb_color Color(ColumnListViewColor colorIndex) const;
void GetFont(ColumnListViewFont fontIndex, void GetFont(ColumnListViewFont fontIndex,
BFont* font) const; BFont* font) const;
BPoint SuggestTextPosition(const BRow* row, BPoint SuggestTextPosition(const BRow* row,
const BColumn* column = NULL) const; const BColumn* column = NULL) const;
void SetLatchWidth(float width); void SetLatchWidth(float width);
float LatchWidth() const; float LatchWidth() const;
virtual void DrawLatch(BView* view, BRect frame, virtual void DrawLatch(BView* view, BRect frame,

File diff suppressed because it is too large Load Diff