BLayoutItem: Add RemoveSelf() convenience method.

It works analoguous to BView::RemoveSelf(), i.e. it removes itself from
the parent (layout in this case) and returns whether or not it had and
was successfully removed from said parent.
This commit is contained in:
Michael Lotz 2015-04-14 23:28:45 +02:00
parent 19bb9ef937
commit 0cc8c71bba
2 changed files with 8 additions and 0 deletions

View File

@ -23,6 +23,7 @@ public:
virtual ~BLayoutItem(); virtual ~BLayoutItem();
BLayout* Layout() const; BLayout* Layout() const;
bool RemoveSelf();
virtual BSize MinSize() = 0; virtual BSize MinSize() = 0;
virtual BSize MaxSize() = 0; virtual BSize MaxSize() = 0;

View File

@ -47,6 +47,13 @@ BLayoutItem::Layout() const
} }
bool
BLayoutItem::RemoveSelf()
{
return Layout() != NULL && Layout()->RemoveItem(this);
}
void void
BLayoutItem::SetExplicitSize(BSize size) BLayoutItem::SetExplicitSize(BSize size)
{ {