- 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);
+ SetIcon(wxICON(sample));
+
+#if wxUSE_STATUSBAR
+ CreateStatusBar(2);
+#endif // wxUSE_STATUSBAR
+
+ // Make a menubar
+ wxMenu *splitMenu = new wxMenu;
+ splitMenu->Append(SPLIT_VERTICAL,
+ wxT("Split &Vertically\tCtrl-V"),
+ wxT("Split vertically"));
+ splitMenu->Append(SPLIT_HORIZONTAL,
+ wxT("Split &Horizontally\tCtrl-H"),
+ wxT("Split horizontally"));
+ splitMenu->Append(SPLIT_UNSPLIT,
+ wxT("&Unsplit\tCtrl-U"),
+ wxT("Unsplit"));
+ splitMenu->AppendCheckItem(SPLIT_INVISIBLE,
+ wxT("Toggle sash &invisibility\tCtrl-I"),
+ wxT("Toggle sash invisibility"));
+ splitMenu->AppendSeparator();
+
+ splitMenu->AppendCheckItem(SPLIT_LIVE,
+ wxT("&Live update\tCtrl-L"),
+ wxT("Toggle live update mode"));
+ splitMenu->AppendCheckItem(SPLIT_BORDER,
+ wxT("3D &Border"),
+ wxT("Toggle wxSP_BORDER flag"));
+ splitMenu->Check(SPLIT_BORDER, true);
+ splitMenu->AppendCheckItem(SPLIT_3DSASH,
+ wxT("&3D Sash"),
+ wxT("Toggle wxSP_3DSASH flag"));
+ splitMenu->Check(SPLIT_3DSASH, true);
+ splitMenu->Append(SPLIT_SETPOSITION,
+ wxT("Set splitter &position\tCtrl-P"),
+ wxT("Set the splitter position"));
+ splitMenu->Append(SPLIT_SETMINSIZE,
+ wxT("Set &min size\tCtrl-M"),
+ wxT("Set minimum pane size"));
+ splitMenu->Append(SPLIT_SETGRAVITY,
+ wxT("Set &gravity\tCtrl-G"),
+ wxT("Set gravity of sash"));
+ splitMenu->AppendSeparator();
+
+ splitMenu->Append(SPLIT_REPLACE,
+ wxT("&Replace right window"),
+ wxT("Replace right window"));
+ splitMenu->AppendSeparator();
+
+ splitMenu->Append(SPLIT_QUIT, wxT("E&xit\tAlt-X"), wxT("Exit"));
+
+ wxMenuBar *menuBar = new wxMenuBar;
+ menuBar->Append(splitMenu, wxT("&Splitter"));
+
+ SetMenuBar(menuBar);
+
+ menuBar->Check(SPLIT_LIVE, true);
+ m_splitter = new MySplitterWindow(this);
+
+ // If you use non-zero gravity you must initialize the splitter with its
+ // correct initial size, otherwise it will change the sash position by a
+ // huge amount when it's resized from its initial default size to its real
+ // size when the frame lays it out. This wouldn't be necessary if default
+ // zero gravity were used (although it would do no harm neither).
+ m_splitter->SetSize(GetClientSize());
+ 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, wxT("first text"));
+ m_right = new wxTextCtrl(m_splitter, wxID_ANY, wxT("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(wxT("Min pane size = 0"), 1);
+#endif // wxUSE_STATUSBAR
+
+ m_replacewindow = NULL;