- 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, wxPoint(0, 0), wxSize(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, wxPoint(0, 0), wxSize(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);
+ CreateStatusBar(2);
+
+ // Make a menubar
+ wxMenu *fileMenu = new wxMenu;
+ fileMenu->Append(SPLIT_VERTICAL, _T("Split &Vertically\tCtrl-V"), _T("Split vertically"));
+ fileMenu->Append(SPLIT_HORIZONTAL, _T("Split &Horizontally\tCtrl-H"), _T("Split horizontally"));
+ fileMenu->Append(SPLIT_UNSPLIT, _T("&Unsplit\tCtrl-U"), _T("Unsplit"));
+ fileMenu->AppendSeparator();
+ fileMenu->Append(SPLIT_LIVE, _T("&Live update"), _T("Toggle live update mode"), TRUE);
+ fileMenu->Append(SPLIT_SETMINSIZE, _T("Set &min size"), _T("Set minimum pane size"));
+ fileMenu->AppendSeparator();
+ fileMenu->Append(SPLIT_QUIT, _T("E&xit\tAlt-X"), _T("Exit"));
+
+ wxMenuBar *menuBar = new wxMenuBar;
+ menuBar->Append(fileMenu, _T("&File"));
+
+ SetMenuBar(menuBar);
+
+ menuBar->Check(SPLIT_LIVE, TRUE);
+ m_splitter = new MySplitterWindow(this);
+
+#if 1
+ m_left = new MyCanvas(m_splitter);
+ m_left->SetBackgroundColour(*wxRED);
+ m_left->SetScrollbars(20, 20, 50, 50);
+ m_left->SetCursor(wxCursor(wxCURSOR_MAGNIFIER));
+
+ m_right = new MyCanvas(m_splitter);
+ m_right->SetBackgroundColour(*wxCYAN);
+ m_right->SetScrollbars(20, 20, 50, 50);
+#else // for testing kbd navigation inside the splitter
+ m_left = new wxTextCtrl(m_splitter, -1, _T("first text"));
+ m_right = new wxTextCtrl(m_splitter, -1, _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
+
+ SetStatusText(_T("Min pane size = 0"), 1);