In NotificationWindow, have AppGroupViews get deleted upon expiry.
I.e. once there are no more notifications in the AppGroupView, we get the NotificationWindow to delete it. As a result of this change, we no longer need the AppGroupView.cpp _ResizeViews() method.
This commit is contained in:
@@ -203,17 +203,22 @@ AppGroupView::MessageReceived(BMessage* msg)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
infoview_t::iterator vIt = find(fInfo.begin(), fInfo.end(), view);
|
infoview_t::iterator vIt = find(fInfo.begin(), fInfo.end(), view);
|
||||||
|
if (vIt == fInfo.end())
|
||||||
|
break;
|
||||||
|
|
||||||
if (vIt != fInfo.end()) {
|
fInfo.erase(vIt);
|
||||||
fInfo.erase(vIt);
|
GetLayout()->RemoveView(view);
|
||||||
GetLayout()->RemoveView(view);
|
delete view;
|
||||||
delete view;
|
|
||||||
|
fParent->PostMessage(msg);
|
||||||
|
|
||||||
|
if (!this->HasChildren()) {
|
||||||
|
Hide();
|
||||||
|
BMessage removeSelfMessage(kRemoveGroupView);
|
||||||
|
removeSelfMessage.AddPointer("view", this);
|
||||||
|
fParent->PostMessage(&removeSelfMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
_ResizeViews();
|
|
||||||
|
|
||||||
if (Window() != NULL)
|
|
||||||
Window()->PostMessage(msg);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -263,28 +268,6 @@ AppGroupView::Group() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
AppGroupView::_ResizeViews()
|
|
||||||
{
|
|
||||||
int32 children = fInfo.size();
|
|
||||||
|
|
||||||
if (!fCollapsed) {
|
|
||||||
for (int32 i = 0; i < children; i++) {
|
|
||||||
if (fInfo[i]->IsHidden())
|
|
||||||
fInfo[i]->Show();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int32 i = 0; i < children; i++)
|
|
||||||
if (!fInfo[i]->IsHidden())
|
|
||||||
fInfo[i]->Hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!IsHidden() && !HasChildren())
|
|
||||||
Hide();
|
|
||||||
fParent->Layout(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
AppGroupView::HasChildren()
|
AppGroupView::HasChildren()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,8 +35,6 @@ public:
|
|||||||
const BString& Group() const;
|
const BString& Group() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _ResizeViews();
|
|
||||||
|
|
||||||
BString fLabel;
|
BString fLabel;
|
||||||
NotificationWindow* fParent;
|
NotificationWindow* fParent;
|
||||||
infoview_t fInfo;
|
infoview_t fInfo;
|
||||||
|
|||||||
Reference in New Issue
Block a user