Added ColumnAt(BPoint) version.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33587 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-10-15 04:31:42 +00:00
parent e628f41c49
commit 2fc49d9b36
2 changed files with 21 additions and 0 deletions

View File

@ -297,6 +297,7 @@ public:
void RemoveColumn(BColumn* column);
int32 CountColumns() const;
BColumn* ColumnAt(int32 index) const;
BColumn* ColumnAt(BPoint point) const;
void SetColumnVisible(BColumn* column,
bool isVisible);
void SetColumnVisible(int32, bool);

View File

@ -1118,6 +1118,26 @@ BColumnListView::ColumnAt(int32 field) const
}
BColumn*
BColumnListView::ColumnAt(BPoint point) const
{
float left = MAX(kLeftMargin, LatchWidth());
for (int i = 0; BColumn* column = (BColumn*)fColumns.ItemAt(i); i++) {
if (!column->IsVisible())
continue;
float right = left + column->Width();
if (point.x >= left && point.x <= right)
return column;
left = right + 1;
}
return NULL;
}
void
BColumnListView::SetColumnVisible(BColumn* column, bool visible)
{