Remeasure magic values for wxTextCtrl's border width on wxOSX/Cocoa
Measured on macOS Catalina. Also implements GetSizeFromTextSize
This commit is contained in:
parent
edc553870f
commit
dad9a02a40
@ -139,6 +139,7 @@ protected:
|
||||
void Init();
|
||||
|
||||
virtual wxSize DoGetBestSize() const wxOVERRIDE;
|
||||
virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen) const wxOVERRIDE;
|
||||
|
||||
// flag is set to true when the user edits the controls contents
|
||||
bool m_dirty;
|
||||
|
@ -206,19 +206,19 @@ wxSize wxTextCtrl::DoGetBestSize() const
|
||||
switch ( m_windowVariant )
|
||||
{
|
||||
case wxWINDOW_VARIANT_NORMAL :
|
||||
hText = 22 - 6 ;
|
||||
hText = 22 - 5 ;
|
||||
break ;
|
||||
|
||||
case wxWINDOW_VARIANT_SMALL :
|
||||
hText = 19 - 6 ;
|
||||
hText = 19 - 5 ;
|
||||
break ;
|
||||
|
||||
case wxWINDOW_VARIANT_MINI :
|
||||
hText = 15 - 6 ;
|
||||
hText = 15 - 5 ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
hText = 22 - 6;
|
||||
hText = 22 - 5;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
@ -229,11 +229,19 @@ wxSize wxTextCtrl::DoGetBestSize() const
|
||||
hText *= 5 ;
|
||||
|
||||
if ( !HasFlag(wxNO_BORDER) )
|
||||
hText += 6 ;
|
||||
hText += 5 ;
|
||||
|
||||
return wxSize(wText, hText);
|
||||
}
|
||||
|
||||
wxSize wxTextCtrl::DoGetSizeFromTextSize(int xlen, int ylen) const
|
||||
{
|
||||
wxSize size = wxDefaultSize;
|
||||
if (xlen > 0) size.SetWidth(HasFlag(wxNO_BORDER) ? xlen + 4 : xlen + 9);
|
||||
if (ylen > 0) size.SetHeight(HasFlag(wxNO_BORDER) ? ylen + 2 : ylen + 7);
|
||||
return size;
|
||||
}
|
||||
|
||||
bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
|
||||
{
|
||||
return GetTextPeer()->GetStyle(position, style);
|
||||
|
Loading…
Reference in New Issue
Block a user