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