Make wxComboCtrl a wxCompositeWindow
wxComboCtrl consists of several controls (text entry, button, popup) and therefore should be implemented as a wxCompositeWindow to prevent problems with generating spurious events when e.g. focus is transferred between the sub-controls. Closes #18394.
This commit is contained in:
@@ -1535,37 +1535,6 @@ 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 )
|
||||
@@ -2748,6 +2717,16 @@ 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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user