#include "wx/dataview.h"
#include "wx/spinctrl.h"
+#include "wx/ptr_shrd.h"
+#include "wx/vector.h"
+
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
};
-
#define DEFAULT_ALIGN wxALIGN_LEFT
#define DATAVIEW_DEFAULT_STYLE (wxDV_MULTIPLE|wxDV_HORIZ_RULES|wxDV_VERT_RULES)
-
// -------------------------------------
// MyMusicModel
// -------------------------------------
wxT("German Requiem"), wxT("Johannes Brahms"), 1868 ) );
m_classicalMusicIsKnownToControl = false;
}
+
+ ~MyMusicModel()
+ {
+ delete m_root;
+ }
// helper method for wxLog
{
public:
MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int h);
+ ~MyFrame();
public:
void OnQuit(wxCommandEvent& event);
wxBoxSizer *bottom_sizer = new wxBoxSizer( wxHORIZONTAL );
- m_log = new wxTextCtrl( this, -1,wxString(), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
+ m_log = new wxTextCtrl( this, -1, wxString(), wxDefaultPosition, wxSize(100,200), wxTE_MULTILINE );
m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_log));
wxLogMessage(_("This is the log window"));
// wxDataViewTreeStore
wxDataViewCtrl *treectrl = new wxDataViewCtrl( this, -1,
- wxDefaultPosition, wxSize(300,200), wxDV_NO_HEADER );
+ wxDefaultPosition, wxSize(100,200), wxDV_NO_HEADER );
wxDataViewTreeStore *store = new wxDataViewTreeStore;
wxDataViewItem parent = store->AppendContainer( wxDataViewItem(0),wxT("Root 1"), wxIcon(small1_xpm) );
wxDataViewItem child = store->AppendItem( parent,wxT("Child 1"), wxIcon(small1_xpm) );
child = store->AppendItem( parent,wxT("Child 2"), wxIcon(small1_xpm) );
- child = store->AppendItem( parent,wxT("Child 3"), wxIcon(small1_xpm) );
+ child = store->AppendItem( parent,wxT("Child 3, very long, long, long, long"), wxIcon(small1_xpm) );
treectrl->AssociateModel( store );
store->DecRef();
- treectrl->AppendIconTextColumn(wxT("no label"), 0, wxDATAVIEW_CELL_INERT, 200 );
+ treectrl->AppendIconTextColumn(wxT("no label"), 0, wxDATAVIEW_CELL_INERT, -1 );
- bottom_sizer->Add( treectrl );
+ bottom_sizer->Add( treectrl, 1 );
// wxDataViewTreeCtrl
- wxDataViewTreeCtrl *treectrl2 = new wxDataViewTreeCtrl( this, -1, wxDefaultPosition, wxSize(300,200) );
+ wxDataViewTreeCtrl *treectrl2 = new wxDataViewTreeCtrl( this, -1, wxDefaultPosition, wxSize(100,200) );
wxImageList *ilist = new wxImageList( 16, 16 );
ilist->Add( wxIcon(small1_xpm) );
parent = treectrl2->AppendContainer( wxDataViewItem(0),wxT("Root 1"), 0 );
child = treectrl2->AppendItem( parent,wxT("Child 1"), 0 );
child = treectrl2->AppendItem( parent,wxT("Child 2"), 0 );
- child = treectrl2->AppendItem( parent,wxT("Child 3"), 0 );
-
- bottom_sizer->Add( treectrl2 );
+ child = treectrl2->AppendItem( parent,wxT("Child 3, very long, long, long, long"), 0 );
+
+ bottom_sizer->Add( treectrl2, 1 );
// main sizer
SetSizer( main_sizer );
}
+MyFrame::~MyFrame()
+{
+ delete wxLog::SetActiveTarget(m_logOld);
+}
+
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event) )
{
Close(true);