Create model and column in wxDataViewTreeCtrl::Create(), not ctor.

Old code created the tree model and its unique built-in column only in
wxDataViewTreeCtrl ctor but not in Create(), meaning that the behaviour was
very different depending on whether you used base class ctor call or Create()
in a derived class. This was confusing and completely inconsistent with wx API
in which using the default ctor and Create() is supposed to always have
exactly the same effect as using non-default ctor so change this to create the
model in Create() so that it's always done.

Slightly update the documentation and also add wxDataViewTreeCtrl::Init() for
consistency.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62498 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-10-24 21:41:44 +00:00
parent bf68a18d3c
commit 43c64cc6c9
3 changed files with 66 additions and 56 deletions

View File

@@ -1327,17 +1327,27 @@ public:
class WXDLLIMPEXP_ADV wxDataViewTreeCtrl: public wxDataViewCtrl
{
public:
wxDataViewTreeCtrl();
wxDataViewTreeCtrl( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxDV_NO_HEADER | wxDV_ROW_LINES,
const wxValidator& validator = wxDefaultValidator );
~wxDataViewTreeCtrl();
wxDataViewTreeCtrl() { Init(); }
wxDataViewTreeCtrl(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDV_NO_HEADER | wxDV_ROW_LINES,
const wxValidator& validator = wxDefaultValidator)
{
Init();
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxDV_NO_HEADER | wxDV_ROW_LINES,
const wxValidator& validator = wxDefaultValidator );
Create(parent, id, pos, size, style, validator);
}
virtual ~wxDataViewTreeCtrl();
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDV_NO_HEADER | wxDV_ROW_LINES,
const wxValidator& validator = wxDefaultValidator);
wxDataViewTreeStore *GetStore()
{ return (wxDataViewTreeStore*) GetModel(); }
@@ -1392,7 +1402,12 @@ public:
void OnSize( wxSizeEvent &event );
private:
wxImageList *m_imageList;
void Init()
{
m_imageList = NULL;
}
wxImageList *m_imageList;
private:
DECLARE_EVENT_TABLE()