Use TEXTCTRL_BORDER_SIZE symbolic constant in wxTextCtrl code
This is more readable than hardcoded 5. No real changes.
This commit is contained in:
@@ -43,6 +43,8 @@
|
|||||||
|
|
||||||
#include "wx/osx/private.h"
|
#include "wx/osx/private.h"
|
||||||
|
|
||||||
|
static const int TEXTCTRL_BORDER_SIZE = 5;
|
||||||
|
|
||||||
wxBEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase)
|
wxBEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase)
|
||||||
EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
|
EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
|
||||||
EVT_CHAR(wxTextCtrl::OnChar)
|
EVT_CHAR(wxTextCtrl::OnChar)
|
||||||
@@ -199,28 +201,31 @@ wxSize wxTextCtrl::DoGetBestSize() const
|
|||||||
|
|
||||||
if ( hText == - 1)
|
if ( hText == - 1)
|
||||||
{
|
{
|
||||||
// these are the numbers from the HIG:
|
|
||||||
// we reduce them by the borders first
|
|
||||||
wText = 100 ;
|
wText = 100 ;
|
||||||
|
|
||||||
|
// these are the numbers from the HIG:
|
||||||
switch ( m_windowVariant )
|
switch ( m_windowVariant )
|
||||||
{
|
{
|
||||||
case wxWINDOW_VARIANT_NORMAL :
|
case wxWINDOW_VARIANT_NORMAL :
|
||||||
hText = 22 - 5 ;
|
hText = 22;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case wxWINDOW_VARIANT_SMALL :
|
case wxWINDOW_VARIANT_SMALL :
|
||||||
hText = 19 - 5 ;
|
hText = 19;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case wxWINDOW_VARIANT_MINI :
|
case wxWINDOW_VARIANT_MINI :
|
||||||
hText = 15 - 5 ;
|
hText = 15;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
hText = 22 - 5;
|
hText = 22;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the numbers above include the border size, so subtract it before
|
||||||
|
// possibly adding it back below
|
||||||
|
hText -= TEXTCTRL_BORDER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// as the above numbers have some free space around the text
|
// as the above numbers have some free space around the text
|
||||||
@@ -229,7 +234,7 @@ wxSize wxTextCtrl::DoGetBestSize() const
|
|||||||
hText *= 5 ;
|
hText *= 5 ;
|
||||||
|
|
||||||
if ( !HasFlag(wxNO_BORDER) )
|
if ( !HasFlag(wxNO_BORDER) )
|
||||||
hText += 5 ;
|
hText += TEXTCTRL_BORDER_SIZE ;
|
||||||
|
|
||||||
return wxSize(wText, hText);
|
return wxSize(wText, hText);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user