Revert making wxComboCtrl a wxCompositeWindow

Commit 70e9dbd756 has fixed #18394 but unfortunately it also caused several other issues observed e.g. in #18540. Apparently wxComboCtrl doesn't fit well to the wxCompositeWindow framework -  especially when wxCB_READONLY flag is set and there is no main editor control what is problematic for wxCompositeWindow implementation. At the moment it is more pragmatic to go back to the original wxComboCtrl concept as a plain compound control to fix the regression and try to fix #18394 in an alternative way.

Closes #18540.
See #18394.
This commit is contained in:
Artur Wieczorek
2019-11-07 20:44:14 +01:00
parent 79794cd415
commit 6b00cc80f1
2 changed files with 38 additions and 15 deletions

View File

@@ -1535,6 +1535,37 @@ bool wxComboCtrlBase::SetFont ( const wxFont& font )
return true;
}
#if wxUSE_TOOLTIPS
void wxComboCtrlBase::DoSetToolTip(wxToolTip *tooltip)
{
wxControl::DoSetToolTip(tooltip);
// Set tool tip for button and text box
if ( tooltip )
{
const wxString &tip = tooltip->GetTip();
if ( m_text ) m_text->SetToolTip(tip);
if ( m_btn ) m_btn->SetToolTip(tip);
}
else
{
if ( m_text ) m_text->SetToolTip( NULL );
if ( m_btn ) m_btn->SetToolTip( NULL );
}
}
#endif // wxUSE_TOOLTIPS
bool wxComboCtrlBase::SetForegroundColour(const wxColour& colour)
{
if ( wxControl::SetForegroundColour(colour) )
{
if ( m_text )
m_text->SetForegroundColour(colour);
return true;
}
return false;
}
bool wxComboCtrlBase::SetBackgroundColour(const wxColour& colour)
{
if ( m_text )
@@ -2717,16 +2748,6 @@ void wxComboCtrlBase::SetTextCtrlStyle( int style )
m_text->SetWindowStyle(style);
}
wxWindowList wxComboCtrlBase::GetCompositeWindowParts() const
{
wxWindowList parts;
if ( m_text )
parts.push_back(m_text);
if ( m_btn )
parts.push_back(m_btn);
return parts;
}
// ----------------------------------------------------------------------------
// wxTextEntry interface
// ----------------------------------------------------------------------------