Don't call CacheBestSize() from DoGetBestSize() implementations
This is unnecessary, wxWindow::GetBestSize() already does this, so calling it from DoGetBestSize() called by it too is just useless.
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -278,8 +278,6 @@ wxSize wxBitmapComboBox::DoGetBestSize() const
 | 
			
		||||
 | 
			
		||||
        if ( h2 > sz.y )
 | 
			
		||||
            sz.y = h2;
 | 
			
		||||
 | 
			
		||||
        CacheBestSize(sz);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return sz;
 | 
			
		||||
 
 | 
			
		||||
@@ -709,8 +709,6 @@ wxSize wxGenericCalendarCtrl::DoGetBestSize() const
 | 
			
		||||
        best += GetWindowBorderSize();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    CacheBestSize(best);
 | 
			
		||||
 | 
			
		||||
    return best;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -175,10 +175,8 @@ wxSize wxBitmapComboBox::DoGetBestSize() const
 | 
			
		||||
 | 
			
		||||
    int delta = GetBitmapSize().y - GetCharHeight();
 | 
			
		||||
    if ( delta > 0 )
 | 
			
		||||
    {
 | 
			
		||||
        best.y += delta;
 | 
			
		||||
        CacheBestSize(best);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return best;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -320,7 +320,6 @@ wxSize wxButton::DoGetBestSize() const
 | 
			
		||||
            ret.y = defaultSize.y;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    CacheBestSize(ret);
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,6 @@ wxSize wxGauge::DoGetBestSize() const
 | 
			
		||||
        best = wxSize(28, 100);
 | 
			
		||||
    else
 | 
			
		||||
        best = wxSize(100, 28);
 | 
			
		||||
    CacheBestSize(best);
 | 
			
		||||
    return best;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -204,7 +204,6 @@ wxSize wxSpinButton::DoGetBestSize() const
 | 
			
		||||
        w = 6;
 | 
			
		||||
    best.x = w + 2 * m_widget->style->xthickness;
 | 
			
		||||
#endif
 | 
			
		||||
    CacheBestSize(best);
 | 
			
		||||
    return best;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -242,7 +242,6 @@ wxSize wxToggleButton::DoGetBestSize() const
 | 
			
		||||
        if (ret.x < 80) ret.x = 80;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    CacheBestSize(ret);
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -238,7 +238,6 @@ wxSize wxButton::DoGetBestSize() const
 | 
			
		||||
        if (ret.y < defaultSize.y) ret.y = defaultSize.y;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    CacheBestSize(ret);
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -541,7 +541,6 @@ wxSize wxChoice::DoGetBestSize() const
 | 
			
		||||
    if (ret.y <= 18)
 | 
			
		||||
        ret.y = 8 + GetCharHeight();
 | 
			
		||||
 | 
			
		||||
    CacheBestSize(ret);
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -895,7 +895,6 @@ wxSize wxComboBox::DoGetBestSize() const
 | 
			
		||||
    if ( ret.x < 100 )
 | 
			
		||||
        ret.x = 100;
 | 
			
		||||
 | 
			
		||||
    CacheBestSize(ret);
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -70,7 +70,6 @@ wxSize wxGauge::DoGetBestSize() const
 | 
			
		||||
        best = wxSize(28, 100);
 | 
			
		||||
    else
 | 
			
		||||
        best = wxSize(100, 28);
 | 
			
		||||
    CacheBestSize(best);
 | 
			
		||||
    return best;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ----------------------------------------------------------------------------
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -174,9 +174,7 @@ wxSize wxCheckBox::DoGetBestClientSize() const
 | 
			
		||||
        hCheckbox = s_checkSize;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    wxSize best(wCheckbox, hCheckbox);
 | 
			
		||||
    CacheBestSize(best);
 | 
			
		||||
    return best;
 | 
			
		||||
    return wxSize(wCheckbox, hCheckbox);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ----------------------------------------------------------------------------
 | 
			
		||||
 
 | 
			
		||||
@@ -427,7 +427,6 @@ wxSize wxCheckListBox::DoGetBestClientSize() const
 | 
			
		||||
    if ( best.y < size.GetHeight() )
 | 
			
		||||
        best.y = size.GetHeight();
 | 
			
		||||
 | 
			
		||||
    CacheBestSize(best);
 | 
			
		||||
    return best;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -194,8 +194,6 @@ wxSize wxCommandLinkButton::DoGetBestSize() const
 | 
			
		||||
    if ( !GetNote().empty() )
 | 
			
		||||
        size.y += MAINLABEL_NOTE_MARGIN;
 | 
			
		||||
 | 
			
		||||
    CacheBestSize(size);
 | 
			
		||||
 | 
			
		||||
    return size;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -539,8 +539,6 @@ wxSize wxToolBar::DoGetBestSize() const
 | 
			
		||||
        sizeBest.y ++;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    CacheBestSize(sizeBest);
 | 
			
		||||
 | 
			
		||||
    return sizeBest;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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 )
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// -----------------------------------------------------------------------
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user