X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2153bf897ad0d4a6cdf321eef093123fa4aed8bb..5a349c39a0d074d586add9c0d61f0ecb11d6acf6:/samples/treectrl/treetest.cpp diff --git a/samples/treectrl/treetest.cpp b/samples/treectrl/treetest.cpp index 3fb9a987d3..d140808b4d 100644 --- a/samples/treectrl/treetest.cpp +++ b/samples/treectrl/treetest.cpp @@ -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 @@ -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)) @@ -740,10 +758,6 @@ void MyTreeCtrl::CreateButtonsImageList(int WXUNUSED(size)) #endif } -MyTreeCtrl::~MyTreeCtrl() -{ -} - int MyTreeCtrl::OnCompareItems(const wxTreeItemId& item1, const wxTreeItemId& item2) { @@ -1150,7 +1164,7 @@ void MyTreeCtrl::OnContextMenu(wxContextMenuEvent& event) { //attempt to guess where to show the menu if (item.IsOk()) - { + { //if an item was clicked, show menu to the right of it wxRect rect; GetBoundingRect(item, rect, true); //true = only the label @@ -1166,7 +1180,7 @@ void MyTreeCtrl::OnContextMenu(wxContextMenuEvent& event) //event was generated by mouse, use supplied coords pt = ScreenToClient(pt); } - + ShowMenu(item, pt); }