Replace remaining InvalidateLayout()'s with LayoutInvalidated(). Also do a bit of cleanup/move methods around.

This commit is contained in:
Alex Wilson 2011-10-22 15:01:47 -06:00
parent 17499672a0
commit 61eb1f1d19
14 changed files with 83 additions and 100 deletions

View File

@ -77,8 +77,6 @@ public:
virtual void DoLayout();
virtual void FrameMoved(BPoint newPosition);
virtual void FrameResized(float newWidth, float newHeight);
void InvalidateLayout();
virtual void InvalidateLayout(bool descendants);
virtual void MakeFocus(bool focus = true);
@ -139,6 +137,8 @@ protected:
uint32 resizeMask, uint32 flags,
menu_layout layout, bool resizeToFit);
virtual void LayoutInvalidated(bool descendants);
virtual BPoint ScreenLocation();
void SetItemMargins(float left, float top,

View File

@ -83,14 +83,13 @@ public:
virtual BSize MaxSize();
virtual BSize PreferredSize();
virtual void InvalidateLayout(bool descendants = false);
BLayoutItem* CreateLabelLayoutItem();
BLayoutItem* CreateMenuBarLayoutItem();
virtual status_t Perform(perform_code d, void* arg);
protected:
virtual void LayoutInvalidated(bool descendants);
virtual void DoLayout();
private:

View File

@ -48,8 +48,6 @@ public:
virtual BSize PreferredSize();
virtual void ResizeToPreferred();
virtual void InvalidateLayout(bool descendants = false);
virtual void DoLayout();
virtual void FrameMoved(BPoint position);
virtual void FrameResized(float width, float height);
@ -80,6 +78,10 @@ public:
virtual status_t Perform(perform_code d, void* arg);
protected:
virtual void LayoutInvalidated(bool descendants = false);
virtual void DoLayout();
private:
// FBC padding and forbidden methods
virtual void _ReservedScrollView1();

View File

@ -156,12 +156,13 @@ public:
virtual float MaxUpdateTextWidth();
virtual void InvalidateLayout(bool descendants = false);
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
protected:
virtual void LayoutInvalidated(bool descendants);
private:
void _DrawBlockThumb();
void _DrawTriangleThumb();

View File

@ -88,12 +88,11 @@ public:
virtual BSize MaxSize();
virtual BSize PreferredSize();
virtual void InvalidateLayout(bool descendants = false);
BLayoutItem* CreateLabelLayoutItem();
BLayoutItem* CreateTextViewLayoutItem();
protected:
virtual void LayoutInvalidated(bool descendants);
virtual void DoLayout();
private:

View File

@ -220,9 +220,8 @@ public:
virtual void GetHeightForWidth(float width, float* min,
float* max, float* preferred);
virtual void InvalidateLayout(bool descendants = false);
protected:
virtual void LayoutInvalidated(bool descendants);
virtual void DoLayout();
public:

View File

@ -373,7 +373,6 @@ public:
virtual BSize PreferredSize();
virtual BSize MaxSize();
virtual void InvalidateLayout(bool descendants = false);
protected:
virtual void MessageReceived(BMessage* message);
@ -382,6 +381,7 @@ protected:
virtual void WindowActivated(bool active);
virtual void Draw(BRect updateRect);
virtual void LayoutInvalidated(bool descendants = false);
virtual void DoLayout();
private:

View File

@ -1886,9 +1886,8 @@ BColumnListView::MaxSize()
void
BColumnListView::InvalidateLayout(bool descendants)
BColumnListView::LayoutInvalidated(bool descendants)
{
BView::InvalidateLayout(descendants);
}

View File

@ -667,23 +667,6 @@ BMenu::FrameResized(float new_width, float new_height)
}
void
BMenu::InvalidateLayout()
{
InvalidateLayout(false);
}
void
BMenu::InvalidateLayout(bool descendants)
{
fUseCachedMenuLayout = false;
fLayoutData->preferred.Set(B_SIZE_UNSET, B_SIZE_UNSET);
BView::InvalidateLayout(descendants);
}
// #pragma mark -
@ -2271,6 +2254,14 @@ BMenu::_ComputeMatrixLayout(BRect &frame)
}
void
BMenu::LayoutInvalidated(bool descendants)
{
fUseCachedMenuLayout = false;
fLayoutData->preferred.Set(B_SIZE_UNSET, B_SIZE_UNSET);
}
// Assumes the SuperMenu to be locked (due to calling ConvertToScreen())
BPoint
BMenu::ScreenLocation()

View File

@ -801,17 +801,6 @@ BMenuField::PreferredSize()
}
void
BMenuField::InvalidateLayout(bool descendants)
{
CALLED();
fLayoutData->valid = false;
BView::InvalidateLayout(descendants);
}
BLayoutItem*
BMenuField::CreateLabelLayoutItem()
{
@ -906,6 +895,15 @@ BMenuField::Perform(perform_code code, void* _data)
}
void
BMenuField::LayoutInvalidated(bool descendants)
{
CALLED();
fLayoutData->valid = false;
}
void
BMenuField::DoLayout()
{

View File

@ -300,39 +300,6 @@ BScrollView::ResizeToPreferred()
}
void
BScrollView::InvalidateLayout(bool descendants)
{
BView::InvalidateLayout(descendants);
}
void
BScrollView::DoLayout()
{
if (!(Flags() & B_SUPPORTS_LAYOUT))
return;
// If the user set a layout, we let the base class version call its hook.
if (GetLayout()) {
BView::DoLayout();
return;
}
BRect innerFrame = _InnerFrame();
if (fTarget != NULL) {
fTarget->MoveTo(innerFrame.left, innerFrame.top);
fTarget->ResizeTo(innerFrame.Width(), innerFrame.Height());
//BLayoutUtils::AlignInFrame(fTarget, fTarget->Bounds());
}
_AlignScrollBars(fHorizontalScrollBar != NULL, fVerticalScrollBar != NULL,
innerFrame);
}
void
BScrollView::FrameMoved(BPoint position)
{
@ -668,6 +635,40 @@ BScrollView::Perform(perform_code code, void* _data)
}
void
BScrollView::LayoutInvalidated(bool descendants)
{
}
void
BScrollView::DoLayout()
{
if (!(Flags() & B_SUPPORTS_LAYOUT))
return;
// If the user set a layout, we let the base class version call its hook.
if (GetLayout()) {
BView::DoLayout();
return;
}
BRect innerFrame = _InnerFrame();
if (fTarget != NULL) {
fTarget->MoveTo(innerFrame.left, innerFrame.top);
fTarget->ResizeTo(innerFrame.Width(), innerFrame.Height());
//BLayoutUtils::AlignInFrame(fTarget, fTarget->Bounds());
}
_AlignScrollBars(fHorizontalScrollBar != NULL, fVerticalScrollBar != NULL,
innerFrame);
}
// #pragma mark -

View File

@ -1736,16 +1736,6 @@ BSlider::MaxUpdateTextWidth()
// #pragma mark - layout related
void
BSlider::InvalidateLayout(bool descendants)
{
// invalidate cached preferred size
fMinSize.Set(-1, -1);
BControl::InvalidateLayout(descendants);
}
BSize
BSlider::MinSize()
{
@ -1778,6 +1768,14 @@ BSlider::PreferredSize()
}
void
BSlider::LayoutInvalidated(bool descendants)
{
// invalidate cached preferred size
fMinSize.Set(-1, -1);
}
// #pragma mark - private
void

View File

@ -841,17 +841,6 @@ BTextControl::PreferredSize()
}
void
BTextControl::InvalidateLayout(bool descendants)
{
CALLED();
fLayoutData->valid = false;
BView::InvalidateLayout(descendants);
}
BLayoutItem*
BTextControl::CreateLabelLayoutItem()
{
@ -870,6 +859,15 @@ BTextControl::CreateTextViewLayoutItem()
}
void
BTextControl::LayoutInvalidated(bool descendants)
{
CALLED();
fLayoutData->valid = false;
}
void
BTextControl::DoLayout()
{

View File

@ -2782,13 +2782,11 @@ BTextView::GetHeightForWidth(float width, float* min, float* max,
void
BTextView::InvalidateLayout(bool descendants)
BTextView::LayoutInvalidated(bool descendants)
{
CALLED();
fLayoutData->valid = false;
BView::InvalidateLayout(descendants);
}