diff --git a/headers/os/interface/CardLayout.h b/headers/os/interface/CardLayout.h index 1f79a63662..16da764e19 100644 --- a/headers/os/interface/CardLayout.h +++ b/headers/os/interface/CardLayout.h @@ -28,13 +28,12 @@ public: virtual void GetHeightForWidth(float width, float* min, float* max, float* preferred); - virtual void InvalidateLayout(bool children = false); - virtual status_t Archive(BMessage* into, bool deep = true) const; virtual status_t AllUnarchived(const BMessage* from); static BArchivable* Instantiate(BMessage* from); protected: + virtual void LayoutInvalidated(bool children = false); virtual void DoLayout(); virtual bool ItemAdded(BLayoutItem* item, int32 atIndex); virtual void ItemRemoved(BLayoutItem* item, int32 fromIndex); diff --git a/headers/os/interface/Layout.h b/headers/os/interface/Layout.h index 991635e53c..b63aba73cf 100644 --- a/headers/os/interface/Layout.h +++ b/headers/os/interface/Layout.h @@ -48,7 +48,7 @@ public: // Layouting related methods - virtual void InvalidateLayout(bool children = false); + void InvalidateLayout(bool children = false); void Relayout(bool immediate = false); void RequireLayout(); bool IsValid(); @@ -73,6 +73,7 @@ protected: // BLayout hook methods virtual bool ItemAdded(BLayoutItem* item, int32 atIndex); virtual void ItemRemoved(BLayoutItem* item, int32 fromIndex); + virtual void LayoutInvalidated(bool children); virtual void DoLayout() = 0; virtual void OwnerChanged(BView* was); diff --git a/headers/os/interface/TwoDimensionalLayout.h b/headers/os/interface/TwoDimensionalLayout.h index 2dae1d1436..6d36fce456 100644 --- a/headers/os/interface/TwoDimensionalLayout.h +++ b/headers/os/interface/TwoDimensionalLayout.h @@ -38,8 +38,6 @@ public: virtual void SetFrame(BRect frame); - virtual void InvalidateLayout(bool children = false); - virtual status_t Archive(BMessage* into, bool deep = true) const; virtual status_t AllArchived(BMessage* into) const; virtual status_t AllUnarchived(const BMessage* from); @@ -58,6 +56,7 @@ protected: int32 height; }; + virtual void LayoutInvalidated(bool children = false); virtual void DoLayout(); BSize AddInsets(BSize size); diff --git a/src/kits/interface/CardLayout.cpp b/src/kits/interface/CardLayout.cpp index bcf4ebca05..106085d1c5 100644 --- a/src/kits/interface/CardLayout.cpp +++ b/src/kits/interface/CardLayout.cpp @@ -174,10 +174,8 @@ BCardLayout::GetHeightForWidth(float width, float* min, float* max, void -BCardLayout::InvalidateLayout(bool children) +BCardLayout::LayoutInvalidated(bool children) { - BLayout::InvalidateLayout(children); - fMinMaxValid = false; } diff --git a/src/kits/interface/Layout.cpp b/src/kits/interface/Layout.cpp index a763ded243..2ccc3020aa 100644 --- a/src/kits/interface/Layout.cpp +++ b/src/kits/interface/Layout.cpp @@ -303,6 +303,7 @@ BLayout::InvalidateLayout(bool children) return; fState |= B_LAYOUT_NECESSARY; + LayoutInvalidated(children); if (children) { for (int32 i = CountItems() - 1; i >= 0; i--) @@ -522,6 +523,12 @@ BLayout::ItemRemoved(BLayoutItem* item, int32 fromIndex) } +void +BLayout::LayoutInvalidated(bool children) +{ +} + + void BLayout::OwnerChanged(BView* was) { diff --git a/src/kits/interface/SplitLayout.cpp b/src/kits/interface/SplitLayout.cpp index 3b61c3c26d..514689e6a4 100644 --- a/src/kits/interface/SplitLayout.cpp +++ b/src/kits/interface/SplitLayout.cpp @@ -546,9 +546,21 @@ BSplitLayout::GetHeightForWidth(float width, float* min, float* max, void -BSplitLayout::InvalidateLayout(bool children) +BSplitLayout::LayoutInvalidated(bool children) { - _InvalidateLayout(true, children); + delete fHorizontalLayouter; + delete fVerticalLayouter; + delete fHorizontalLayoutInfo; + delete fVerticalLayoutInfo; + + fHorizontalLayouter = NULL; + fVerticalLayouter = NULL; + fHorizontalLayoutInfo = NULL; + fVerticalLayoutInfo = NULL; + + _InvalidateCachedHeightForWidth(); + + fLayoutValid = false; } @@ -820,28 +832,6 @@ BSplitLayout::ItemRemoved(BLayoutItem* item, int32 atIndex) } -void -BSplitLayout::_InvalidateLayout(bool invalidateView, bool children) -{ - if (invalidateView) - BAbstractLayout::InvalidateLayout(children); - - delete fHorizontalLayouter; - delete fVerticalLayouter; - delete fHorizontalLayoutInfo; - delete fVerticalLayoutInfo; - - fHorizontalLayouter = NULL; - fVerticalLayouter = NULL; - fHorizontalLayoutInfo = NULL; - fVerticalLayoutInfo = NULL; - - _InvalidateCachedHeightForWidth(); - - fLayoutValid = false; -} - - void BSplitLayout::_InvalidateCachedHeightForWidth() { diff --git a/src/kits/interface/SplitLayout.h b/src/kits/interface/SplitLayout.h index 1337d4a70b..48b619d870 100644 --- a/src/kits/interface/SplitLayout.h +++ b/src/kits/interface/SplitLayout.h @@ -75,8 +75,7 @@ public: virtual void GetHeightForWidth(float width, float* min, float* max, float* preferred); - virtual void InvalidateLayout(bool children = false); - + virtual void LayoutInvalidated(bool children); virtual void DoLayout(); // interface for BSplitView diff --git a/src/kits/interface/TwoDimensionalLayout.cpp b/src/kits/interface/TwoDimensionalLayout.cpp index 2fa6eb103d..168e9778e8 100644 --- a/src/kits/interface/TwoDimensionalLayout.cpp +++ b/src/kits/interface/TwoDimensionalLayout.cpp @@ -407,14 +407,6 @@ BTwoDimensionalLayout::SetFrame(BRect frame) } -void -BTwoDimensionalLayout::InvalidateLayout(bool children) -{ - BLayout::InvalidateLayout(children); - fLocalLayouter->InvalidateLayout(); -} - - status_t BTwoDimensionalLayout::Archive(BMessage* into, bool deep) const { @@ -464,6 +456,13 @@ BTwoDimensionalLayout::AllUnarchived(const BMessage* from) } +void +BTwoDimensionalLayout::LayoutInvalidated(bool children) +{ + fLocalLayouter->InvalidateLayout(); +} + + void BTwoDimensionalLayout::DoLayout() {