diff --git a/src/common/bookctrl.cpp b/src/common/bookctrl.cpp index 3926058ab5..25498b0fa4 100644 --- a/src/common/bookctrl.cpp +++ b/src/common/bookctrl.cpp @@ -146,9 +146,7 @@ wxSize wxBookCtrlBase::DoGetBestSize() const // convert display area to window area, adding the size necessary for the // tabs - wxSize best = CalcSizeFromPage(bestSize); - CacheBestSize(best); - return best; + return CalcSizeFromPage(bestSize); } wxRect wxBookCtrlBase::GetPageRect() const diff --git a/src/common/ctrlcmn.cpp b/src/common/ctrlcmn.cpp index 425b947b66..1489fd129b 100644 --- a/src/common/ctrlcmn.cpp +++ b/src/common/ctrlcmn.cpp @@ -584,15 +584,9 @@ wxStaticBitmapBase::~wxStaticBitmapBase() wxSize wxStaticBitmapBase::DoGetBestSize() const { - wxSize best; - wxBitmap bmp = GetBitmap(); - if ( bmp.IsOk() ) - best = bmp.GetScaledSize(); - else - // this is completely arbitrary - best = wxSize(16, 16); - CacheBestSize(best); - return best; + // the fall back size is completely arbitrary + const wxBitmap bmp = GetBitmap(); + return bmp.IsOk() ? bmp.GetScaledSize() : wxSize(16, 16); } #endif // wxUSE_STATBMP diff --git a/src/common/treebase.cpp b/src/common/treebase.cpp index b2cfd7960a..50359c40f4 100644 --- a/src/common/treebase.cpp +++ b/src/common/treebase.cpp @@ -279,14 +279,9 @@ wxSize wxTreeCtrlBase::DoGetBestSize() const // need some minimal size even for empty tree if ( !size.x || !size.y ) size = wxControl::DoGetBestSize(); - else - { - // Add border size + else // add border size size += GetWindowBorderSize(); - CacheBestSize(size); - } - return size; } diff --git a/src/generic/bmpcboxg.cpp b/src/generic/bmpcboxg.cpp index 332e6ca4d3..6432bccaf0 100644 --- a/src/generic/bmpcboxg.cpp +++ b/src/generic/bmpcboxg.cpp @@ -278,8 +278,6 @@ wxSize wxBitmapComboBox::DoGetBestSize() const if ( h2 > sz.y ) sz.y = h2; - - CacheBestSize(sz); } return sz; diff --git a/src/generic/calctrlg.cpp b/src/generic/calctrlg.cpp index a03cfbd4da..d30e835f34 100644 --- a/src/generic/calctrlg.cpp +++ b/src/generic/calctrlg.cpp @@ -709,8 +709,6 @@ wxSize wxGenericCalendarCtrl::DoGetBestSize() const best += GetWindowBorderSize(); } - CacheBestSize(best); - return best; } diff --git a/src/generic/headerctrlg.cpp b/src/generic/headerctrlg.cpp index cc720c8617..88adf18678 100644 --- a/src/generic/headerctrlg.cpp +++ b/src/generic/headerctrlg.cpp @@ -135,11 +135,9 @@ wxSize wxHeaderCtrl::DoGetBestSize() const // the vertical size is rather arbitrary but it looks better if we leave // some space around the text - const wxSize size(IsEmpty() ? wxHeaderCtrlBase::DoGetBestSize().x - : GetColEnd(GetColumnCount() - 1), - height ); // (7*GetCharHeight())/4); - CacheBestSize(size); - return size; + return wxSize(IsEmpty() ? wxHeaderCtrlBase::DoGetBestSize().x + : GetColEnd(GetColumnCount() - 1), + height); // (7*GetCharHeight())/4); } int wxHeaderCtrl::GetColStart(unsigned int idx) const diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index aa8a7dc0da..1aeac569fd 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -4153,9 +4153,6 @@ wxSize wxGenericTreeCtrl::DoGetBestSize() const if ( dy ) size.y += PIXELS_PER_UNIT - dy; - // we need to update the cache too as the base class cached its own value - CacheBestSize(size); - return size; } diff --git a/src/gtk/bmpcbox.cpp b/src/gtk/bmpcbox.cpp index 43d522c08a..9fc5ac0e1f 100644 --- a/src/gtk/bmpcbox.cpp +++ b/src/gtk/bmpcbox.cpp @@ -175,10 +175,8 @@ wxSize wxBitmapComboBox::DoGetBestSize() const int delta = GetBitmapSize().y - GetCharHeight(); if ( delta > 0 ) - { best.y += delta; - CacheBestSize(best); - } + return best; } diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index 0dbe3a70c0..7329f8a3d4 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -320,7 +320,6 @@ wxSize wxButton::DoGetBestSize() const ret.y = defaultSize.y; } - CacheBestSize(ret); return ret; } diff --git a/src/gtk/gauge.cpp b/src/gtk/gauge.cpp index 7c8c1c9cd4..85c044899b 100644 --- a/src/gtk/gauge.cpp +++ b/src/gtk/gauge.cpp @@ -77,7 +77,6 @@ wxSize wxGauge::DoGetBestSize() const best = wxSize(28, 100); else best = wxSize(100, 28); - CacheBestSize(best); return best; } diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index dbc8db0f71..2181bb926b 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -886,9 +886,7 @@ wxSize wxListBox::DoGetBestSize() const // Don't make the listbox too tall but don't make it too small neither lbHeight = (cy+4) * wxMin(wxMax(count, 3), 10); - wxSize best(lbWidth, lbHeight); - CacheBestSize(best); - return best; + return wxSize(lbWidth, lbHeight); } // static diff --git a/src/gtk/spinbutt.cpp b/src/gtk/spinbutt.cpp index 6aaaf82d83..5147f09557 100644 --- a/src/gtk/spinbutt.cpp +++ b/src/gtk/spinbutt.cpp @@ -204,7 +204,6 @@ wxSize wxSpinButton::DoGetBestSize() const w = 6; best.x = w + 2 * m_widget->style->xthickness; #endif - CacheBestSize(best); return best; } diff --git a/src/gtk/stattext.cpp b/src/gtk/stattext.cpp index 5d9ffce8e3..c560dcb4b1 100644 --- a/src/gtk/stattext.cpp +++ b/src/gtk/stattext.cpp @@ -255,7 +255,6 @@ wxSize wxStaticText::DoGetBestSize() const // Adding 1 to width to workaround GTK sometimes wrapping the text needlessly size.x++; - CacheBestSize(size); return size; } diff --git a/src/gtk/tglbtn.cpp b/src/gtk/tglbtn.cpp index 1b91146de5..b4d90adb5f 100644 --- a/src/gtk/tglbtn.cpp +++ b/src/gtk/tglbtn.cpp @@ -242,7 +242,6 @@ wxSize wxToggleButton::DoGetBestSize() const if (ret.x < 80) ret.x = 80; } - CacheBestSize(ret); return ret; } diff --git a/src/gtk1/button.cpp b/src/gtk1/button.cpp index a414ecfa4e..3f7c09026b 100644 --- a/src/gtk1/button.cpp +++ b/src/gtk1/button.cpp @@ -238,7 +238,6 @@ wxSize wxButton::DoGetBestSize() const if (ret.y < defaultSize.y) ret.y = defaultSize.y; } - CacheBestSize(ret); return ret; } diff --git a/src/gtk1/choice.cpp b/src/gtk1/choice.cpp index 1488c40ebc..018fa23310 100644 --- a/src/gtk1/choice.cpp +++ b/src/gtk1/choice.cpp @@ -541,7 +541,6 @@ wxSize wxChoice::DoGetBestSize() const if (ret.y <= 18) ret.y = 8 + GetCharHeight(); - CacheBestSize(ret); return ret; } diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index d125ba6be8..cffc1d99c5 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -895,7 +895,6 @@ wxSize wxComboBox::DoGetBestSize() const if ( ret.x < 100 ) ret.x = 100; - CacheBestSize(ret); return ret; } diff --git a/src/gtk1/control.cpp b/src/gtk1/control.cpp index 6fdfb48980..d533d86efb 100644 --- a/src/gtk1/control.cpp +++ b/src/gtk1/control.cpp @@ -64,9 +64,7 @@ wxSize wxControl::DoGetBestSize() const (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request ) (m_widget, &req ); - wxSize best(req.width, req.height); - CacheBestSize(best); - return best; + return wxSize(req.width, req.height); } diff --git a/src/gtk1/gauge.cpp b/src/gtk1/gauge.cpp index b4d3ce1d73..8ce9c26efc 100644 --- a/src/gtk1/gauge.cpp +++ b/src/gtk1/gauge.cpp @@ -70,7 +70,6 @@ wxSize wxGauge::DoGetBestSize() const best = wxSize(28, 100); else best = wxSize(100, 28); - CacheBestSize(best); return best; } diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index 316bed1321..0bc35bc65d 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -1102,9 +1102,7 @@ wxSize wxListBox::DoGetBestSize() const // make it too small neither lbHeight = (cy+4) * wxMin(wxMax(GetCount(), 3), 10); - wxSize best(lbWidth, lbHeight); - CacheBestSize(best); - return best; + return wxSize(lbWidth, lbHeight); } void wxListBox::FixUpMouseEvent(GtkWidget *widget, wxCoord& x, wxCoord& y) diff --git a/src/gtk1/spinbutt.cpp b/src/gtk1/spinbutt.cpp index 85e2083759..f6284dda64 100644 --- a/src/gtk1/spinbutt.cpp +++ b/src/gtk1/spinbutt.cpp @@ -221,9 +221,7 @@ bool wxSpinButton::IsOwnGtkWindow( GdkWindow *window ) wxSize wxSpinButton::DoGetBestSize() const { - wxSize best(15, 26); // FIXME - CacheBestSize(best); - return best; + return wxSize(15, 26); // FIXME } // static diff --git a/src/gtk1/spinctrl.cpp b/src/gtk1/spinctrl.cpp index eee5eaf029..d462dbe0ca 100644 --- a/src/gtk1/spinctrl.cpp +++ b/src/gtk1/spinctrl.cpp @@ -330,10 +330,7 @@ bool wxSpinCtrl::IsOwnGtkWindow( GdkWindow *window ) wxSize wxSpinCtrl::DoGetBestSize() const { - wxSize ret( wxControl::DoGetBestSize() ); - wxSize best(95, ret.y); - CacheBestSize(best); - return best; + return wxSize(95, wxControl::DoGetBestSize().y); } bool wxSpinCtrl::SetBase(int base) diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 5267495b2f..fbce6fc20e 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -1255,10 +1255,7 @@ void wxTextCtrl::OnInternalIdle() wxSize wxTextCtrl::DoGetBestSize() const { // FIXME should be different for multi-line controls... - wxSize ret( wxControl::DoGetBestSize() ); - wxSize best(80, ret.y); - CacheBestSize(best); - return best; + return wxSize(80, wxControl::DoGetBestSize().y); } // ---------------------------------------------------------------------------- diff --git a/src/gtk1/tglbtn.cpp b/src/gtk1/tglbtn.cpp index 73580a2974..f173f1a462 100644 --- a/src/gtk1/tglbtn.cpp +++ b/src/gtk1/tglbtn.cpp @@ -208,7 +208,6 @@ wxSize wxToggleBitmapButton::DoGetBestSize() const best.x = m_bitmap.GetWidth()+border; best.y = m_bitmap.GetHeight()+border; } - CacheBestSize(best); return best; } @@ -348,7 +347,6 @@ wxSize wxToggleButton::DoGetBestSize() const if (ret.x < 80) ret.x = 80; } - CacheBestSize(ret); return ret; } diff --git a/src/msw/bmpcbox.cpp b/src/msw/bmpcbox.cpp index 124b9b78f1..0b33efd5d2 100644 --- a/src/msw/bmpcbox.cpp +++ b/src/msw/bmpcbox.cpp @@ -226,10 +226,7 @@ wxSize wxBitmapComboBox::DoGetBestSize() const wxCoord useHeightBitmap = EDIT_HEIGHT_FROM_CHAR_HEIGHT(bitmapSize.y); if ( best.y < useHeightBitmap ) - { best.y = useHeightBitmap; - CacheBestSize(best); - } return best; } diff --git a/src/msw/calctrl.cpp b/src/msw/calctrl.cpp index 8b6f359fa5..2567cc59d0 100644 --- a/src/msw/calctrl.cpp +++ b/src/msw/calctrl.cpp @@ -173,9 +173,7 @@ wxSize wxCalendarCtrl::DoGetBestSize() const return wxCalendarCtrlBase::DoGetBestSize(); } - const wxSize best = wxRectFromRECT(rc).GetSize() + GetWindowBorderSize(); - CacheBestSize(best); - return best; + return wxRectFromRECT(rc).GetSize() + GetWindowBorderSize(); } wxCalendarHitTestResult diff --git a/src/msw/checkbox.cpp b/src/msw/checkbox.cpp index 05a7ccd500..8fa7609571 100644 --- a/src/msw/checkbox.cpp +++ b/src/msw/checkbox.cpp @@ -174,9 +174,7 @@ wxSize wxCheckBox::DoGetBestClientSize() const hCheckbox = s_checkSize; } - wxSize best(wCheckbox, hCheckbox); - CacheBestSize(best); - return best; + return wxSize(wCheckbox, hCheckbox); } // ---------------------------------------------------------------------------- diff --git a/src/msw/checklst.cpp b/src/msw/checklst.cpp index bd9efd6be4..97f0cec73a 100644 --- a/src/msw/checklst.cpp +++ b/src/msw/checklst.cpp @@ -427,7 +427,6 @@ wxSize wxCheckListBox::DoGetBestClientSize() const if ( best.y < size.GetHeight() ) best.y = size.GetHeight(); - CacheBestSize(best); return best; } diff --git a/src/msw/commandlinkbutton.cpp b/src/msw/commandlinkbutton.cpp index 653b48be8a..0a79dc289b 100644 --- a/src/msw/commandlinkbutton.cpp +++ b/src/msw/commandlinkbutton.cpp @@ -194,8 +194,6 @@ wxSize wxCommandLinkButton::DoGetBestSize() const if ( !GetNote().empty() ) size.y += MAINLABEL_NOTE_MARGIN; - CacheBestSize(size); - return size; } diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 720925a0bf..0bc13ada81 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -615,9 +615,7 @@ wxSize wxRadioBox::DoGetBestSize() const return wxSize(1, 1); } - wxSize best = GetTotalButtonSize(GetMaxButtonSize()); - CacheBestSize(best); - return best; + return GetTotalButtonSize(GetMaxButtonSize()); } void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) diff --git a/src/msw/radiobut.cpp b/src/msw/radiobut.cpp index ab0e84563e..e4c1134024 100644 --- a/src/msw/radiobut.cpp +++ b/src/msw/radiobut.cpp @@ -267,9 +267,7 @@ wxSize wxRadioButton::DoGetBestSize() const hRadio = s_radioSize; } - wxSize best(wRadio, hRadio); - CacheBestSize(best); - return best; + return wxSize(wRadio, hRadio); } WXDWORD wxRadioButton::MSWGetStyle(long style, WXDWORD *exstyle) const diff --git a/src/msw/scrolbar.cpp b/src/msw/scrolbar.cpp index eac7ec6e2c..efb792c020 100644 --- a/src/msw/scrolbar.cpp +++ b/src/msw/scrolbar.cpp @@ -215,9 +215,7 @@ wxSize wxScrollBar::DoGetBestSize() const h = wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y); } - wxSize best(w, h); - CacheBestSize(best); - return best; + return wxSize(w, h); } WXDWORD wxScrollBar::MSWGetStyle(long style, WXDWORD *exstyle) const diff --git a/src/msw/statusbar.cpp b/src/msw/statusbar.cpp index c00698d3da..dac53ece3b 100644 --- a/src/msw/statusbar.cpp +++ b/src/msw/statusbar.cpp @@ -497,9 +497,7 @@ wxSize wxStatusBar::DoGetBestSize() const int height = GetCharHeight(); height += 4*borders.vert; - wxSize best(width, height); - CacheBestSize(best); - return best; + return wxSize(width, height); } void wxStatusBar::DoMoveWindow(int x, int y, int width, int height) diff --git a/src/msw/toolbar.cpp b/src/msw/toolbar.cpp index f03386daee..426681571b 100644 --- a/src/msw/toolbar.cpp +++ b/src/msw/toolbar.cpp @@ -539,8 +539,6 @@ wxSize wxToolBar::DoGetBestSize() const sizeBest.y ++; } - CacheBestSize(sizeBest); - return sizeBest; } diff --git a/src/osx/scrolbar_osx.cpp b/src/osx/scrolbar_osx.cpp index 6eea3d4802..039a33846a 100644 --- a/src/osx/scrolbar_osx.cpp +++ b/src/osx/scrolbar_osx.cpp @@ -119,9 +119,7 @@ wxSize wxScrollBar::DoGetBestSize() const h = wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y); } - wxSize best(w, h); - CacheBestSize(best); - return best; + return wxSize(w, h); } void wxScrollBar::TriggerScrollEvent( wxEventType scrollEvent ) diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 2db7ed4d07..345300e09d 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -1214,10 +1214,7 @@ wxSize wxPropertyGrid::DoGetBestSize() const width += m_pState->GetColumnFitWidth(dc, m_pState->DoGetRoot(), i, true); } - const wxSize sz = wxSize(width, lineHeight*numLines + 40); - - CacheBestSize(sz); - return sz; + return wxSize(width, lineHeight*numLines + 40); } // -----------------------------------------------------------------------