]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{wxSplitterWindow overview}\label{wxsplitterwindowoverview} |
2 | ||
3 | Classes: \helpref{wxSplitterWindow}{wxsplitterwindow} | |
4 | ||
7e81ff23 | 5 | The following screenshot shows the appearance of a splitter window with a horizontal split. |
a660d684 KB |
6 | |
7 | $$\image{8cm;0cm}{splitter.eps}$$ | |
8 | ||
9 | The style wxSP\_3D has been used to show a 3D border and 3D sash. | |
10 | ||
6d06e061 | 11 | \subsection{Example}\label{wxsplitterwindowexample} |
a660d684 KB |
12 | |
13 | The following fragment shows how to create a splitter window, creating two | |
14 | subwindows and hiding one of them. | |
15 | ||
16 | {\small | |
17 | \begin{verbatim} | |
fe604ccd | 18 | splitter = new wxSplitterWindow(this, -1, wxPoint(0, 0), wxSize(400, 400), wxSP_3D); |
a660d684 | 19 | |
fe604ccd JS |
20 | leftWindow = new MyWindow(splitter); |
21 | leftWindow->SetScrollbars(20, 20, 50, 50); | |
a660d684 | 22 | |
fe604ccd JS |
23 | rightWindow = new MyWindow(splitter); |
24 | rightWindow->SetScrollbars(20, 20, 50, 50); | |
cc81d32f | 25 | rightWindow->Show(false); |
a660d684 | 26 | |
fe604ccd | 27 | splitter->Initialize(leftWindow); |
a660d684 KB |
28 | |
29 | // Set this to prevent unsplitting | |
30 | // splitter->SetMinimumPaneSize(20); | |
31 | \end{verbatim} | |
32 | } | |
33 | ||
34 | The next fragment shows how the splitter window can be manipulated after creation. | |
35 | ||
36 | {\small | |
37 | \begin{verbatim} | |
38 | void MyFrame::OnSplitVertical(wxCommandEvent& event) | |
39 | { | |
40 | if ( splitter->IsSplit() ) | |
41 | splitter->Unsplit(); | |
cc81d32f VS |
42 | leftWindow->Show(true); |
43 | rightWindow->Show(true); | |
fe604ccd | 44 | splitter->SplitVertically( leftWindow, rightWindow ); |
a660d684 KB |
45 | } |
46 | ||
47 | void MyFrame::OnSplitHorizontal(wxCommandEvent& event) | |
48 | { | |
49 | if ( splitter->IsSplit() ) | |
50 | splitter->Unsplit(); | |
cc81d32f VS |
51 | leftWindow->Show(true); |
52 | rightWindow->Show(true); | |
fe604ccd | 53 | splitter->SplitHorizontally( leftWindow, rightWindow ); |
a660d684 KB |
54 | } |
55 | ||
56 | void MyFrame::OnUnsplit(wxCommandEvent& event) | |
57 | { | |
58 | if ( splitter->IsSplit() ) | |
59 | splitter->Unsplit(); | |
60 | } | |
61 | \end{verbatim} | |
62 | } | |
63 |