Fix NotificationWindow's collapsing bug. (#8288)

When a BTwoDimensionalLayout has no visible elements, it has a max size
of B_SIZE_UNLIMITED in both dimensions. In this case, we want it to
shrink down to just the insets.
This commit is contained in:
Alex Wilson
2012-04-01 11:54:16 +12:00
parent 8090bd4a30
commit 002fd626d6
+4 -4
View File
@@ -169,9 +169,7 @@ AppGroupView::MouseDown(BPoint point)
BMessage message(kRemoveGroupView); BMessage message(kRemoveGroupView);
message.AddPointer("view", this); message.AddPointer("view", this);
fParent->PostMessage(&message); fParent->PostMessage(&message);
} } else if (fCollapseRect.Contains(point)) {
if (fCollapseRect.Contains(point)) {
fCollapsed = !fCollapsed; fCollapsed = !fCollapsed;
int32 children = fInfo.size(); int32 children = fInfo.size();
if (fCollapsed) { if (fCollapsed) {
@@ -179,16 +177,18 @@ AppGroupView::MouseDown(BPoint point)
if (!fInfo[i]->IsHidden()) if (!fInfo[i]->IsHidden())
fInfo[i]->Hide(); fInfo[i]->Hide();
} }
GetLayout()->SetExplicitMaxSize(GetLayout()->MinSize());
} else { } else {
for (int32 i = 0; i < children; i++) { for (int32 i = 0; i < children; i++) {
if (fInfo[i]->IsHidden()) if (fInfo[i]->IsHidden())
fInfo[i]->Show(); fInfo[i]->Show();
} }
GetLayout()->SetExplicitMaxSize(BSize(B_SIZE_UNSET, B_SIZE_UNSET));
} }
InvalidateLayout();
Invalidate(); // Need to redraw the collapse indicator and title Invalidate(); // Need to redraw the collapse indicator and title
} }
} }