Don't use confusing variable name in wxMSW wxSpinCtrl code

Another small refactoring after 05b980aba1,
avoid using "effectiveBtnWidth" variable as the effective button width is
actually always its real width, it's just the text effective width that is
smaller due to the overlap.

See #12297.
This commit is contained in:
Vadim Zeitlin
2017-02-20 15:20:16 +01:00
parent 618c752541
commit 2b7248c444

View File

@@ -345,18 +345,17 @@ bool wxSpinCtrl::Create(wxWindow *parent,
// finally deal with the size, now that both windows are created and the
// font is set
const wxSize sizeBtn = wxSpinButton::DoGetBestSize();
const int effectiveBtnWidth = sizeBtn.x - GetOverlap();
wxSize sizeCtrl(size);
if ( sizeCtrl.x <= 0 )
{
// DEFAULT_ITEM_WIDTH is the default width for the text control
sizeCtrl.x = FromDIP(DEFAULT_ITEM_WIDTH) + effectiveBtnWidth;
sizeCtrl.x = FromDIP(DEFAULT_ITEM_WIDTH) + sizeBtn.x - GetOverlap();
}
else if ( sizeCtrl.x <= effectiveBtnWidth )
else if ( sizeCtrl.x <= sizeBtn.x )
{
wxLogDebug(wxS("wxSpinCtrl \"%s\": initial width %d is too small, ")
wxS("at least %d pixels needed."),
name, size.x, effectiveBtnWidth);
name, size.x, sizeBtn.x);
}
// adjust an invalid height for text control