]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/tsplittr.tex
Added newline for PDF RTF
[wxWidgets.git] / docs / latex / wx / tsplittr.tex
1 \section{wxSplitterWindow overview}\label{wxsplitterwindowoverview}
2
3 Classes: \helpref{wxSplitterWindow}{wxsplitterwindow}
4
5 The following screenshot shows the appearance of a splitter window with a horizontal split.
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
11 \subsection{Example}\label{wxsplitterwindowexample}
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}
18 splitter = new wxSplitterWindow(this, -1, wxPoint(0, 0), wxSize(400, 400), wxSP_3D);
19
20 leftWindow = new MyWindow(splitter);
21 leftWindow->SetScrollbars(20, 20, 50, 50);
22
23 rightWindow = new MyWindow(splitter);
24 rightWindow->SetScrollbars(20, 20, 50, 50);
25 rightWindow->Show(false);
26
27 splitter->Initialize(leftWindow);
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();
42 leftWindow->Show(true);
43 rightWindow->Show(true);
44 splitter->SplitVertically( leftWindow, rightWindow );
45 }
46
47 void MyFrame::OnSplitHorizontal(wxCommandEvent& event)
48 {
49 if ( splitter->IsSplit() )
50 splitter->Unsplit();
51 leftWindow->Show(true);
52 rightWindow->Show(true);
53 splitter->SplitHorizontally( leftWindow, rightWindow );
54 }
55
56 void MyFrame::OnUnsplit(wxCommandEvent& event)
57 {
58 if ( splitter->IsSplit() )
59 splitter->Unsplit();
60 }
61 \end{verbatim}
62 }
63