]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/docprfrm.tex
added null pointer check and assert
[wxWidgets.git] / docs / latex / wx / docprfrm.tex
1 \section{\class{wxDocParentFrame}}\label{wxdocparentframe}
2
3 The wxDocParentFrame class provides a default top-level frame for
4 applications using the document/view framework. This class can only be used for SDI (not MDI) parent frames.
5
6 It cooperates with the \helpref{wxView}{wxview}, \helpref{wxDocument}{wxdocument},
7 \rtfsp\helpref{wxDocManager}{wxdocmanager} and \helpref{wxDocTemplates}{wxdoctemplate} classes.
8
9 See the example application in {\tt samples/docview}.
10
11 \wxheading{Derived from}
12
13 \helpref{wxFrame}{wxframe}\\
14 \helpref{wxTopLevelWindow}{wxtoplevelwindow}\\
15 \helpref{wxWindow}{wxwindow}\\
16 \helpref{wxEvtHandler}{wxevthandler}\\
17 \helpref{wxObject}{wxobject}
18
19 \wxheading{Include files}
20
21 <wx/docview.h>
22
23 \wxheading{Library}
24
25 \helpref{wxCore}{librarieslist}
26
27 \wxheading{See also}
28
29 \helpref{Document/view overview}{docviewoverview}, \helpref{wxFrame}{wxframe}
30
31 \latexignore{\rtfignore{\wxheading{Members}}}
32
33 \membersection{wxDocParentFrame::wxDocParentFrame}\label{wxdocparentframector}
34
35 \func{}{wxDocParentFrame}{\void}
36
37 Default constructor.
38
39 \func{}{wxDocParentFrame}{\param{wxDocManager*}{ manager}, \param{wxFrame *}{parent}, \param{wxWindowID}{ id},
40 \param{const wxString\& }{title}, \param{const wxPoint\&}{ pos = wxDefaultPosition},
41 \param{const wxSize\&}{ size = wxDefaultSize},
42 \param{long}{ style = wxDEFAULT\_FRAME\_STYLE}, \param{const wxString\& }{name = "frame"}}
43
44 Constructor.
45
46 \membersection{wxDocParentFrame::\destruct{wxDocParentFrame}}\label{wxdocparentframedtor}
47
48 \func{}{\destruct{wxDocParentFrame}}{\void}
49
50 Destructor.
51
52 \membersection{wxDocParentFrame::Create}\label{wxdocparentframecreate}
53
54 \func{bool}{Create}{\param{wxDocManager*}{ manager}, \param{wxFrame *}{parent}, \param{wxWindowID}{ id},
55 \param{const wxString\& }{title}, \param{const wxPoint\&}{ pos = wxDefaultPosition},
56 \param{const wxSize\&}{ size = wxDefaultSize},
57 \param{long}{ style = wxDEFAULT\_FRAME\_STYLE}, \param{const wxString\& }{name = "frame"}}
58
59 Used in two-step construction.
60
61 \membersection{wxDocParentFrame::GetDocumentManager}\label{wxdocparentframegetdocumentmanager}
62
63 \constfunc{wxDocManager *}{GetDocumentManager}{\void}
64
65 Returns the associated \helpref{document manager object}{wxdocmanager}.
66
67
68
69 \membersection{wxDocParentFrame::OnCloseWindow}\label{wxdocparentframeonclosewindow}
70
71 \func{void}{OnCloseWindow}{\param{wxCloseEvent\&}{ event}}
72
73 Deletes all views and documents. If no user input cancelled the
74 operation, the frame will be destroyed and the application will exit.
75
76 Since understanding how document/view clean-up takes place can be difficult,
77 the implementation of this function is shown below.
78
79 \begin{verbatim}
80 void wxDocParentFrame::OnCloseWindow(wxCloseEvent& event)
81 {
82 if (m_docManager->Clear(!event.CanVeto()))
83 {
84 this->Destroy();
85 }
86 else
87 event.Veto();
88 }
89 \end{verbatim}
90