#include "wx/wx.h"
#endif
-#ifdef __WXGTK__
-#include "mondrian.xpm"
+#ifndef __WXMSW__
+ #include "icon1.xpm"
+ #include "icon2.xpm"
+ #include "mondrian.xpm"
#endif
#include "wx/treectrl.h"
IMPLEMENT_APP(MyApp)
// `Main program' equivalent, creating windows and returning main app frame
-bool MyApp::OnInit(void)
+bool MyApp::OnInit()
{
// Create the main frame window
- MyFrame *frame = new MyFrame(NULL, "wxTreeCtrl Test", 50, 50, 450, 340);
+ MyFrame *frame = new MyFrame((wxFrame *) NULL, (char *) "wxTreeCtrl Test", 50, 50, 450, 340);
// This reduces flicker effects - even better would be to define OnEraseBackground
// to do nothing. When the tree control's scrollbars are show or hidden, the
frame->SetBackgroundColour(wxColour(255, 255, 255));
// Give it an icon
-#ifdef __WXMSW__
- frame->SetIcon(wxIcon("mondrian"));
-#else
- frame->SetIcon(wxIcon(mondrian_xpm));
-#endif
+ frame->SetIcon(wxICON(mondrian));
// Make an image list containing small icons
m_imageListNormal = new wxImageList(16, 16, TRUE);
-#ifdef __WXMSW__
- wxIcon icon1("icon1", wxBITMAP_TYPE_ICO_RESOURCE);
- m_imageListNormal->Add(icon1);
- wxIcon icon2("icon2", wxBITMAP_TYPE_ICO_RESOURCE);
- m_imageListNormal->Add(icon2);
-#else
-#endif
+ m_imageListNormal->Add(wxICON(icon1));
+ m_imageListNormal->Add(wxICON(icon2));
// Make a menubar
wxMenu *file_menu = new wxMenu;
frame->m_treeCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL);
- long rootId = frame->m_treeCtrl->InsertItem(0, "Root", 0);
+ wxTreeItemId rootId = frame->m_treeCtrl->AddRoot("Root", 0);
char buf[20];
int i;
{
sprintf(buf, "Folder child %d", i);
str = buf;
- long id = frame->m_treeCtrl->InsertItem(rootId, str, 0);
+ wxTreeItemId id = frame->m_treeCtrl->AppendItem(rootId, str, 0);
int j;
for ( j = 0; j < 5; j++)
{
sprintf(buf, "File child %d", j);
str = buf;
- frame->m_treeCtrl->InsertItem(id, str, 1);
+ frame->m_treeCtrl->AppendItem(id, str, 1);
}
}
for ( i = 0; i < 10; i++)
{
sprintf(buf, "File child %d", i);
str = buf;
- frame->m_treeCtrl->InsertItem(rootId, str, 1);
+ frame->m_treeCtrl->AppendItem(rootId, str, 1);
}
frame->CreateStatusBar(3);
MyFrame::MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h):
wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h))
{
- m_treeCtrl = NULL;
- m_logWindow = NULL;
+ m_treeCtrl = (MyTreeCtrl *) NULL;
+ m_logWindow = (wxTextCtrl *) NULL;
}
-MyFrame::~MyFrame(void)
+MyFrame::~MyFrame()
{
delete wxGetApp().m_imageListNormal;
}