X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2e992e06a71d90f1df597441af36f69ef390089a..b098b62129781c0158ffa531a6de2aa9524d18bf:/src/common/combocmn.cpp diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index 7f613330e3..aef6c75cbf 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -62,6 +62,7 @@ #if defined(__WXMSW__) #define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform) +#define TEXTCTRL_TEXT_CENTERED 0 // 1 if text in textctrl is vertically centered //#undef wxUSE_POPUPWIN //#define wxUSE_POPUPWIN 0 @@ -69,14 +70,17 @@ #elif defined(__WXGTK__) #define USE_TRANSIENT_POPUP 1 // Use wxPopupWindowTransient (preferred, if it works properly on platform) +#define TEXTCTRL_TEXT_CENTERED 1 // 1 if text in textctrl is vertically centered #elif defined(__WXMAC__) #define USE_TRANSIENT_POPUP 0 // Use wxPopupWindowTransient (preferred, if it works properly on platform) +#define TEXTCTRL_TEXT_CENTERED 1 // 1 if text in textctrl is vertically centered #else #define USE_TRANSIENT_POPUP 0 // Use wxPopupWindowTransient (preferred, if it works properly on platform) +#define TEXTCTRL_TEXT_CENTERED 1 // 1 if text in textctrl is vertically centered #endif @@ -697,6 +701,9 @@ wxComboCtrlBase::CreateTextCtrl(int style, const wxValidator& validator) { if ( !(m_windowStyle & wxCB_READONLY) ) { + if ( m_text ) + m_text->Destroy(); + // wxTE_PROCESS_TAB is needed because on Windows, wxTAB_TRAVERSAL is // not used by the wxPropertyGrid and therefore the tab is processed by // looking at ancestors to see if they have wxTAB_TRAVERSAL. The @@ -879,6 +886,7 @@ void wxComboCtrlBase::PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust wxSize sz = GetClientSize(); int customBorder = m_widthCustomBorder; +#if !TEXTCTRL_TEXT_CENTERED if ( (m_text->GetWindowStyleFlag() & wxBORDER_MASK) == wxNO_BORDER ) { // Centre textctrl @@ -905,11 +913,16 @@ void wxComboCtrlBase::PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust } } else +#else + wxUnusedVar(textCtrlXAdjust); + wxUnusedVar(textCtrlYAdjust); +#endif { - m_text->SetSize( m_tcArea.x, - 0, - sz.x - m_btnArea.x - m_widthCustomPaint - customBorder, - sz.y ); + // If it has border, have textctrl will the entire text field. + m_text->SetSize( m_tcArea.x + m_widthCustomPaint, + customBorder, + sz.x - m_btnArea.width - m_widthCustomPaint - customBorder, + sz.y-(customBorder*2) ); } }