]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/treectrl/treetest.cpp
reSWIGged
[wxWidgets.git] / samples / treectrl / treetest.cpp
index 4b6f7d7ef3a48a7bce230022ec0e583a06cd381c..6ab96a4285cfb2720c604c97d1a461bfded326f7 100644 (file)
@@ -165,7 +165,10 @@ bool MyApp::OnInit()
 // My frame constructor
 MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
        : wxFrame((wxFrame *)NULL, wxID_ANY, title, wxPoint(x, y), wxSize(w, h)),
-         m_treeCtrl(NULL), m_textCtrl(NULL)
+         m_treeCtrl(NULL)
+#if wxUSE_LOG
+         , m_textCtrl(NULL)
+#endif // wxUSE_LOG
 {
     // This reduces flicker effects - even better would be to define
     // OnEraseBackground to do nothing. When the tree control's scrollbars are
@@ -186,20 +189,20 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
     file_menu->AppendSeparator();
     file_menu->Append(TreeTest_Quit, wxT("E&xit\tAlt-X"));
 
-    style_menu->Append(TreeTest_TogButtons, wxT("Toggle &normal buttons"), wxT(""), true);
-    style_menu->Append(TreeTest_TogTwist, wxT("Toggle &twister buttons"), wxT(""), true);
-    style_menu->Append(TreeTest_ToggleButtons, wxT("Toggle image &buttons"), wxT(""), true);
+    style_menu->AppendCheckItem(TreeTest_TogButtons, wxT("Toggle &normal buttons"));
+    style_menu->AppendCheckItem(TreeTest_TogTwist, wxT("Toggle &twister buttons"));
+    style_menu->AppendCheckItem(TreeTest_ToggleButtons, wxT("Toggle image &buttons"));
     style_menu->AppendSeparator();
-    style_menu->Append(TreeTest_TogLines, wxT("Toggle &connecting lines"), wxT(""), true);
-    style_menu->Append(TreeTest_TogRootLines, wxT("Toggle &lines at root"), wxT(""), true);
-    style_menu->Append(TreeTest_TogHideRoot, wxT("Toggle &hidden root"), wxT(""), true);
-    style_menu->Append(TreeTest_TogBorder, wxT("Toggle &item border"), wxT(""), true);
-    style_menu->Append(TreeTest_TogFullHighlight, wxT("Toggle &full row highlight"), wxT(""), true);
-    style_menu->Append(TreeTest_TogEdit, wxT("Toggle &edit mode"), wxT(""), true);
+    style_menu->AppendCheckItem(TreeTest_TogLines, wxT("Toggle &connecting lines"));
+    style_menu->AppendCheckItem(TreeTest_TogRootLines, wxT("Toggle &lines at root"));
+    style_menu->AppendCheckItem(TreeTest_TogHideRoot, wxT("Toggle &hidden root"));
+    style_menu->AppendCheckItem(TreeTest_TogBorder, wxT("Toggle &item border"));
+    style_menu->AppendCheckItem(TreeTest_TogFullHighlight, wxT("Toggle &full row highlight"));
+    style_menu->AppendCheckItem(TreeTest_TogEdit, wxT("Toggle &edit mode"));
 #ifndef NO_MULTIPLE_SELECTION
-    style_menu->Append(TreeTest_ToggleSel, wxT("Toggle &selection mode"), wxT(""), true);
+    style_menu->AppendCheckItem(TreeTest_ToggleSel, wxT("Toggle &selection mode"));
 #endif // NO_MULTIPLE_SELECTION
-    style_menu->Append(TreeTest_ToggleImages, wxT("Toggle show ima&ges"), wxT(""), true);
+    style_menu->AppendCheckItem(TreeTest_ToggleImages, wxT("Toggle show ima&ges"));
     style_menu->Append(TreeTest_SetImageSize, wxT("Set image si&ze..."));
     style_menu->AppendSeparator();
     style_menu->Append(TreeTest_SetFgColour, wxT("Set &foreground colour..."));
@@ -255,10 +258,12 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
     SetMenuBar(menu_bar);
 #endif // wxUSE_MENUS
 
+#if wxUSE_LOG
     // create the controls
     m_textCtrl = new wxTextCtrl(this, wxID_ANY, wxT(""),
                                 wxDefaultPosition, wxDefaultSize,
                                 wxTE_MULTILINE | wxSUNKEN_BORDER);
+#endif // wxUSE_LOG
 
     CreateTreeWithDefStyle();
 
@@ -269,6 +274,7 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
     CreateStatusBar(2);
 #endif // wxUSE_STATUSBAR
 
+#if wxUSE_LOG
 #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?
@@ -278,11 +284,14 @@ MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h)
     wxLogTextCtrl *logWindow = new wxLogTextCtrl(m_textCtrl);
     delete wxLog::SetActiveTarget(logWindow);
 #endif
+#endif // wxUSE_LOG
 }
 
 MyFrame::~MyFrame()
 {
+#if wxUSE_LOG
     delete wxLog::SetActiveTarget(NULL);
+#endif // wxUSE_LOG
 }
 
 void MyFrame::CreateTreeWithDefStyle()
@@ -354,7 +363,11 @@ void MyFrame::OnIdle(wxIdleEvent& event)
 
 void MyFrame::OnSize(wxSizeEvent& event)
 {
-    if ( m_treeCtrl && m_textCtrl )
+    if ( m_treeCtrl 
+#if wxUSE_LOG
+                    && m_textCtrl 
+#endif // wxUSE_LOG
+                                  )
     {
         Resize();
     }
@@ -365,8 +378,13 @@ void MyFrame::OnSize(wxSizeEvent& event)
 void MyFrame::Resize()
 {
     wxSize size = GetClientSize();
-    m_treeCtrl->SetSize(0, 0, size.x, 2*size.y/3);
+    m_treeCtrl->SetSize(0, 0, size.x, size.y
+#if !wxUSE_LOG
+                                            );
+#else
+                                            *2/3);
     m_textCtrl->SetSize(0, 2*size.y/3, size.x, size.y/3);
+#endif
 }
 
 void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))