- CreateStatusBar(2);
-
- // Make a menubar
- fileMenu = new wxMenu;
- fileMenu->Append(SPLIT_VERTICAL, "Split &Vertically\tCtrl-V", "Split vertically");
- fileMenu->Append(SPLIT_HORIZONTAL, "Split &Horizontally\tCtrl-H", "Split horizontally");
- fileMenu->Append(SPLIT_UNSPLIT, "&Unsplit\tCtrl-U", "Unsplit");
- fileMenu->AppendSeparator();
- fileMenu->Append(SPLIT_SETMINSIZE, "Set &min size", "Set minimum pane size");
- fileMenu->AppendSeparator();
- fileMenu->Append(SPLIT_QUIT, "E&xit\tAlt-X", "Exit");
-
- menuBar = new wxMenuBar;
- menuBar->Append(fileMenu, "&File");
-
- 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, "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, "Test2" );
- m_rightCanvas->SetBackgroundColour(*wxCYAN);
- m_rightCanvas->SetScrollbars(20, 20, 50, 50);
- m_rightCanvas->Show(FALSE);
-
- m_splitter->Initialize(m_leftCanvas);
- SetStatusText("Min pane size = 0", 1);
+#if wxUSE_STATUSBAR
+ CreateStatusBar(2);
+#endif // wxUSE_STATUSBAR
+
+ // Make a menubar
+ wxMenu *splitMenu = new wxMenu;
+ splitMenu->Append(SPLIT_VERTICAL,
+ _T("Split &Vertically\tCtrl-V"),
+ _T("Split vertically"));
+ splitMenu->Append(SPLIT_HORIZONTAL,
+ _T("Split &Horizontally\tCtrl-H"),
+ _T("Split horizontally"));
+ splitMenu->Append(SPLIT_UNSPLIT,
+ _T("&Unsplit\tCtrl-U"),
+ _T("Unsplit"));
+ splitMenu->AppendSeparator();
+
+ splitMenu->AppendCheckItem(SPLIT_LIVE,
+ _T("&Live update\tCtrl-L"),
+ _T("Toggle live update mode"));
+ splitMenu->Append(SPLIT_SETPOSITION,
+ _T("Set splitter &position\tCtrl-P"),
+ _T("Set the splitter position"));
+ splitMenu->Append(SPLIT_SETMINSIZE,
+ _T("Set &min size\tCtrl-M"),
+ _T("Set minimum pane size"));
+ splitMenu->Append(SPLIT_SETGRAVITY,
+ _T("Set &gravity\tCtrl-G"),
+ _T("Set gravity of sash"));
+ splitMenu->AppendSeparator();
+
+ splitMenu->Append(SPLIT_REPLACE,
+ _T("&Replace right window"),
+ _T("Replace right window"));
+ splitMenu->AppendSeparator();
+
+ splitMenu->Append(SPLIT_QUIT, _T("E&xit\tAlt-X"), _T("Exit"));
+
+ wxMenuBar *menuBar = new wxMenuBar;
+ menuBar->Append(splitMenu, _T("&Splitter"));
+
+ SetMenuBar(menuBar);
+
+ menuBar->Check(SPLIT_LIVE, true);
+ m_splitter = new MySplitterWindow(this);
+
+ m_splitter->SetSashGravity(1.0);
+
+#if 1
+ m_left = new MyCanvas(m_splitter, true);
+ m_left->SetBackgroundColour(*wxRED);
+ m_left->SetScrollbars(20, 20, 5, 5);
+ m_left->SetCursor(wxCursor(wxCURSOR_MAGNIFIER));
+
+ m_right = new MyCanvas(m_splitter, false);
+ m_right->SetBackgroundColour(*wxCYAN);
+ m_right->SetScrollbars(20, 20, 5, 5);
+#else // for testing kbd navigation inside the splitter
+ m_left = new wxTextCtrl(m_splitter, wxID_ANY, _T("first text"));
+ m_right = new wxTextCtrl(m_splitter, wxID_ANY, _T("second text"));
+#endif
+
+ // you can also do this to start with a single window
+#if 0
+ m_right->Show(false);
+ m_splitter->Initialize(m_left);
+#else
+ // you can also try -100
+ m_splitter->SplitVertically(m_left, m_right, 100);
+#endif
+
+#if wxUSE_STATUSBAR
+ SetStatusText(_T("Min pane size = 0"), 1);
+#endif // wxUSE_STATUSBAR
+
+ m_replacewindow = (wxWindow *)0;