From ed6f171aa6886208a0a2f2e695fbee97133ca3aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Mon, 16 Sep 2013 23:16:52 +0200 Subject: [PATCH] BColumnListView: Enable invalidating rows, fix SetField() * Seems like there was no easy way to simply invalidate a given BRow. Introduced BColumnListView::InvalidateRow(). * BRow::SetField() tried to invalidate the row, but invalidated the listview instead of the BOutlineView responsible for drawing the list contents. Use the new InvaalidateRow(). --- headers/private/interface/ColumnListView.h | 4 ++++ src/kits/interface/ColumnListView.cpp | 21 ++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/headers/private/interface/ColumnListView.h b/headers/private/interface/ColumnListView.h index 027154b98b..f262b09f47 100644 --- a/headers/private/interface/ColumnListView.h +++ b/headers/private/interface/ColumnListView.h @@ -135,6 +135,8 @@ public: bool IsExpanded() const; bool IsSelected() const; + void Invalidate(); + private: // Blows up into the debugger if the validation fails. void ValidateFields() const; @@ -332,6 +334,8 @@ public: parentRow1 = NULL, BRow* parentRow2 = NULL); void Clear(); + void InvalidateRow(BRow* row); + // Appearance (DEPRECATED) void GetFont(BFont* font) const { BView::GetFont(font); } diff --git a/src/kits/interface/ColumnListView.cpp b/src/kits/interface/ColumnListView.cpp index fd5c5747e8..eea89d49f6 100644 --- a/src/kits/interface/ColumnListView.cpp +++ b/src/kits/interface/ColumnListView.cpp @@ -500,9 +500,7 @@ BRow::SetField(BField* field, int32 logicalFieldIndex) if (NULL != fList) { ValidateField(field, logicalFieldIndex); - BRect inv; - fList->GetRowRect(this, &inv); - fList->Invalidate(inv); + Invalidate(); } fFields.AddItem(field, logicalFieldIndex); @@ -530,6 +528,14 @@ BRow::IsSelected() const } +void +BRow::Invalidate() +{ + if (fList != NULL) + fList->InvalidateRow(this); +} + + void BRow::ValidateFields() const { @@ -1340,6 +1346,15 @@ BColumnListView::Clear() } +void +BColumnListView::InvalidateRow(BRow* row) +{ + BRect updateRect; + GetRowRect(row, &updateRect); + fOutlineView->Invalidate(updateRect); +} + + void BColumnListView::SetFont(const BFont* font, uint32 mask) {