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