Add BLayoutItem::LayoutInvalidated() hook. Leave BLayoutItem::InvalidateLayout() (and therefore BLayout::InvalidateLayout()) virtual. This is needed to let BLayout override it for invalidation propagations.

This commit is contained in:
Alex Wilson 2011-10-22 16:41:44 -06:00
parent 61eb1f1d19
commit c74faed432
5 changed files with 19 additions and 10 deletions

View File

@ -48,7 +48,7 @@ public:
// Layouting related methods
void InvalidateLayout(bool children = false);
virtual void InvalidateLayout(bool children = false);
void Relayout(bool immediate = false);
void RequireLayout();
bool IsValid();

View File

@ -59,10 +59,11 @@ public:
virtual status_t AllUnarchived(const BMessage* from);
protected:
void SetLayout(BLayout* layout);
// hook methods
virtual void LayoutInvalidated(bool children);
virtual void AttachedToLayout();
virtual void DetachedFromLayout(BLayout* layout);

View File

@ -72,6 +72,7 @@ BLayoutItem::View()
void
BLayoutItem::InvalidateLayout(bool children)
{
LayoutInvalidated(children);
if (fLayout)
fLayout->InvalidateLayout(children);
}
@ -183,6 +184,13 @@ BLayoutItem::SetLayout(BLayout* layout)
}
void
BLayoutItem::LayoutInvalidated(bool children)
{
// hook method
}
void
BLayoutItem::AttachedToLayout()
{

View File

@ -157,13 +157,6 @@ BViewLayoutItem::View()
}
void
BViewLayoutItem::InvalidateLayout(bool children)
{
fView->InvalidateLayout(children);
}
void
BViewLayoutItem::Relayout(bool immediate)
{
@ -220,6 +213,13 @@ BViewLayoutItem::Instantiate(BMessage* from)
}
void
BViewLayoutItem::LayoutInvalidated(bool children)
{
fView->InvalidateLayout(children);
}
void
BViewLayoutItem::AncestorVisibilityChanged(bool shown)
{

View File

@ -36,7 +36,6 @@ public:
virtual BView* View();
virtual void InvalidateLayout(bool children = false);
virtual void Relayout(bool immediate = false);
virtual status_t Archive(BMessage* into, bool deep = true) const;
@ -45,6 +44,7 @@ public:
static BArchivable* Instantiate(BMessage* from);
protected:
virtual void LayoutInvalidated(bool children);
virtual void AncestorVisibilityChanged(bool shown);
private: