Improved search text control height and position on Windows.

Was previously much too tall (regression from 3.0).


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77880 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2014-09-24 12:52:54 +00:00
parent c7ca903834
commit 550b039d6c

View File

@ -126,7 +126,15 @@ protected:
wxSearchTextCtrl* const self = const_cast<wxSearchTextCtrl*>(this);
self->SetWindowStyleFlag((flags & ~wxBORDER_MASK) | wxBORDER_DEFAULT);
const wxSize size = wxTextCtrl::DoGetBestSize();
wxSize size = wxTextCtrl::DoGetBestSize();
// The calculation for no external borders in wxTextCtrl::DoGetSizeFromTextSize also
// removes any padding around the value, which is wrong for this situation. So we
// can't use wxBORDER_NONE to calculate a good height, in which case we just have to
// assume a border in the code above and then subtract the space that would be taken up
// by a themed border (the thin blue border and the white internal border).
size.y -= 4;
self->SetWindowStyleFlag(flags);
return size;
@ -515,7 +523,17 @@ void wxSearchCtrl::LayoutControls()
x += sizeSearch.x;
x += searchMargin;
m_text->SetSize(x, 0, textWidth, height);
#ifdef __WXMSW__
// The text control is too high up on Windows; normally a text control looks OK because
// of the white border that's part of the theme border. We can also remove a pixel from
// the height to fit the text control in, because the padding in EDIT_HEIGHT_FROM_CHAR_HEIGHT
// is already generous.
int textY = 1;
#else
int textY = 0;
#endif
m_text->SetSize(x, textY, textWidth, height-textY);
x += textWidth;
x += cancelMargin;