[ 1493802 ] Allow multiple wxComboCtrl::SetPopupControl calls.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39311 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2006-05-24 09:29:06 +00:00
parent 9eddec696f
commit 7ca4ac6383
3 changed files with 36 additions and 14 deletions

View File

@@ -774,15 +774,7 @@ wxComboCtrlBase::~wxComboCtrlBase()
m_toplevEvtHandler = (wxEvtHandler*) NULL;
#endif
if ( m_popup )
m_popup->RemoveEventHandler(m_popupExtraHandler);
delete m_popupExtraHandler;
HidePopup();
delete m_popupInterface;
delete m_winPopup;
DestroyPopup();
RemoveEventHandler(m_extraEvtHandler);
@@ -1531,19 +1523,38 @@ void wxComboCtrlBase::CreatePopup()
popupInterface->m_iFlags |= wxCP_IFLAG_CREATED;
}
// Destroy popup window and the child control
void wxComboCtrlBase::DestroyPopup()
{
if ( m_popup )
m_popup->RemoveEventHandler(m_popupExtraHandler);
delete m_popupExtraHandler;
HidePopup();
delete m_popupInterface;
if ( m_winPopup )
m_winPopup->Destroy();
m_popupInterface = (wxComboPopup*) NULL;
m_winPopup = (wxWindow*) NULL;
m_popup = (wxWindow*) NULL;
}
void wxComboCtrlBase::SetPopupControl( wxComboPopup* iface )
{
wxCHECK_RET( iface, wxT("no popup interface set for wxComboCtrl") );
delete m_popupInterface;
delete m_winPopup;
DestroyPopup();
iface->InitBase(this);
iface->Init();
m_popupInterface = iface;
if ( !iface->LazyCreate() || m_winPopup )
if ( !iface->LazyCreate() )
{
CreatePopup();
}