X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/820893d0d41b94b22dada287355ad27489c21721..1a6a83472414db1b9f3baa4eecac6d7bd4182c7c:/contrib/samples/deprecated/treelay/treelay.cpp diff --git a/contrib/samples/deprecated/treelay/treelay.cpp b/contrib/samples/deprecated/treelay/treelay.cpp index 9b1df20bcf..a4f00f7782 100644 --- a/contrib/samples/deprecated/treelay/treelay.cpp +++ b/contrib/samples/deprecated/treelay/treelay.cpp @@ -2,7 +2,7 @@ // Name: treelay.cpp // Purpose: wxTreeLayout sample // Author: Julian Smart -// Modified by: +// Modified by: // Created: 7/4/98 // RCS-ID: $Id$ // Copyright: (c) 1998 Julian Smart @@ -20,7 +20,13 @@ #include "wx/wx.h" #endif -#include "wx/treelay.h" +#include "wx/deprecated/setup.h" + +#if !wxUSE_TREELAYOUT +#error Please set wxUSE_TREELAYOUT to 1 in contrib/include/wx/deprecated/setup.h and recompile. +#endif + +#include "wx/deprecated/treelay.h" #include "treelay.h" @@ -35,10 +41,12 @@ IMPLEMENT_APP(MyApp) bool MyApp::OnInit() { // Create the main frame window - MyFrame* frame = new MyFrame(NULL, _T("Tree Test"), wxPoint(-1, -1), wxSize(400, 550)); + MyFrame* frame = new MyFrame(NULL, _T("Tree Test"), wxDefaultPosition, wxSize(400, 550)); +#if wxUSE_STATUSBAR // Give it a status line frame->CreateStatusBar(2); +#endif // wxUSE_STATUSBAR // Give it an icon #ifdef __WINDOWS__ @@ -77,12 +85,14 @@ bool MyApp::OnInit() dc.SetFont(font); TreeTest(*myTree, dc); - frame->Show(TRUE); + frame->Show(true); +#if wxUSE_STATUSBAR frame->SetStatusText(_T("Hello, tree!")); +#endif // wxUSE_STATUSBAR // Return the main frame window - return TRUE; + return true; } int MyApp::OnExit() @@ -99,7 +109,7 @@ int MyApp::OnExit() void MyApp::TreeTest(wxTreeLayoutStored& tree, wxDC& dc) { tree.Initialize(200); - + tree.AddChild(_T("animal")); tree.AddChild(_T("mammal"), _T("animal")); tree.AddChild(_T("insect"), _T("animal")); @@ -142,20 +152,20 @@ END_EVENT_TABLE() // Define my frame constructor MyFrame::MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size): - wxFrame(parent, -1, title, pos, size) + wxFrame(parent, wxID_ANY, title, pos, size) { } -void MyFrame::OnQuit(wxCommandEvent& event) +void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { - Close(TRUE); + Close(true); } -void MyFrame::OnLeftRight(wxCommandEvent& event) +void MyFrame::OnLeftRight(wxCommandEvent& WXUNUSED(event)) { if (myTree) { - myTree->SetOrientation(FALSE); + myTree->SetOrientation(false); wxClientDC dc(canvas); wxFont font(10, wxROMAN, wxNORMAL, wxBOLD); dc.SetFont(font); @@ -164,11 +174,11 @@ void MyFrame::OnLeftRight(wxCommandEvent& event) } } -void MyFrame::OnTopBottom(wxCommandEvent& event) +void MyFrame::OnTopBottom(wxCommandEvent& WXUNUSED(event)) { if (myTree) { - myTree->SetOrientation(TRUE); + myTree->SetOrientation(true); wxClientDC dc(canvas); wxFont font(10, wxROMAN, wxNORMAL, wxBOLD); dc.SetFont(font); @@ -177,12 +187,12 @@ void MyFrame::OnTopBottom(wxCommandEvent& event) } } -void MyFrame::OnAbout(wxCommandEvent& event) +void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { - (void)wxMessageBox(_T("wxWindows tree library demo Vsn 2.0\nAuthor: Julian Smart (c) 1998"), _T("About tree test")); + (void)wxMessageBox(_T("wxWidgets tree library demo Vsn 2.0\nAuthor: Julian Smart (c) 1998"), _T("About tree test")); } -void MyFrame::OnCloseWindow(wxCloseEvent& event) +void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) { Destroy(); } @@ -193,13 +203,13 @@ END_EVENT_TABLE() // Define a constructor for my canvas MyCanvas::MyCanvas(wxWindow *parent): - wxScrolledWindow(parent, -1) + wxScrolledWindow(parent, wxID_ANY) { SetBackgroundColour(*wxWHITE); } // Define the repainting behaviour -void MyCanvas::OnPaint(wxPaintEvent& event) +void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); PrepareDC(dc);