summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-06-18 13:21:15 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-09-28 08:48:32 +0100
commita27550dc9a7622e105aa87bb3ffff2036cfd52b9 (patch)
tree296b633f7769c4f98e70a2fbfa35f2f4c744cc23 /vcl
parentf2793fd788280b7da2a9064d83c465931baaa13a (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.cxx15
-rw-r--r--vcl/source/window/layout.cxx6
-rw-r--r--vcl/source/window/tabpage.cxx2
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