diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-01-14 10:40:11 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-01-14 16:04:17 +0000 |
commit | 830f44b1ca0e121d3e27a031054313e3f194ab1d (patch) | |
tree | 5e278495b667b8ca36d10770dc07d32134954e80 /vcl | |
parent | d652af7d071bb5e5c3f7592d6dc7e7c400e711d3 (diff) |
we only ever want the preferred window size from GetOptimalSize
so remove the MAX and MIN options and simplify the whole lot
Change-Id: Iaaf350c37e01f7fce434af760bcddb9b7d7135ea
Diffstat (limited to 'vcl')
34 files changed, 82 insertions, 174 deletions
diff --git a/vcl/inc/brdwin.hxx b/vcl/inc/brdwin.hxx index d0e976430e39..55da2232bfbe 100644 --- a/vcl/inc/brdwin.hxx +++ b/vcl/inc/brdwin.hxx @@ -178,7 +178,7 @@ public: Rectangle GetMenuRect() const; - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; }; // ======================================================================= diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx index 3a0cbb7c7669..d57218ebd2bb 100644 --- a/vcl/inc/printdlg.hxx +++ b/vcl/inc/printdlg.hxx @@ -82,7 +82,7 @@ namespace vcl ShowNupOrderWindow( Window* pParent ); virtual ~ShowNupOrderWindow(); - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; virtual void Paint( const Rectangle& ); diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx index 46be2854e301..47a44012a195 100644 --- a/vcl/inc/vcl/button.hxx +++ b/vcl/inc/vcl/button.hxx @@ -186,7 +186,7 @@ public: TriState GetSavedValue() const { return meSaveValue; } Size CalcMinimumSize( long nMaxWidth = 0 ) const; - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; void SetToggleHdl( const Link& rLink ) { maToggleHdl = rLink; } const Link& GetToggleHdl() const { return maToggleHdl; } @@ -379,7 +379,7 @@ public: static Image GetRadioImage( const AllSettings& rSettings, sal_uInt16 nFlags ); Size CalcMinimumSize( long nMaxWidth = 0 ) const; - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; void SetToggleHdl( const Link& rLink ) { maToggleHdl = rLink; } const Link& GetToggleHdl() const { return maToggleHdl; } @@ -493,7 +493,7 @@ public: static Image GetCheckImage( const AllSettings& rSettings, sal_uInt16 nFlags ); Size CalcMinimumSize( long nMaxWidth = 0 ) const; - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; void SetToggleHdl( const Link& rLink ) { maToggleHdl = rLink; } const Link& GetToggleHdl() const { return maToggleHdl; } diff --git a/vcl/inc/vcl/combobox.hxx b/vcl/inc/vcl/combobox.hxx index 72478c59a713..d0364105afb6 100644 --- a/vcl/inc/vcl/combobox.hxx +++ b/vcl/inc/vcl/combobox.hxx @@ -167,7 +167,7 @@ public: const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; } Size CalcMinimumSize() const; - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; Size CalcAdjustedSize( const Size& rPrefSize ) const; using Edit::CalcSize; Size CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const; diff --git a/vcl/inc/vcl/ctrl.hxx b/vcl/inc/vcl/ctrl.hxx index 682038602785..bd178f05657c 100644 --- a/vcl/inc/vcl/ctrl.hxx +++ b/vcl/inc/vcl/ctrl.hxx @@ -173,7 +173,7 @@ public: void SetLayoutDataParent( const Control* pParent ) const; - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; /** sets a reference device used for rendering control text @seealso DrawControlText diff --git a/vcl/inc/vcl/dialog.hxx b/vcl/inc/vcl/dialog.hxx index 6f5b0c0db934..7f16d07dd033 100644 --- a/vcl/inc/vcl/dialog.hxx +++ b/vcl/inc/vcl/dialog.hxx @@ -91,7 +91,7 @@ public: virtual void StateChanged( StateChangedType nStateChange ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; virtual void Resize(); bool isLayoutEnabled() const; void setInitialLayoutSize(); diff --git a/vcl/inc/vcl/edit.hxx b/vcl/inc/vcl/edit.hxx index 3957f69471de..10d3fe44a160 100644 --- a/vcl/inc/vcl/edit.hxx +++ b/vcl/inc/vcl/edit.hxx @@ -230,7 +230,7 @@ public: virtual Size CalcMinimumSize() const; virtual Size CalcMinimumSizeForText(const rtl::OUString &rString) const; - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; virtual Size CalcSize( sal_uInt16 nChars ) const; virtual xub_StrLen GetMaxVisChars() const; diff --git a/vcl/inc/vcl/fixed.hxx b/vcl/inc/vcl/fixed.hxx index 22ed857ebd7e..7e1502595ddb 100644 --- a/vcl/inc/vcl/fixed.hxx +++ b/vcl/inc/vcl/fixed.hxx @@ -73,7 +73,7 @@ public: static Size CalcMinimumTextSize(Control const* pControl, long nMaxWidth = 0x7fffffff); static Size getTextDimensions(Control const *pControl, const OUString &rTxt, long nMaxWidth); Size CalcMinimumSize(long nMaxWidth = 0x7fffffff) const; - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; virtual bool set_property(const rtl::OString &rKey, const rtl::OString &rValue); }; @@ -116,7 +116,7 @@ public: virtual void StateChanged( StateChangedType nType ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; }; // --------------- @@ -188,7 +188,7 @@ public: virtual void StateChanged( StateChangedType nType ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); virtual void UserDraw( const UserDrawEvent& rUDEvt ); - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; void SetImage( const Image& rImage ); const Image& GetImage() const { return maImage; } diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx index 7c71d9ccb928..073433f462ed 100644 --- a/vcl/inc/vcl/layout.hxx +++ b/vcl/inc/vcl/layout.hxx @@ -21,7 +21,7 @@ class VCL_DLLPUBLIC VclContainer : public Window { public: VclContainer(Window *pParent, WinBits nStyle = WB_HIDE); - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize); virtual void SetPosPixel(const Point& rAllocPos); virtual void SetSizePixel(const Size& rAllocation); diff --git a/vcl/inc/vcl/lstbox.hxx b/vcl/inc/vcl/lstbox.hxx index cabc30bfb027..694f45c882b5 100644 --- a/vcl/inc/vcl/lstbox.hxx +++ b/vcl/inc/vcl/lstbox.hxx @@ -189,7 +189,7 @@ public: Size CalcSubEditSize() const; //size of area inside lstbox, i.e. no scrollbar/dropdown Size CalcMinimumSize() const; //size of lstbox area, i.e. including scrollbar/dropdown - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; Size CalcAdjustedSize( const Size& rPrefSize ) const; Size CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const; void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const; diff --git a/vcl/inc/vcl/msgbox.hxx b/vcl/inc/vcl/msgbox.hxx index cd9e86024280..8f0336dc045d 100644 --- a/vcl/inc/vcl/msgbox.hxx +++ b/vcl/inc/vcl/msgbox.hxx @@ -93,7 +93,7 @@ public: void SetCheckBoxState( sal_Bool bCheck ); sal_Bool GetCheckBoxState() const; - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; }; // ----------- diff --git a/vcl/inc/vcl/scrbar.hxx b/vcl/inc/vcl/scrbar.hxx index 7c62d941d5fe..4a1a164121be 100644 --- a/vcl/inc/vcl/scrbar.hxx +++ b/vcl/inc/vcl/scrbar.hxx @@ -140,7 +140,7 @@ public: void SetEndScrollHdl( const Link& rLink ) { maEndScrollHdl = rLink; } const Link& GetEndScrollHdl() const { return maEndScrollHdl; } - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; }; // ---------------- diff --git a/vcl/inc/vcl/spinfld.hxx b/vcl/inc/vcl/spinfld.hxx index 578aebb1ea88..4d38a2ea9dc0 100644 --- a/vcl/inc/vcl/spinfld.hxx +++ b/vcl/inc/vcl/spinfld.hxx @@ -102,7 +102,7 @@ public: virtual Size CalcMinimumSize() const; virtual Size CalcMinimumSizeForText(const rtl::OUString &rString) const; - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; virtual Size CalcSize( sal_uInt16 nChars ) const; }; diff --git a/vcl/inc/vcl/tabctrl.hxx b/vcl/inc/vcl/tabctrl.hxx index 39cbad314c48..f2928d9cadd9 100644 --- a/vcl/inc/vcl/tabctrl.hxx +++ b/vcl/inc/vcl/tabctrl.hxx @@ -111,7 +111,7 @@ public: virtual void ActivatePage(); virtual long DeactivatePage(); - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; void SetTabPageSizePixel( const Size& rSize ); Size GetTabPageSizePixel() const; diff --git a/vcl/inc/vcl/tabpage.hxx b/vcl/inc/vcl/tabpage.hxx index 1aa4b91a778b..769003d0357e 100644 --- a/vcl/inc/vcl/tabpage.hxx +++ b/vcl/inc/vcl/tabpage.hxx @@ -59,7 +59,7 @@ public: virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize); virtual void SetPosPixel(const Point& rNewPos); virtual void SetSizePixel(const Size& rNewSize); - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; }; #endif // _SV_TABPAGE_HXX diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index f0ceb9a3e1b8..66c0cfa6e233 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -316,13 +316,6 @@ typedef sal_uInt16 StateChangedType; #define DLGWINDOW_NEXT 1 #define DLGWINDOW_FIRST 2 -enum WindowSizeType -{ - WINDOWSIZE_MINIMUM, - WINDOWSIZE_PREFERRED, - WINDOWSIZE_MAXIMUM -}; - // ---------- // - Window - // ---------- @@ -1064,7 +1057,7 @@ public: * Implement this in sub-classes to tell layout * the preferred widget size. */ - virtual Size GetOptimalSize(WindowSizeType eType) const; + virtual Size GetOptimalSize() const; /* * Widgets call this to inform their owner container that the widget wants diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 8ad4c6cb6324..16190b482913 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -1707,15 +1707,9 @@ Size PushButton::CalcMinimumSize( long nMaxWidth ) const return CalcWindowSize( aSize ); } -Size PushButton::GetOptimalSize(WindowSizeType eType) const +Size PushButton::GetOptimalSize() const { - switch (eType) { - case WINDOWSIZE_MINIMUM: { - return CalcMinimumSize(); - } - default: - return Button::GetOptimalSize( eType ); - } + return CalcMinimumSize(); } bool PushButton::set_property(const rtl::OString &rKey, const rtl::OString &rValue) @@ -3077,14 +3071,9 @@ Size RadioButton::CalcMinimumSize( long nMaxWidth ) const // ----------------------------------------------------------------------- -Size RadioButton::GetOptimalSize(WindowSizeType eType) const +Size RadioButton::GetOptimalSize() const { - switch (eType) { - case WINDOWSIZE_MINIMUM: - return CalcMinimumSize(); - default: - return Button::GetOptimalSize( eType ); - } + return CalcMinimumSize(); } // ======================================================================= @@ -3992,14 +3981,9 @@ Size CheckBox::CalcMinimumSize( long nMaxWidth ) const // ----------------------------------------------------------------------- -Size CheckBox::GetOptimalSize(WindowSizeType eType) const +Size CheckBox::GetOptimalSize() const { - switch (eType) { - case WINDOWSIZE_MINIMUM: - return CalcMinimumSize(); - default: - return Button::GetOptimalSize( eType ); - } + return CalcMinimumSize(); } // ======================================================================= diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 389929c34b53..75f4e307e5e4 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -1016,14 +1016,9 @@ long ComboBox::CalcWindowSizePixel( sal_uInt16 nLines ) const // ----------------------------------------------------------------------- -Size ComboBox::GetOptimalSize(WindowSizeType eType) const +Size ComboBox::GetOptimalSize() const { - switch (eType) { - case WINDOWSIZE_MINIMUM: - return CalcMinimumSize(); - default: - return Edit::GetOptimalSize( eType ); - } + return CalcMinimumSize(); } // ----------------------------------------------------------------------- diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 8ebd3ebf124c..debdc4fab382 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -455,18 +455,10 @@ ControlLayoutData::~ControlLayoutData() // ----------------------------------------------------------------- -Size Control::GetOptimalSize(WindowSizeType eType) const -{ - switch (eType) { - case WINDOWSIZE_MINIMUM: - return Size( GetTextWidth( GetText() ) + 2 * 12, - GetTextHeight() + 2 * 6 ); - case WINDOWSIZE_PREFERRED: - return GetOptimalSize( WINDOWSIZE_MINIMUM ); - case WINDOWSIZE_MAXIMUM: - default: - return Size( LONG_MAX, LONG_MAX ); - } +Size Control::GetOptimalSize() const +{ + return Size( GetTextWidth( GetText() ) + 2 * 12, + GetTextHeight() + 2 * 6 ); } // ----------------------------------------------------------------- diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 513fd51e2d11..3e177d09a184 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -2954,14 +2954,9 @@ Size Edit::GetMinimumEditSize() // ----------------------------------------------------------------------- -Size Edit::GetOptimalSize(WindowSizeType eType) const +Size Edit::GetOptimalSize() const { - switch (eType) { - case WINDOWSIZE_MINIMUM: - return CalcMinimumSize(); - default: - return Control::GetOptimalSize( eType ); - } + return CalcMinimumSize(); } // ----------------------------------------------------------------------- diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index 4646f3b42983..42b150ce885b 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -417,34 +417,26 @@ Size FixedText::CalcMinimumSize( long nMaxWidth ) const } // ----------------------------------------------------------------------- -Size FixedText::GetOptimalSize(WindowSizeType eType) const +Size FixedText::GetOptimalSize() const { - switch (eType) + sal_Int32 nMaxAvailWidth = 0x7fffffff; + const OUString &rTxt = GetText(); + if (m_nMaxWidthChars != -1 && m_nMaxWidthChars < rTxt.getLength()) { - case WINDOWSIZE_MINIMUM: - { - sal_Int32 nMaxAvailWidth = 0x7fffffff; - const OUString &rTxt = GetText(); - if (m_nMaxWidthChars != -1 && m_nMaxWidthChars < rTxt.getLength()) - { - nMaxAvailWidth = getTextDimensions(this, - rTxt.copy(0, m_nMaxWidthChars), 0x7fffffff).Width(); - } - Size aRet = CalcMinimumSize(nMaxAvailWidth); - if (m_nMinWidthChars != -1) - { - OUStringBuffer aBuf; - comphelper::string::padToLength(aBuf, m_nMinWidthChars, 'x'); - Size aMinAllowed = getTextDimensions(this, - aBuf.makeStringAndClear(), 0x7fffffff); - if (aMinAllowed.Width() > aRet.Width()) - aRet = aMinAllowed; - } - return aRet; - } - default: - return Control::GetOptimalSize( eType ); + nMaxAvailWidth = getTextDimensions(this, + rTxt.copy(0, m_nMaxWidthChars), 0x7fffffff).Width(); + } + Size aRet = CalcMinimumSize(nMaxAvailWidth); + if (m_nMinWidthChars != -1) + { + OUStringBuffer aBuf; + comphelper::string::padToLength(aBuf, m_nMinWidthChars, 'x'); + Size aMinAllowed = getTextDimensions(this, + aBuf.makeStringAndClear(), 0x7fffffff); + if (aMinAllowed.Width() > aRet.Width()) + aRet = aMinAllowed; } + return aRet; } // ----------------------------------------------------------------------- @@ -753,14 +745,9 @@ void FixedLine::DataChanged( const DataChangedEvent& rDCEvt ) // ----------------------------------------------------------------------- -Size FixedLine::GetOptimalSize(WindowSizeType eType) const +Size FixedLine::GetOptimalSize() const { - switch (eType) { - case WINDOWSIZE_MINIMUM: - return CalcWindowSize( FixedText::CalcMinimumTextSize ( this, 0x7fffffff ) ); - default: - return Control::GetOptimalSize( eType ); - } + return CalcWindowSize( FixedText::CalcMinimumTextSize ( this, 0x7fffffff ) ); } // ======================================================================= @@ -1106,10 +1093,9 @@ void FixedImage::Paint( const Rectangle& ) // ----------------------------------------------------------------------- -Size FixedImage::GetOptimalSize( WindowSizeType ) const +Size FixedImage::GetOptimalSize() const { - const Image* pImage = &maImage; - return pImage->GetSizePixel(); + return maImage.GetSizePixel(); } // ----------------------------------------------------------------------- diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index f36204b1420a..beb216d12c07 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -1354,14 +1354,9 @@ Size ListBox::CalcSubEditSize() const // ----------------------------------------------------------------------- -Size ListBox::GetOptimalSize(WindowSizeType eType) const +Size ListBox::GetOptimalSize() const { - switch (eType) { - case WINDOWSIZE_MINIMUM: - return CalcMinimumSize(); - default: - return Control::GetOptimalSize( eType ); - } + return CalcMinimumSize(); } // ----------------------------------------------------------------------- diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index b99ff260188c..b2ffb7f2c29f 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -1507,7 +1507,7 @@ void ScrollBar::SetVisibleSize( long nNewSize ) } } -Size ScrollBar::GetOptimalSize(WindowSizeType) const +Size ScrollBar::GetOptimalSize() const { if (mbCalcSize) const_cast<ScrollBar*>(this)->ImplCalc(sal_False); diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index cba366d1b682..604c386587ba 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -995,14 +995,9 @@ Size SpinField::CalcMinimumSize() const // ----------------------------------------------------------------------- -Size SpinField::GetOptimalSize(WindowSizeType eType) const +Size SpinField::GetOptimalSize() const { - switch (eType) { - case WINDOWSIZE_MINIMUM: - return CalcMinimumSize(); - default: - return Edit::GetOptimalSize( eType ); - } + return CalcMinimumSize(); } // ----------------------------------------------------------------------- diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index e2fecc29e0d1..02ac5337de03 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -2219,7 +2219,7 @@ Size TabControl::calculateRequisition() const if (!pPage) continue; - Size aPageSize(pPage->GetOptimalSize(WINDOWSIZE_PREFERRED)); + Size aPageSize(pPage->GetOptimalSize()); if (aPageSize.Width() > aOptimalPageSize.Width()) aOptimalPageSize.Width() = aPageSize.Width(); @@ -2251,10 +2251,8 @@ Size TabControl::calculateRequisition() const return aOptimalSize; } -Size TabControl::GetOptimalSize(WindowSizeType eType) const +Size TabControl::GetOptimalSize() const { - if (eType == WINDOWSIZE_MINIMUM) - return Size(); return calculateRequisition(); } diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx index 9fea710b10b2..60b20a6ab623 100644 --- a/vcl/source/window/brdwin.cxx +++ b/vcl/source/window/brdwin.cxx @@ -2360,16 +2360,12 @@ Rectangle ImplBorderWindow::GetMenuRect() const return mpBorderView->GetMenuRect(); } -Size ImplBorderWindow::GetOptimalSize(WindowSizeType eType) const +Size ImplBorderWindow::GetOptimalSize() const { - if (eType == WINDOWSIZE_MAXIMUM) - return Size(mnMaxWidth, mnMaxHeight); - if (eType == WINDOWSIZE_MINIMUM) - return Size(mnMinWidth, mnMinHeight); - Window* pClientWindow = ImplGetClientWindow(); + const Window* pClientWindow = ImplGetClientWindow(); if (pClientWindow) - return pClientWindow->GetOptimalSize(eType); - return Size(0, 0); + return pClientWindow->GetOptimalSize(); + return Size(mnMinWidth, mnMinHeight); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 53eafdf6f782..1aef3e6296cd 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -1188,10 +1188,10 @@ bool Dialog::isLayoutEnabled() const return pChild && isContainerWindow(*pChild) && !pChild->GetWindow(WINDOW_NEXT); } -Size Dialog::GetOptimalSize(WindowSizeType eType) const +Size Dialog::GetOptimalSize() const { - if (eType == WINDOWSIZE_MAXIMUM || !isLayoutEnabled()) - return SystemWindow::GetOptimalSize(eType); + if (!isLayoutEnabled()) + return SystemWindow::GetOptimalSize(); Size aSize = VclContainer::getLayoutRequisition(*GetWindow(WINDOW_FIRSTCHILD)); diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 7364b11ef6a9..a6d9d409b541 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -21,10 +21,8 @@ VclContainer::VclContainer(Window *pParent, WinBits nStyle) SetBackground(); } -Size VclContainer::GetOptimalSize(WindowSizeType eType) const +Size VclContainer::GetOptimalSize() const { - if (eType == WINDOWSIZE_MAXIMUM) - return Window::GetOptimalSize(eType); return calculateRequisition(); } diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx index 86dd2233a748..6aca66e50320 100644 --- a/vcl/source/window/msgbox.cxx +++ b/vcl/source/window/msgbox.cxx @@ -426,15 +426,10 @@ void MessBox::SetCheckBoxState( sal_Bool bCheck ) // ----------------------------------------------------------------------- -Size MessBox::GetOptimalSize(WindowSizeType eType) const +Size MessBox::GetOptimalSize() const { - switch( eType ) { - case WINDOWSIZE_MINIMUM: - // FIXME: base me on the font size ? - return Size( 250, 100 ); - default: - return Window::GetOptimalSize( eType ); - } + // FIXME: base me on the font size ? + return Size( 250, 100 ); } // ============================================================================ diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 97614b2f1704..2222eb8f876d 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -301,7 +301,7 @@ void PrintDialog::ShowNupOrderWindow::ImplInitSettings() SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) ); } -Size PrintDialog::ShowNupOrderWindow::GetOptimalSize(WindowSizeType) const +Size PrintDialog::ShowNupOrderWindow::GetOptimalSize() const { return Size(70, 70); } diff --git a/vcl/source/window/tabdlg.cxx b/vcl/source/window/tabdlg.cxx index d6dbcd38f7bc..7dfeb14c4a20 100644 --- a/vcl/source/window/tabdlg.cxx +++ b/vcl/source/window/tabdlg.cxx @@ -56,7 +56,7 @@ void TabDialog::ImplPosControls() pTabControl = pChild; else if ( pTabControl ) { - Size aOptimalSize( pChild->GetOptimalSize( WINDOWSIZE_PREFERRED ) ); + Size aOptimalSize(pChild->GetOptimalSize()); long nTxtWidth = aOptimalSize.Width(); if ( nTxtWidth > aCtrlSize.Width() ) aCtrlSize.Width() = nTxtWidth; @@ -86,7 +86,7 @@ void TabDialog::ImplPosControls() Point aTabOffset( IMPL_DIALOG_OFFSET, IMPL_DIALOG_OFFSET+nOffY ); if (isContainerWindow(*pTabControl)) - pTabControl->SetSizePixel(pTabControl->GetOptimalSize(WINDOWSIZE_PREFERRED)); + pTabControl->SetSizePixel(pTabControl->GetOptimalSize()); Size aTabSize = pTabControl->GetSizePixel(); diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx index 5f04373db18a..b15d9c1ea09a 100644 --- a/vcl/source/window/tabpage.cxx +++ b/vcl/source/window/tabpage.cxx @@ -207,16 +207,11 @@ bool TabPage::isLayoutEnabled() const return pChild && isContainerWindow(*pChild) && !pChild->GetWindow(WINDOW_NEXT); } -Size TabPage::GetOptimalSize(WindowSizeType eType) const +Size TabPage::GetOptimalSize() const { - if (eType == WINDOWSIZE_MAXIMUM) - return Window::GetOptimalSize(eType); - Size aSize; if (isLayoutEnabled()) - aSize = GetWindow(WINDOW_FIRSTCHILD)->GetOptimalSize(eType); - else - aSize = getLegacyBestSizeForChildren(*this); - return Window::CalcWindowSize(aSize); + return GetWindow(WINDOW_FIRSTCHILD)->GetOptimalSize(); + return getLegacyBestSizeForChildren(*this); } void TabPage::SetPosSizePixel(const Point& rAllocPos, const Size& rAllocation) diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 72d117df22d3..acf9aada3c5e 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -2014,7 +2014,7 @@ namespace Size aRet(rWindow.get_width_request(), rWindow.get_height_request()); if (aRet.Width() == -1 || aRet.Height() == -1) { - Size aOptimal = rWindow.GetOptimalSize(WINDOWSIZE_PREFERRED); + Size aOptimal = rWindow.GetOptimalSize(); if (aRet.Width() == -1) aRet.Width() = aOptimal.Width(); if (aRet.Height() == -1) diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx index b901276655ff..00919acce11a 100644 --- a/vcl/source/window/window3.cxx +++ b/vcl/source/window/window3.cxx @@ -32,18 +32,9 @@ WaitObject::~WaitObject() // ----------------------------------------------------------------------- -Size Window::GetOptimalSize(WindowSizeType eType) const +Size Window::GetOptimalSize() const { - switch (eType) - { - case WINDOWSIZE_MINIMUM: - return Size(); - case WINDOWSIZE_PREFERRED: - return GetOptimalSize( WINDOWSIZE_MINIMUM ); - case WINDOWSIZE_MAXIMUM: - default: - return Size( LONG_MAX, LONG_MAX ); - } + return Size(); } // ----------------------------------------------------------------------- |