When an item is added to the list, we must immediately set its top,

otherwise if it tries to make use of any positional information in the
subsequent call to Update() (i.e. calls to ItemFrame(), or Top(), it will
get back bogus coordinates. This should correctly fix the problems seen with
Themes, possibly amongst others.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28692 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2008-11-19 03:54:59 +00:00
parent d423222f0c
commit 6826c30a25
+12 -7
View File
@@ -533,8 +533,10 @@ BListView::AddItem(BListItem *item, int32 index)
if (Window()) {
BFont font;
GetFont(&font);
item->SetTop((index > 0) ? ItemAt(index - 1)->Bottom() + 1.0 : 0.0);
item->Update(this, &font);
_RecalcItemTops(index);
_RecalcItemTops(index + 1);
_FixupScrollBar();
_InvalidateFrom(index);
@@ -549,15 +551,16 @@ BListView::AddItem(BListItem* item)
{
if (!fList.AddItem(item))
return false;
// No need to adapt selection, as this item is the last in the list
if (Window()) {
BFont font;
GetFont(&font);
int32 index = CountItems() - 1;
item->SetTop((index > 0) ? ItemAt(index - 1)->Bottom() + 1.0 : 0.0);
item->Update(this, &font);
_RecalcItemTops(CountItems() - 1);
_FixupScrollBar();
InvalidateItem(CountItems() - 1);
}
@@ -584,10 +587,12 @@ BListView::AddList(BList* list, int32 index)
BFont font;
GetFont(&font);
for (int32 i = index; i <= (index + list->CountItems() - 1); i++)
for (int32 i = index; i <= (index + list->CountItems() - 1); i++) {
ItemAt(i)->SetTop((i > 0) ? ItemAt(i - 1)->Bottom() + 1.0 : 0.0);
ItemAt(i)->Update(this, &font);
_RecalcItemTops(index);
}
_RecalcItemTops(index + list->CountItems() - 1);
_FixupScrollBar();
Invalidate(); // TODO