X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b6a158b04e7784dc30ad8fc043eb94ae71c19e4f..e57e26dd03d65ccb816d34b5254398b448e74018:/samples/layout/layout.cpp diff --git a/samples/layout/layout.cpp b/samples/layout/layout.cpp index 6aedb6923f..54c4b3a740 100644 --- a/samples/layout/layout.cpp +++ b/samples/layout/layout.cpp @@ -20,16 +20,16 @@ #include "wx/wx.h" #endif -#if !USE_CONSTRAINTS -#error You must set USE_CONSTRAINTS to 1 in wx_setup.h! +#if !wxUSE_CONSTRAINTS +#error You must set wxUSE_CONSTRAINTS to 1 in setup.h! #endif #include #include "layout.h" // Declare two frames -MyFrame *frame = NULL; -wxMenuBar *menu_bar = NULL; +MyFrame *frame = (MyFrame *) NULL; +wxMenuBar *menu_bar = (wxMenuBar *) NULL; IMPLEMENT_APP(MyApp) @@ -40,7 +40,7 @@ MyApp::MyApp() bool MyApp::OnInit(void) { // Create the main frame window - frame = new MyFrame(NULL, "wxWindows Layout Demo", 0, 0, 550, 500); + frame = new MyFrame((MyFrame *) NULL, (char *) "wxWindows Layout Demo", 0, 0, 550, 500); frame->SetAutoLayout(TRUE); @@ -156,9 +156,9 @@ bool MyApp::OnInit(void) MyFrame::MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h): wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)) { - panel = NULL; - text_window = NULL; - canvas = NULL; + panel = (wxPanel *) NULL; + text_window = (MyTextWindow *) NULL; + canvas = (MyWindow *) NULL; } BEGIN_EVENT_TABLE(MyFrame, wxFrame) @@ -171,8 +171,9 @@ END_EVENT_TABLE() void MyFrame::LoadFile(wxCommandEvent& WXUNUSED(event) ) { - char *s = wxFileSelector("Load text file", NULL, NULL, NULL, "*.txt"); - if (s) + wxString s = wxFileSelector( _T("Load text file"), (const wxChar *) NULL, + (const wxChar *) NULL, (const wxChar *) NULL, _T("*.txt") ); + if (s != "") { #ifdef __WXMSW__ frame->text_window->LoadFile(s); @@ -187,7 +188,7 @@ void MyFrame::Quit(wxCommandEvent& WXUNUSED(event) ) void MyFrame::TestSizers(wxCommandEvent& WXUNUSED(event) ) { - SizerFrame *newFrame = new SizerFrame(NULL, "Sizer Test Frame", 50, 50, 500, 500); + SizerFrame *newFrame = new SizerFrame((MyFrame *) NULL, (char *) "Sizer Test Frame", 50, 50, 500, 500); newFrame->Show(TRUE); } @@ -205,12 +206,12 @@ void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event) ) void MyFrame::Draw(wxDC& dc, bool WXUNUSED(draw_bitmaps) ) { - dc.SetPen(wxGREEN_PEN); + dc.SetPen(* wxGREEN_PEN); dc.DrawLine(0, 0, 200, 200); dc.DrawLine(200, 0, 0, 200); - dc.SetBrush(wxCYAN_BRUSH); - dc.SetPen(wxRED_PEN); + dc.SetBrush(* wxCYAN_BRUSH); + dc.SetPen(* wxRED_PEN); dc.DrawRectangle(100, 100, 100, 50); dc.DrawRoundedRectangle(150, 150, 100, 50, 20); @@ -219,7 +220,7 @@ void MyFrame::Draw(wxDC& dc, bool WXUNUSED(draw_bitmaps) ) dc.DrawSpline(50, 200, 50, 100, 200, 10); dc.DrawLine(50, 230, 200, 230); - dc.SetPen(wxBLACK_PEN); + dc.SetPen(* wxBLACK_PEN); dc.DrawArc(50, 300, 100, 250, 100, 300 ); } @@ -244,14 +245,6 @@ void MyWindow::OnPaint(wxPaintEvent& WXUNUSED(event) ) frame->Draw(dc,TRUE); } -// Define the behaviour for the frame closing -// - must delete all frames except for the main one. -bool MyFrame::OnClose(void) -{ - Show(FALSE); - - return TRUE; -} SizerFrame::SizerFrame(wxFrame *frame, char *title, int x, int y, int w, int h): wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)) @@ -346,10 +339,3 @@ void SizerFrame::OnSize(wxSizeEvent& event) panel->Layout(); } -bool SizerFrame::OnClose(void) -{ - Show(FALSE); - - return TRUE; -} -