Make wxTreeListEvent dynamically creatable.

This is unfortunately required by wxEvent::Clone() support unit test so
provide the default ctor in this class even though it doesn't make any sense
in normal use.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69619 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2011-10-31 19:41:06 +00:00
parent 824216af78
commit f81ccc1148
2 changed files with 14 additions and 5 deletions

View File

@ -456,6 +456,9 @@ private:
class wxTreeListEvent : public wxNotifyEvent
{
public:
// Default ctor is provided for wxRTTI needs only but should never be used.
wxTreeListEvent() { Init(); }
// The item affected by the event. Valid for all events except
// column-specific ones such as COLUMN_SORTED.
wxTreeListItem GetItem() const { return m_item; }
@ -470,6 +473,14 @@ public:
virtual wxEvent* Clone() const { return new wxTreeListEvent(*this); }
private:
// Common part of all ctors.
void Init()
{
m_column = static_cast<unsigned>(-1);
m_oldCheckedState = wxCHK_UNDETERMINED;
}
// Ctor is private, only wxTreeListCtrl can create events of this type.
wxTreeListEvent(wxEventType evtType,
wxTreeListCtrl* treelist,
@ -479,9 +490,7 @@ private:
{
SetEventObject(treelist);
m_column = static_cast<unsigned>(-1);
m_oldCheckedState = wxCHK_UNDETERMINED;
Init();
}
// Set the checkbox state before this event for ITEM_CHECKED events.
@ -505,7 +514,7 @@ private:
friend class wxTreeListCtrl;
wxDECLARE_ABSTRACT_CLASS(wxTreeListEvent);
wxDECLARE_DYNAMIC_CLASS(wxTreeListEvent);
};
// Event types and event table macros.

View File

@ -1654,7 +1654,7 @@ wxWindow* wxTreeListCtrl::GetView() const
// wxTreeListEvent implementation
// ============================================================================
wxIMPLEMENT_ABSTRACT_CLASS(wxTreeListEvent, wxNotifyEvent)
wxIMPLEMENT_DYNAMIC_CLASS(wxTreeListEvent, wxNotifyEvent)
#define wxDEFINE_TREELIST_EVENT(name) \
wxDEFINE_EVENT(wxEVT_COMMAND_TREELIST_##name, wxTreeListEvent)