- c->top.Below (frame->m_treeCtrl);
- c->left.SameAs (frame, wxLeft);
- c->right.SameAs (frame, wxRight);
- c->bottom.SameAs (frame, wxBottom);
- frame->m_logWindow->SetConstraints(c);
- frame->SetAutoLayout(TRUE);
-
- frame->m_treeCtrl->SetImageList(wxGetApp().m_imageListNormal, wxIMAGE_LIST_NORMAL);
-
- wxTreeItemId rootId = frame->m_treeCtrl->AddRoot("Root", 0);
-
- char buf[20];
- int i;
- wxString str;
-
- for ( i = 0; i < 10; i++)
- {
- sprintf(buf, "Folder child %d", i);
- str = buf;
- 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->AppendItem(id, str, 1);
- }
- }
- for ( i = 0; i < 10; i++)
- {
- sprintf(buf, "File child %d", i);
- str = buf;
- frame->m_treeCtrl->AppendItem(rootId, str, 1);
- }
-
- frame->CreateStatusBar(3);
- frame->SetStatusText("", 0);
-
- // Show the frame
- frame->Show(TRUE);
-
- SetTopWindow(frame);
-
- return TRUE;
-}
-
-// My frame constructor
-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 = (MyTreeCtrl *) NULL;
- m_logWindow = (wxTextCtrl *) NULL;
+ c->top.Below(m_treeCtrl);
+ c->left.SameAs(this, wxLeft);
+ c->right.SameAs(this, wxRight);
+ c->bottom.SameAs(this, wxBottom);
+ textCtrl->SetConstraints(c);
+ SetAutoLayout(TRUE);
+
+ // create a status bar with 3 panes
+ CreateStatusBar(3);
+ SetStatusText("", 0);
+
+#ifdef __WXMOTIF__
+ // For some reason, we get a memcpy crash in wxLogStream::DoLogStream
+ // on gcc/wxMotif, if we use wxLogTextCtl. Maybe it's just gcc?
+ delete wxLog::SetActiveTarget(new wxLogStderr);
+#else
+ // set our text control as the log target
+ wxLogTextCtrl *logWindow = new wxLogTextCtrl(textCtrl);
+ delete wxLog::SetActiveTarget(logWindow);
+#endif