diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-06-18 13:21:15 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-09-28 08:48:32 +0100 |
commit | a27550dc9a7622e105aa87bb3ffff2036cfd52b9 (patch) | |
tree | 296b633f7769c4f98e70a2fbfa35f2f4c744cc23 /vcl | |
parent | f2793fd788280b7da2a9064d83c465931baaa13a (diff) |
make isLayoutEnabled stricter
dialog/tabpage must have only one child that is a container
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/dialog.cxx | 15 | ||||
-rw-r--r-- | vcl/source/window/layout.cxx | 6 | ||||
-rw-r--r-- | vcl/source/window/tabpage.cxx | 2 |
3 files changed, 8 insertions, 15 deletions
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 497b4c47f9f7..76b3dd2fc885 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -679,9 +679,6 @@ void Dialog::StateChanged( StateChangedType nType ) SetMinOutputSizePixel(aSize); SetSizePixel(aSize); setPosSizeOnContainee(aSize, *pBox); - - fprintf(stderr, "101 dialog sized to %d %d\n", aSize.Width(), - aSize.Height()); } if ( GetSettings().GetStyleSettings().GetAutoMnemonic() ) @@ -1166,9 +1163,9 @@ void Dialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal bool Dialog::isLayoutEnabled() const { - //Child is a container => we're layout enabled + //Single child is a container => we're layout enabled const Window *pChild = GetWindow(WINDOW_FIRSTCHILD); - return pChild && pChild->GetType() == WINDOW_CONTAINER; + return pChild && pChild->GetType() == WINDOW_CONTAINER && !pChild->GetWindow(WINDOW_NEXT); } Size Dialog::GetOptimalSize(WindowSizeType eType) const @@ -1203,12 +1200,14 @@ IMPL_LINK( Dialog, ImplHandleLayoutTimerHdl, void*, EMPTYARG ) { fprintf(stderr, "ImplHandleLayoutTimerHdl\n"); - VclBox *pBox = static_cast<VclBox*>(GetWindow(WINDOW_FIRSTCHILD)); - if (!pBox) + if (!isLayoutEnabled()) { - fprintf(stderr, "WTF!\n"); + fprintf(stderr, "Dialog has become non-layout because extra children have been added directly to it!\n"); return 0; } + + VclBox *pBox = static_cast<VclBox*>(GetWindow(WINDOW_FIRSTCHILD)); + assert(pBox); setPosSizeOnContainee(GetSizePixel(), *pBox); return 0; } diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 418b05686cc3..d3a8ab4757c7 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -49,8 +49,6 @@ Size VclContainer::GetOptimalSize(WindowSizeType eType) const void VclContainer::SetPosSizePixel(const Point& rAllocPos, const Size& rAllocation) { - fprintf(stderr, "VclContainer::SetPosSizePixel\n"); - Size aAllocation = rAllocation; aAllocation.Width() -= m_nBorderWidth*2; aAllocation.Height() -= m_nBorderWidth*2; @@ -69,10 +67,7 @@ void VclContainer::SetPosSizePixel(const Point& rAllocPos, const Size& rAllocati Window::SetSizePixel(aAllocation); if (bSizeChanged) - { - fprintf(stderr, "VclContainer::setAllocation\n"); setAllocation(aAllocation); - } } void VclContainer::SetPosPixel(const Point& rAllocPos) @@ -94,7 +89,6 @@ void VclContainer::SetSizePixel(const Size& rAllocation) if (aAllocation != GetSizePixel()) { Window::SetSizePixel(aAllocation); - fprintf(stderr, "VclContainer::setAllocation\n"); setAllocation(aAllocation); } } diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx index c552ee4b4465..a778c7f7cf5c 100644 --- a/vcl/source/window/tabpage.cxx +++ b/vcl/source/window/tabpage.cxx @@ -213,7 +213,7 @@ bool TabPage::isLayoutEnabled() const { //Child is a container => we're layout enabled const Window *pChild = GetWindow(WINDOW_FIRSTCHILD); - return pChild && pChild->GetType() == WINDOW_CONTAINER; + return pChild && pChild->GetType() == WINDOW_CONTAINER && !pChild->GetWindow(WINDOW_NEXT); } Size TabPage::GetOptimalSize(WindowSizeType eType) const |