no changes, just refactor the code to avoid having the same code for m_textCtrl destruction in 4 places
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53830 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -446,6 +446,9 @@ private:
|
|||||||
// UpdateStyle()), only should be called if InReportView()
|
// UpdateStyle()), only should be called if InReportView()
|
||||||
void MSWSetExListStyles();
|
void MSWSetExListStyles();
|
||||||
|
|
||||||
|
// destroy m_textCtrl if it's currently valid and reset it to NULL
|
||||||
|
void DeleteEditControl();
|
||||||
|
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxListCtrl)
|
DECLARE_DYNAMIC_CLASS(wxListCtrl)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@@ -488,10 +488,8 @@ void wxListCtrl::FreeAllInternalData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxListCtrl::~wxListCtrl()
|
void wxListCtrl::DeleteEditControl()
|
||||||
{
|
{
|
||||||
FreeAllInternalData();
|
|
||||||
|
|
||||||
if ( m_textCtrl )
|
if ( m_textCtrl )
|
||||||
{
|
{
|
||||||
m_textCtrl->UnsubclassWin();
|
m_textCtrl->UnsubclassWin();
|
||||||
@@ -499,6 +497,13 @@ wxListCtrl::~wxListCtrl()
|
|||||||
delete m_textCtrl;
|
delete m_textCtrl;
|
||||||
m_textCtrl = NULL;
|
m_textCtrl = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wxListCtrl::~wxListCtrl()
|
||||||
|
{
|
||||||
|
FreeAllInternalData();
|
||||||
|
|
||||||
|
DeleteEditControl();
|
||||||
|
|
||||||
if (m_ownsImageListNormal)
|
if (m_ownsImageListNormal)
|
||||||
delete m_imageListNormal;
|
delete m_imageListNormal;
|
||||||
@@ -1465,12 +1470,7 @@ wxTextCtrl* wxListCtrl::EditLabel(long item, wxClassInfo* textControlClass)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// [re]create the text control wrapping the HWND we got
|
// [re]create the text control wrapping the HWND we got
|
||||||
if ( m_textCtrl )
|
DeleteEditControl();
|
||||||
{
|
|
||||||
m_textCtrl->UnsubclassWin();
|
|
||||||
m_textCtrl->SetHWND(0);
|
|
||||||
delete m_textCtrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_textCtrl = (wxTextCtrl *)textControlClass->CreateObject();
|
m_textCtrl = (wxTextCtrl *)textControlClass->CreateObject();
|
||||||
m_textCtrl->SetHWND(hWnd);
|
m_textCtrl->SetHWND(hWnd);
|
||||||
@@ -2093,16 +2093,9 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
|||||||
const LV_ITEM& lvi = (LV_ITEM)item;
|
const LV_ITEM& lvi = (LV_ITEM)item;
|
||||||
if ( !lvi.pszText || lvi.iItem == -1 )
|
if ( !lvi.pszText || lvi.iItem == -1 )
|
||||||
{
|
{
|
||||||
// don't keep a stale wxTextCtrl around
|
// EDIT control will be deleted by the list control
|
||||||
if ( m_textCtrl )
|
// itself so prevent us from deleting it as well
|
||||||
{
|
DeleteEditControl();
|
||||||
// EDIT control will be deleted by the list control itself so
|
|
||||||
// prevent us from deleting it as well
|
|
||||||
m_textCtrl->UnsubclassWin();
|
|
||||||
m_textCtrl->SetHWND(0);
|
|
||||||
delete m_textCtrl;
|
|
||||||
m_textCtrl = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
event.SetEditCanceled(true);
|
event.SetEditCanceled(true);
|
||||||
}
|
}
|
||||||
@@ -2475,16 +2468,9 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
|||||||
// logic here is inverted compared to all the other messages
|
// logic here is inverted compared to all the other messages
|
||||||
*result = event.IsAllowed();
|
*result = event.IsAllowed();
|
||||||
|
|
||||||
// don't keep a stale wxTextCtrl around
|
|
||||||
if ( m_textCtrl )
|
|
||||||
{
|
|
||||||
// EDIT control will be deleted by the list control itself so
|
// EDIT control will be deleted by the list control itself so
|
||||||
// prevent us from deleting it as well
|
// prevent us from deleting it as well
|
||||||
m_textCtrl->UnsubclassWin();
|
DeleteEditControl();
|
||||||
m_textCtrl->SetHWND(0);
|
|
||||||
delete m_textCtrl;
|
|
||||||
m_textCtrl = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user