X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0d559d69c8115c8aaabba70f37d49b4effbc2ab2..0b8410f3ca10414c7c4eda5a89015bdaab78c15c:/samples/splitter/test.cpp diff --git a/samples/splitter/test.cpp b/samples/splitter/test.cpp index 33a25ed12a..d443b1ad67 100644 --- a/samples/splitter/test.cpp +++ b/samples/splitter/test.cpp @@ -35,7 +35,8 @@ public: class MySplitterWindow : public wxSplitterWindow { public: - MySplitterWindow(wxFrame *parent, wxWindowID id) : wxSplitterWindow(parent, id) + MySplitterWindow(wxFrame *parent, wxWindowID id) + : wxSplitterWindow(parent, id, wxDefaultPosition, wxDefaultSize, wxSP_3D | wxSP_LIVE_UPDATE) { m_frame = parent; } @@ -46,7 +47,7 @@ public: return FALSE; wxString str; - str.Printf("Sash position = %d", newSashPosition); + str.Printf( _T("Sash position = %d"), newSashPosition); m_frame->SetStatusText(str); return TRUE; @@ -62,8 +63,6 @@ public: MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos, const wxSize& size); virtual ~MyFrame(); - bool OnClose(); - // Menu commands void SplitHorizontal(wxCommandEvent& event); void SplitVertical(wxCommandEvent& event); @@ -91,7 +90,7 @@ DECLARE_EVENT_TABLE() class MyCanvas: public wxScrolledWindow { public: - MyCanvas(wxWindow* parent, wxWindowID id, int x, int y, int w, int h); + MyCanvas(wxWindow* parent, wxWindowID id, int x, int y, int w, int h, const wxString &name); virtual ~MyCanvas(); virtual void OnDraw(wxDC& dc); @@ -167,12 +166,16 @@ MyFrame::MyFrame(wxFrame* frame, const wxString& title, const wxPoint& pos, cons SetMenuBar(menuBar); m_splitter = new MySplitterWindow(this, SPLITTER_WINDOW); + + wxSize sz( m_splitter->GetSize() ); + wxLogMessage( "Initial splitter size: %d %d\n", (int)sz.x, (int)sz.y ); - m_leftCanvas = new MyCanvas(m_splitter, CANVAS1, 0, 0, 400, 400); + m_leftCanvas = new MyCanvas(m_splitter, CANVAS1, 0, 0, 400, 400, "Test1" ); m_leftCanvas->SetBackgroundColour(*wxRED); m_leftCanvas->SetScrollbars(20, 20, 50, 50); + m_leftCanvas->SetCursor(wxCursor(wxCURSOR_MAGNIFIER)); - m_rightCanvas = new MyCanvas(m_splitter, CANVAS2, 0, 0, 400, 400); + m_rightCanvas = new MyCanvas(m_splitter, CANVAS2, 0, 0, 400, 400, "Test2" ); m_rightCanvas->SetBackgroundColour(*wxCYAN); m_rightCanvas->SetScrollbars(20, 20, 50, 50); m_rightCanvas->Show(FALSE); @@ -185,11 +188,6 @@ MyFrame::~MyFrame() { } -bool MyFrame::OnClose() -{ - return TRUE; -} - void MyFrame::Quit(wxCommandEvent& WXUNUSED(event) ) { Close(TRUE); @@ -225,14 +223,14 @@ void MyFrame::Unsplit(wxCommandEvent& WXUNUSED(event) ) void MyFrame::SetMinSize(wxCommandEvent& WXUNUSED(event) ) { wxString str; - str.Printf("%d", m_splitter->GetMinimumPaneSize()); + str.Printf( _T("%d"), m_splitter->GetMinimumPaneSize()); str = wxGetTextFromUser("Enter minimal size for panes:", "", str, this); if ( str.IsEmpty() ) return; - int minsize = atoi(str); + int minsize = wxStrtol( str, (wxChar**)NULL, 10 ); m_splitter->SetMinimumPaneSize(minsize); - str.Printf("Min pane size = %d", minsize); + str.Printf( _T("Min pane size = %d"), minsize); SetStatusText(str, 1); } @@ -254,12 +252,12 @@ void MyFrame::UpdateUIUnsplit(wxUpdateUIEvent& event) void MyFrame::UpdatePosition() { wxString str; - str.Printf("Sash position = %d", m_splitter->GetSashPosition()); + str.Printf( _("Sash position = %d"), m_splitter->GetSashPosition()); SetStatusText(str); } -MyCanvas::MyCanvas(wxWindow* parent, wxWindowID id, int x, int y, int w, int h) : - wxScrolledWindow(parent, id, wxPoint(x, y), wxSize(w, h)) +MyCanvas::MyCanvas(wxWindow* parent, wxWindowID id, int x, int y, int w, int h, const wxString &name ) : + wxScrolledWindow(parent, id, wxPoint(x, y), wxSize(w, h), 0, name ) { }