]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/doctempl.tex
Applied patch [ 1747059 ] wxAUIDefaultTabArt wxAUI_NB_BOTTOM
[wxWidgets.git] / docs / latex / wx / doctempl.tex
1 \section{\class{wxDocTemplate}}\label{wxdoctemplate}
2
3 The wxDocTemplate class is used to model the relationship between a
4 document class and a view class.
5
6 \wxheading{Derived from}
7
8 \helpref{wxObject}{wxobject}
9
10 \wxheading{Include files}
11
12 <wx/docview.h>
13
14 \wxheading{Library}
15
16 \helpref{wxCore}{librarieslist}
17
18 \wxheading{See also}
19
20 \helpref{wxDocTemplate overview}{wxdoctemplateoverview}, \helpref{wxDocument}{wxdocument}, \helpref{wxView}{wxview}
21
22 \latexignore{\rtfignore{\wxheading{Members}}}
23
24 \membersection{wxDocTemplate::m\_defaultExt}\label{wxdoctemplatemdefaultext}
25
26 \member{wxString}{m\_defaultExt}
27
28 The default extension for files of this type.
29
30 \membersection{wxDocTemplate::m\_description}\label{wxdoctemplatemdescription}
31
32 \member{wxString}{m\_description}
33
34 A short description of this template.
35
36 \membersection{wxDocTemplate::m\_directory}\label{wxdoctemplatemdirectory}
37
38 \member{wxString}{m\_directory}
39
40 The default directory for files of this type.
41
42 \membersection{wxDocTemplate::m\_docClassInfo}\label{wxdoctemplatemdocclassinfo}
43
44 \member{wxClassInfo* }{m\_docClassInfo}
45
46 Run-time class information that allows document instances to be constructed dynamically.
47
48 \membersection{wxDocTemplate::m\_docTypeName}\label{wxdoctemplatemdoctypename}
49
50 \member{wxString}{m\_docTypeName}
51
52 The named type of the document associated with this template.
53
54 \membersection{wxDocTemplate::m\_documentManager}\label{wxdoctemplatedocumentmanager}
55
56 \member{wxDocTemplate*}{m\_documentManager}
57
58 A pointer to the document manager for which this template was created.
59
60 \membersection{wxDocTemplate::m\_fileFilter}\label{wxdoctemplatemfilefilter}
61
62 \member{wxString}{m\_fileFilter}
63
64 The file filter (such as {\tt *.txt}) to be used in file selector dialogs.
65
66 \membersection{wxDocTemplate::m\_flags}\label{wxdoctemplatemflags}
67
68 \member{long}{m\_flags}
69
70 The flags passed to the constructor.
71
72 \membersection{wxDocTemplate::m\_viewClassInfo}\label{wxdoctemplatemviewclassinfo}
73
74 \member{wxClassInfo*}{m\_viewClassInfo}
75
76 Run-time class information that allows view instances to be constructed dynamically.
77
78 \membersection{wxDocTemplate::m\_viewTypeName}\label{wxdoctemplatemviewtypename}
79
80 \member{wxString}{m\_viewTypeName}
81
82 The named type of the view associated with this template.
83
84 \membersection{wxDocTemplate::wxDocTemplate}\label{wxdoctemplatector}
85
86 \func{}{wxDocTemplate}{\param{wxDocManager* }{manager}, \param{const wxString\& }{descr}, \param{const wxString\& }{filter},
87 \param{const wxString\& }{dir}, \param{const wxString\& }{ext}, \param{const wxString\& }{docTypeName},
88 \param{const wxString\& }{viewTypeName}, \param{wxClassInfo* }{docClassInfo = NULL},
89 \param{wxClassInfo* }{viewClassInfo = NULL}, \param{long}{ flags = wxDEFAULT\_TEMPLATE\_FLAGS}}
90
91 Constructor. Create instances dynamically near the start of your application after creating
92 a wxDocManager instance, and before doing any document or view operations.
93
94 {\it manager} is the document manager object which manages this template.
95
96 {\it descr} is a short description of what the template is for. This string will be displayed in the
97 file filter list of Windows file selectors.
98
99 {\it filter} is an appropriate file filter such as {\tt *.txt}.
100
101 {\it dir} is the default directory to use for file selectors.
102
103 {\it ext} is the default file extension (such as txt).
104
105 {\it docTypeName} is a name that should be unique for a given type of document, used for
106 gathering a list of views relevant to a particular document.
107
108 {\it viewTypeName} is a name that should be unique for a given view.
109
110 {\it docClassInfo} is a pointer to the run-time document class information as returned
111 by the CLASSINFO macro, e.g. CLASSINFO(MyDocumentClass). If this is not supplied,
112 you will need to derive a new wxDocTemplate class and override the CreateDocument
113 member to return a new document instance on demand.
114
115 {\it viewClassInfo} is a pointer to the run-time view class information as returned
116 by the CLASSINFO macro, e.g. CLASSINFO(MyViewClass). If this is not supplied,
117 you will need to derive a new wxDocTemplate class and override the CreateView
118 member to return a new view instance on demand.
119
120 {\it flags} is a bit list of the following:
121
122 \begin{itemize}\itemsep=0pt
123 \item wxTEMPLATE\_VISIBLE The template may be displayed to the user in dialogs.
124 \item wxTEMPLATE\_INVISIBLE The template may not be displayed to the user in dialogs.
125 \item wxDEFAULT\_TEMPLATE\_FLAGS Defined as wxTEMPLATE\_VISIBLE.
126 \end{itemize}
127
128 \perlnote{In wxPerl {\tt docClassInfo} and {\tt viewClassInfo} can be
129 either {\tt Wx::ClassInfo} objects or strings which contain the name
130 of the perl packages which are to be used as {\tt Wx::Document} and
131 {\tt Wx::View} classes (they must have a constructor named {\tt
132 new}):
133
134 \indented{2cm}{\begin{twocollist}
135 \twocolitem{{\bf Wx::DocTemplate->new( docmgr, descr, filter, dir,
136 ext, docTypeName, viewTypeName, docClassInfo, viewClassInfo, flags
137 )}}{ will construct document and view objects from the class information}
138 \twocolitem{{\bf Wx::DocTemplate->new( docmgr, descr, filter, dir,
139 ext, docTypeName, viewTypeName, docClassName, viewClassName, flags
140 )}}{ will construct document and view objects from perl packages}
141 \twocolitem{{\bf Wx::DocTemplate->new( docmgr, descr, filter, dir,
142 ext, docTypeName, viewTypeName )}}{
143 {\tt Wx::DocTemplate::CreateDocument()} and
144 {\tt Wx::DocTemplate::CreateView()} must be overridden}
145 \end{twocollist}}}
146
147 \membersection{wxDocTemplate::\destruct{wxDocTemplate}}\label{wxdoctemplatedtor}
148
149 \func{void}{\destruct{wxDocTemplate}}{\void}
150
151 Destructor.
152
153 \membersection{wxDocTemplate::CreateDocument}\label{wxdoctemplatecreatedocument}
154
155 \func{wxDocument *}{CreateDocument}{\param{const wxString\& }{path}, \param{long}{ flags = 0}}
156
157 Creates a new instance of the associated document class. If you have not supplied
158 a wxClassInfo parameter to the template constructor, you will need to override this
159 function to return an appropriate document instance.
160
161 This function calls wxDocTemplate::InitDocument which in turns
162 calls wxDocument::OnCreate.
163
164 \membersection{wxDocTemplate::CreateView}\label{wxdoctemplatecreateview}
165
166 \func{wxView *}{CreateView}{\param{wxDocument *}{doc}, \param{long}{ flags = 0}}
167
168 Creates a new instance of the associated view class. If you have not supplied
169 a wxClassInfo parameter to the template constructor, you will need to override this
170 function to return an appropriate view instance.
171
172 \membersection{wxDocTemplate::GetDefaultExtension}\label{wxdoctemplategetdefaultextension}
173
174 \func{wxString}{GetDefaultExtension}{\void}
175
176 Returns the default file extension for the document data, as passed to the document template constructor.
177
178 \membersection{wxDocTemplate::GetDescription}\label{wxdoctemplategetdescription}
179
180 \func{wxString}{GetDescription}{\void}
181
182 Returns the text description of this template, as passed to the document template constructor.
183
184 \membersection{wxDocTemplate::GetDirectory}\label{wxdoctemplategetdirectory}
185
186 \func{wxString}{GetDirectory}{\void}
187
188 Returns the default directory, as passed to the document template constructor.
189
190 \membersection{wxDocTemplate::GetDocumentManager}\label{wxdoctemplategetdocumentmanager}
191
192 \func{wxDocManager *}{GetDocumentManager}{\void}
193
194 Returns a pointer to the document manager instance for which this template was created.
195
196 \membersection{wxDocTemplate::GetDocumentName}\label{wxdoctemplategetdocumentname}
197
198 \func{wxString}{GetDocumentName}{\void}
199
200 Returns the document type name, as passed to the document template constructor.
201
202 \membersection{wxDocTemplate::GetFileFilter}\label{wxdoctemplategetfilefilter}
203
204 \func{wxString}{GetFileFilter}{\void}
205
206 Returns the file filter, as passed to the document template constructor.
207
208 \membersection{wxDocTemplate::GetFlags}\label{wxdoctemplategetflags}
209
210 \func{long}{GetFlags}{\void}
211
212 Returns the flags, as passed to the document template constructor.
213
214 \membersection{wxDocTemplate::GetViewName}\label{wxdoctemplategetviewname}
215
216 \func{wxString}{GetViewName}{\void}
217
218 Returns the view type name, as passed to the document template constructor.
219
220 \membersection{wxDocTemplate::InitDocument}\label{wxdoctemplateinitdocument}
221
222 \func{bool}{InitDocument}{\param{wxDocument* }{doc}, \param{const wxString\& }{path}, \param{long}{ flags = 0}}
223
224 Initialises the document, calling wxDocument::OnCreate. This is called from
225 wxDocTemplate::CreateDocument.
226
227 \membersection{wxDocTemplate::IsVisible}\label{wxdoctemplateisvisible}
228
229 \func{bool}{IsVisible}{\void}
230
231 Returns true if the document template can be shown in user dialogs, false otherwise.
232
233 \membersection{wxDocTemplate::SetDefaultExtension}\label{wxdoctemplatesetdefaultextension}
234
235 \func{void}{SetDefaultExtension}{\param{const wxString\& }{ext}}
236
237 Sets the default file extension.
238
239 \membersection{wxDocTemplate::SetDescription}\label{wxdoctemplatesetdescription}
240
241 \func{void}{SetDescription}{\param{const wxString\& }{descr}}
242
243 Sets the template description.
244
245 \membersection{wxDocTemplate::SetDirectory}\label{wxdoctemplatesetdirectory}
246
247 \func{void}{SetDirectory}{\param{const wxString\& }{dir}}
248
249 Sets the default directory.
250
251 \membersection{wxDocTemplate::SetDocumentManager}\label{wxdoctemplatesetdocumentmanager}
252
253 \func{void}{SetDocumentManager}{\param{wxDocManager *}{manager}}
254
255 Sets the pointer to the document manager instance for which this template was created.
256 Should not be called by the application.
257
258 \membersection{wxDocTemplate::SetFileFilter}\label{wxdoctemplatesetfilefilter}
259
260 \func{void}{SetFileFilter}{\param{const wxString\& }{filter}}
261
262 Sets the file filter.
263
264 \membersection{wxDocTemplate::SetFlags}\label{wxdoctemplatesetflags}
265
266 \func{void}{SetFlags}{\param{long }{flags}}
267
268 Sets the internal document template flags (see the constructor description for more details).
269