From eee4243d35225a35d0964ebebe94490eaca14261 Mon Sep 17 00:00:00 2001 From: Alex Wilson Date: Thu, 20 Oct 2011 19:18:22 -0600 Subject: [PATCH] De-virtualize BView::InvalidateLayout() and introduce LayoutInvalidated() hook, like BLayout. --- headers/os/interface/Box.h | 3 ++- headers/os/interface/Button.h | 4 ++- headers/os/interface/CheckBox.h | 5 ++-- headers/os/interface/StringView.h | 3 ++- headers/os/interface/View.h | 3 ++- headers/private/binary_compatibility/Global.h | 2 +- .../private/binary_compatibility/Interface.h | 2 +- src/kits/interface/Box.cpp | 11 ++++---- src/kits/interface/Button.cpp | 26 +++++++++---------- src/kits/interface/CheckBox.cpp | 26 +++++++++---------- src/kits/interface/ColorControl.cpp | 8 +++--- src/kits/interface/Control.cpp | 8 +++--- src/kits/interface/Dragger.cpp | 8 +++--- src/kits/interface/ListView.cpp | 8 +++--- src/kits/interface/Menu.cpp | 8 +++--- src/kits/interface/MenuBar.cpp | 8 +++--- src/kits/interface/MenuField.cpp | 8 +++--- src/kits/interface/OutlineListView.cpp | 8 +++--- src/kits/interface/PictureButton.cpp | 8 +++--- src/kits/interface/PopUpMenu.cpp | 8 +++--- src/kits/interface/RadioButton.cpp | 8 +++--- src/kits/interface/ScrollBar.cpp | 8 +++--- src/kits/interface/ScrollView.cpp | 8 +++--- src/kits/interface/Slider.cpp | 8 +++--- src/kits/interface/StatusBar.cpp | 8 +++--- src/kits/interface/StringView.cpp | 26 +++++++++---------- src/kits/interface/TextControl.cpp | 8 +++--- src/kits/interface/TextView.cpp | 8 +++--- src/kits/interface/View.cpp | 22 +++++++++++----- 29 files changed, 138 insertions(+), 131 deletions(-) diff --git a/headers/os/interface/Box.h b/headers/os/interface/Box.h index 24bf907e05..d3e4009431 100644 --- a/headers/os/interface/Box.h +++ b/headers/os/interface/Box.h @@ -71,7 +71,8 @@ class BBox : public BView { virtual BSize MaxSize(); virtual BSize PreferredSize(); - virtual void InvalidateLayout(bool descendants = false); + protected: + virtual void LayoutInvalidated(bool descendants = false); virtual void DoLayout(); private: diff --git a/headers/os/interface/Button.h b/headers/os/interface/Button.h index b666e45cc4..240b9284bd 100644 --- a/headers/os/interface/Button.h +++ b/headers/os/interface/Button.h @@ -63,13 +63,15 @@ public: virtual status_t GetSupportedSuites(BMessage* message); virtual status_t Perform(perform_code d, void* arg); - virtual void InvalidateLayout(bool descendants = false); virtual BSize MinSize(); virtual BSize MaxSize(); virtual BSize PreferredSize(); +protected: + virtual void LayoutInvalidated(bool descendants = false); + private: virtual void _ReservedButton1(); virtual void _ReservedButton2(); diff --git a/headers/os/interface/CheckBox.h b/headers/os/interface/CheckBox.h index 54fb4f899c..b8d2c58ecc 100644 --- a/headers/os/interface/CheckBox.h +++ b/headers/os/interface/CheckBox.h @@ -52,8 +52,6 @@ public: float* _height); virtual void ResizeToPreferred(); - virtual void InvalidateLayout(bool descendants = false); - virtual BSize MinSize(); virtual BSize MaxSize(); virtual BSize PreferredSize(); @@ -70,6 +68,9 @@ public: virtual status_t Perform(perform_code code, void* data); +protected: + virtual void LayoutInvalidated(bool descendants = false); + private: // FBC padding virtual void _ReservedCheckBox1(); diff --git a/headers/os/interface/StringView.h b/headers/os/interface/StringView.h index 40b0e09c0b..212a215059 100644 --- a/headers/os/interface/StringView.h +++ b/headers/os/interface/StringView.h @@ -41,7 +41,6 @@ public: virtual BSize MinSize(); virtual BSize MaxSize(); virtual BSize PreferredSize(); - virtual void InvalidateLayout(bool descendants = false); virtual void ResizeToPreferred(); virtual void FrameMoved(BPoint newPosition); virtual void FrameResized(float newWidth, float newHeight); @@ -62,6 +61,8 @@ public: virtual void SetFont(const BFont* font, uint32 mask = B_FONT_ALL); +protected: + virtual void LayoutInvalidated(bool descendants = false); private: // FBC padding and forbidden methods diff --git a/headers/os/interface/View.h b/headers/os/interface/View.h index 8e6f90bfa1..46b922d174 100644 --- a/headers/os/interface/View.h +++ b/headers/os/interface/View.h @@ -548,10 +548,10 @@ public: virtual void GetHeightForWidth(float width, float* min, float* max, float* preferred); + void InvalidateLayout(bool descendants = false); virtual void SetLayout(BLayout* layout); BLayout* GetLayout() const; - virtual void InvalidateLayout(bool descendants = false); void EnableLayoutInvalidation(); void DisableLayoutInvalidation(); bool IsLayoutValid() const; @@ -565,6 +565,7 @@ public: class Private; protected: + virtual void LayoutInvalidated(bool descendants = false); virtual void DoLayout(); public: diff --git a/headers/private/binary_compatibility/Global.h b/headers/private/binary_compatibility/Global.h index f8811573fa..f0e5bdd2fe 100644 --- a/headers/private/binary_compatibility/Global.h +++ b/headers/private/binary_compatibility/Global.h @@ -19,7 +19,7 @@ enum { PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH = 1004, PERFORM_CODE_GET_HEIGHT_FOR_WIDTH = 1005, PERFORM_CODE_SET_LAYOUT = 1006, - PERFORM_CODE_INVALIDATE_LAYOUT = 1007, + PERFORM_CODE_LAYOUT_INVALIDATED = 1007, PERFORM_CODE_DO_LAYOUT = 1008, PERFORM_CODE_GET_TOOL_TIP_AT = 1009, diff --git a/headers/private/binary_compatibility/Interface.h b/headers/private/binary_compatibility/Interface.h index 0f5201a09b..5653583549 100644 --- a/headers/private/binary_compatibility/Interface.h +++ b/headers/private/binary_compatibility/Interface.h @@ -41,7 +41,7 @@ struct perform_data_set_layout { BLayout* layout; }; -struct perform_data_invalidate_layout { +struct perform_data_layout_invalidated { bool descendants; }; diff --git a/src/kits/interface/Box.cpp b/src/kits/interface/Box.cpp index d47e6f8dd0..a6a463a427 100644 --- a/src/kits/interface/Box.cpp +++ b/src/kits/interface/Box.cpp @@ -487,11 +487,11 @@ BBox::Perform(perform_code code, void* _data) BBox::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BBox::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BBox::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: @@ -537,10 +537,9 @@ BBox::PreferredSize() void -BBox::InvalidateLayout(bool descendants) +BBox::LayoutInvalidated(bool descendants) { fLayoutData->valid = false; - BView::InvalidateLayout(descendants); } diff --git a/src/kits/interface/Button.cpp b/src/kits/interface/Button.cpp index 989ba502f5..42552f2d50 100644 --- a/src/kits/interface/Button.cpp +++ b/src/kits/interface/Button.cpp @@ -650,11 +650,11 @@ BButton::Perform(perform_code code, void* _data) BButton::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BButton::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BButton::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: @@ -668,16 +668,6 @@ BButton::Perform(perform_code code, void* _data) } -void -BButton::InvalidateLayout(bool descendants) -{ - // invalidate cached preferred size - fPreferredSize.Set(-1, -1); - - BControl::InvalidateLayout(descendants); -} - - BSize BButton::MinSize() { @@ -702,6 +692,14 @@ BButton::PreferredSize() } +void +BButton::LayoutInvalidated(bool descendants) +{ + // invalidate cached preferred size + fPreferredSize.Set(-1, -1); +} + + void BButton::_ReservedButton1() {} void BButton::_ReservedButton2() {} void BButton::_ReservedButton3() {} diff --git a/src/kits/interface/CheckBox.cpp b/src/kits/interface/CheckBox.cpp index 4bf81fd5ec..e67be98832 100644 --- a/src/kits/interface/CheckBox.cpp +++ b/src/kits/interface/CheckBox.cpp @@ -440,16 +440,6 @@ BCheckBox::ResizeToPreferred() } -void -BCheckBox::InvalidateLayout(bool descendants) -{ - // invalidate cached preferred size - fPreferredSize.Set(B_SIZE_UNSET, B_SIZE_UNSET); - - BControl::InvalidateLayout(descendants); -} - - BSize BCheckBox::MinSize() { @@ -558,11 +548,11 @@ BCheckBox::Perform(perform_code code, void* _data) BCheckBox::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BCheckBox::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BCheckBox::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: @@ -576,6 +566,14 @@ BCheckBox::Perform(perform_code code, void* _data) } +void +BCheckBox::LayoutInvalidated(bool descendants) +{ + // invalidate cached preferred size + fPreferredSize.Set(B_SIZE_UNSET, B_SIZE_UNSET); +} + + // #pragma mark - FBC padding diff --git a/src/kits/interface/ColorControl.cpp b/src/kits/interface/ColorControl.cpp index 7cee44a86c..00659bddca 100644 --- a/src/kits/interface/ColorControl.cpp +++ b/src/kits/interface/ColorControl.cpp @@ -937,11 +937,11 @@ BColorControl::Perform(perform_code code, void* _data) BColorControl::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BColorControl::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BColorControl::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/Control.cpp b/src/kits/interface/Control.cpp index 5f89d85620..8fd92bd50c 100644 --- a/src/kits/interface/Control.cpp +++ b/src/kits/interface/Control.cpp @@ -497,11 +497,11 @@ BControl::Perform(perform_code code, void* _data) BControl::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BControl::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BControl::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/Dragger.cpp b/src/kits/interface/Dragger.cpp index 5b3644e6e1..ee714e58b8 100644 --- a/src/kits/interface/Dragger.cpp +++ b/src/kits/interface/Dragger.cpp @@ -491,11 +491,11 @@ BDragger::Perform(perform_code code, void* _data) BDragger::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BDragger::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BDragger::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/ListView.cpp b/src/kits/interface/ListView.cpp index 8e0974f10c..508900f746 100644 --- a/src/kits/interface/ListView.cpp +++ b/src/kits/interface/ListView.cpp @@ -1309,11 +1309,11 @@ BListView::Perform(perform_code code, void* _data) BListView::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BListView::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BListView::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index bd658433bd..05e9994b39 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -1236,11 +1236,11 @@ BMenu::Perform(perform_code code, void* _data) BMenu::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BMenu::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BMenu::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/MenuBar.cpp b/src/kits/interface/MenuBar.cpp index 467b3e4a72..dfe13b494a 100644 --- a/src/kits/interface/MenuBar.cpp +++ b/src/kits/interface/MenuBar.cpp @@ -438,11 +438,11 @@ BMenuBar::Perform(perform_code code, void* _data) BMenuBar::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BMenuBar::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BMenuBar::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/MenuField.cpp b/src/kits/interface/MenuField.cpp index 08cb23f086..6edb1d9c30 100644 --- a/src/kits/interface/MenuField.cpp +++ b/src/kits/interface/MenuField.cpp @@ -872,11 +872,11 @@ BMenuField::Perform(perform_code code, void* _data) BMenuField::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BMenuField::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BMenuField::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/OutlineListView.cpp b/src/kits/interface/OutlineListView.cpp index 1605bf88b9..1379a44672 100644 --- a/src/kits/interface/OutlineListView.cpp +++ b/src/kits/interface/OutlineListView.cpp @@ -555,11 +555,11 @@ BOutlineListView::Perform(perform_code code, void* _data) BOutlineListView::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BOutlineListView::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BOutlineListView::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/PictureButton.cpp b/src/kits/interface/PictureButton.cpp index 8a93eddfeb..9c820996e5 100644 --- a/src/kits/interface/PictureButton.cpp +++ b/src/kits/interface/PictureButton.cpp @@ -458,11 +458,11 @@ BPictureButton::Perform(perform_code code, void* _data) BPictureButton::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BPictureButton::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BPictureButton::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/PopUpMenu.cpp b/src/kits/interface/PopUpMenu.cpp index c9e5cf43d5..ea0099e24a 100644 --- a/src/kits/interface/PopUpMenu.cpp +++ b/src/kits/interface/PopUpMenu.cpp @@ -211,11 +211,11 @@ BPopUpMenu::Perform(perform_code code, void* _data) BPopUpMenu::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BPopUpMenu::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BPopUpMenu::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/RadioButton.cpp b/src/kits/interface/RadioButton.cpp index 243f847638..191d28e6f5 100644 --- a/src/kits/interface/RadioButton.cpp +++ b/src/kits/interface/RadioButton.cpp @@ -541,11 +541,11 @@ BRadioButton::Perform(perform_code code, void* _data) BRadioButton::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BRadioButton::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BRadioButton::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/ScrollBar.cpp b/src/kits/interface/ScrollBar.cpp index 0575c096ed..bf8fa2dc75 100644 --- a/src/kits/interface/ScrollBar.cpp +++ b/src/kits/interface/ScrollBar.cpp @@ -1282,11 +1282,11 @@ BScrollBar::Perform(perform_code code, void* _data) BScrollBar::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BScrollBar::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BScrollBar::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/ScrollView.cpp b/src/kits/interface/ScrollView.cpp index 6fb406a16a..878de81cc5 100644 --- a/src/kits/interface/ScrollView.cpp +++ b/src/kits/interface/ScrollView.cpp @@ -650,11 +650,11 @@ BScrollView::Perform(perform_code code, void* _data) BScrollView::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BScrollView::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BScrollView::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/Slider.cpp b/src/kits/interface/Slider.cpp index b4f6730085..94b99edf79 100644 --- a/src/kits/interface/Slider.cpp +++ b/src/kits/interface/Slider.cpp @@ -333,11 +333,11 @@ BSlider::Perform(perform_code code, void* _data) BSlider::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BSlider::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BSlider::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/StatusBar.cpp b/src/kits/interface/StatusBar.cpp index b11b531a71..9faa8a473d 100644 --- a/src/kits/interface/StatusBar.cpp +++ b/src/kits/interface/StatusBar.cpp @@ -701,11 +701,11 @@ BStatusBar::Perform(perform_code code, void* _data) BStatusBar::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BStatusBar::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BStatusBar::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/StringView.cpp b/src/kits/interface/StringView.cpp index 287b611278..75863caa25 100644 --- a/src/kits/interface/StringView.cpp +++ b/src/kits/interface/StringView.cpp @@ -185,16 +185,6 @@ BStringView::PreferredSize() } -void -BStringView::InvalidateLayout(bool descendants) -{ - // invalidate cached preferred size - fPreferredSize.Set(-1, -1); - - BView::InvalidateLayout(descendants); -} - - void BStringView::ResizeToPreferred() { @@ -359,6 +349,14 @@ BStringView::SetFont(const BFont* font, uint32 mask) } +void +BStringView::LayoutInvalidated(bool descendants) +{ + // invalidate cached preferred size + fPreferredSize.Set(-1, -1); +} + + // #pragma mark - @@ -400,11 +398,11 @@ BStringView::Perform(perform_code code, void* _data) BStringView::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BStringView::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BStringView::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/TextControl.cpp b/src/kits/interface/TextControl.cpp index 80f67c3f04..9258f6e0bf 100644 --- a/src/kits/interface/TextControl.cpp +++ b/src/kits/interface/TextControl.cpp @@ -965,11 +965,11 @@ BTextControl::Perform(perform_code code, void* _data) BTextControl::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BTextControl::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BTextControl::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/TextView.cpp b/src/kits/interface/TextView.cpp index b50d1e47a0..6a9eb8df76 100644 --- a/src/kits/interface/TextView.cpp +++ b/src/kits/interface/TextView.cpp @@ -1122,11 +1122,11 @@ BTextView::Perform(perform_code code, void* _data) BTextView::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BTextView::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BTextView::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: diff --git a/src/kits/interface/View.cpp b/src/kits/interface/View.cpp index 317ee81e53..fdd305cc66 100644 --- a/src/kits/interface/View.cpp +++ b/src/kits/interface/View.cpp @@ -4481,11 +4481,11 @@ BView::Perform(perform_code code, void* _data) BView::SetLayout(data->layout); return B_OK; } - case PERFORM_CODE_INVALIDATE_LAYOUT: + case PERFORM_CODE_LAYOUT_INVALIDATED: { - perform_data_invalidate_layout* data - = (perform_data_invalidate_layout*)_data; - BView::InvalidateLayout(data->descendants); + perform_data_layout_invalidated* data + = (perform_data_layout_invalidated*)_data; + BView::LayoutInvalidated(data->descendants); return B_OK; } case PERFORM_CODE_DO_LAYOUT: @@ -4697,6 +4697,7 @@ BView::InvalidateLayout(bool descendants) fLayoutData->fLayoutValid = false; fLayoutData->fMinMaxValid = false; + LayoutInvalidated(descendants); if (descendants) { for (BView* child = fFirstChild; @@ -4790,6 +4791,13 @@ BView::Relayout() } +void +BView::LayoutInvalidated(bool descendants) +{ + // hook method +} + + void BView::DoLayout() { @@ -5772,10 +5780,10 @@ _ReservedView8__5BView(BView* view, BLayout* layout) extern "C" void _ReservedView9__5BView(BView* view, bool descendants) { - // InvalidateLayout() - perform_data_invalidate_layout data; + // LayoutInvalidated() + perform_data_layout_invalidated data; data.descendants = descendants; - view->Perform(PERFORM_CODE_INVALIDATE_LAYOUT, &data); + view->Perform(PERFORM_CODE_LAYOUT_INVALIDATED, &data); }