diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-03-07 14:05:33 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-03-07 14:06:17 +0000 |
commit | 5ecb308bd3e8381d86f57206c0eed5f32d459956 (patch) | |
tree | ad0de6bd4115ef111c24fdd5d6df51cb5f930fc0 /vcl | |
parent | 69b76536a033cefed8e024557742a9988b949d62 (diff) |
rename setInitialLayoutSize to setOptimalLayoutSize
and add a mechanism to know that we're in true
initial layout mode
Change-Id: I4ff61160ae67a7ccf1cb8b25c41870c195d32b94
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/vcl/dialog.hxx | 4 | ||||
-rw-r--r-- | vcl/inc/vcl/layout.hxx | 4 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 9 | ||||
-rw-r--r-- | vcl/source/window/layout.cxx | 8 |
4 files changed, 21 insertions, 4 deletions
diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx index 7fc2a4d75ae7..1f14ae144948 100644 --- a/vcl/inc/vcl/dialog.hxx +++ b/vcl/inc/vcl/dialog.hxx @@ -52,6 +52,7 @@ private: sal_Bool mbInClose; sal_Bool mbModalMode; bool mbIsDefferedInit; + bool mbIsCalculatingInitialLayoutSize; Timer maLayoutTimer; SAL_DLLPRIVATE void ImplInitDialogData(); @@ -94,7 +95,8 @@ public: virtual Size GetOptimalSize() const; virtual void Resize(); bool isLayoutEnabled() const; - void setInitialLayoutSize(); + void setOptimalLayoutSize(); + bool isCalculatingInitialLayoutSize() const { return mbIsCalculatingInitialLayoutSize; } virtual void queue_layout(); virtual bool set_property(const rtl::OString &rKey, const rtl::OString &rValue); VclButtonBox* get_action_area(); diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx index 63277252d672..cd06ae6476f7 100644 --- a/vcl/inc/vcl/layout.hxx +++ b/vcl/inc/vcl/layout.hxx @@ -670,6 +670,10 @@ VCL_DLLPUBLIC inline bool isContainerWindow(const Window *pWindow) return pWindow && isContainerWindow(*pWindow); } +//Returns true if the containing dialog is doing its initial +//layout and isn't visible yet +VCL_DLLPUBLIC bool isInitialLayout(const Window *pWindow); + // retro-fitting utilities // //Get a Size which is large enough to contain all children with diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 467de4b4f04b..a756b27e99fa 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -354,6 +354,7 @@ void Dialog::ImplInitDialogData() mbOldSaveBack = sal_False; mbInClose = sal_False; mbModalMode = sal_False; + mbIsCalculatingInitialLayoutSize = false; mnMousePositioned = 0; mpDialogImpl = new DialogImpl; @@ -655,7 +656,7 @@ Size bestmaxFrameSizeForScreenSize(const Size &rScreenSize) return Size(w, h); } -void Dialog::setInitialLayoutSize() +void Dialog::setOptimalLayoutSize() { maLayoutTimer.Stop(); @@ -696,7 +697,11 @@ void Dialog::StateChanged( StateChangedType nType ) if ( nType == STATE_CHANGE_INITSHOW ) { if (isLayoutEnabled()) - setInitialLayoutSize(); + { + mbIsCalculatingInitialLayoutSize = true; + setOptimalLayoutSize(); + mbIsCalculatingInitialLayoutSize = false; + } if ( GetSettings().GetStyleSettings().GetAutoMnemonic() ) ImplWindowAutoMnemonic( this ); diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index c488e206c97c..4d986407d7a0 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1368,7 +1368,7 @@ IMPL_LINK( VclExpander, ClickHdl, DisclosureButton*, pBtn ) queue_resize(); Dialog* pResizeDialog = m_bResizeTopLevel ? GetParentDialog() : NULL; if (pResizeDialog) - pResizeDialog->setInitialLayoutSize(); + pResizeDialog->setOptimalLayoutSize(); } return 0; } @@ -1645,4 +1645,10 @@ bool isLayoutEnabled(const Window *pWindow) return pChild && isContainerWindow(*pChild) && !pChild->GetWindow(WINDOW_NEXT); } +bool isInitialLayout(const Window *pWindow) +{ + Dialog *pParentDialog = pWindow ? pWindow->GetParentDialog() : NULL; + return pParentDialog && pParentDialog->isCalculatingInitialLayoutSize(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |