+ 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->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