1 \section{\class{wxDocTemplate
}}\label{wxdoctemplate
}
3 The wxDocTemplate class is used to model the relationship between a
4 document class and a view class.
6 \wxheading{Derived from
}
8 \helpref{wxObject
}{wxobject
}
10 \wxheading{Include files
}
16 \helpref{wxCore
}{librarieslist
}
20 \helpref{wxDocTemplate overview
}{wxdoctemplateoverview
},
\helpref{wxDocument
}{wxdocument
},
\helpref{wxView
}{wxview
}
22 \latexignore{\rtfignore{\wxheading{Members
}}}
24 \membersection{wxDocTemplate::m
\_defaultExt}\label{wxdoctemplatemdefaultext
}
26 \member{wxString
}{m
\_defaultExt}
28 The default extension for files of this type.
30 \membersection{wxDocTemplate::m
\_description}\label{wxdoctemplatemdescription
}
32 \member{wxString
}{m
\_description}
34 A short description of this template.
36 \membersection{wxDocTemplate::m
\_directory}\label{wxdoctemplatemdirectory
}
38 \member{wxString
}{m
\_directory}
40 The default directory for files of this type.
42 \membersection{wxDocTemplate::m
\_docClassInfo}\label{wxdoctemplatemdocclassinfo
}
44 \member{wxClassInfo*
}{m
\_docClassInfo}
46 Run-time class information that allows
document instances to be constructed dynamically.
48 \membersection{wxDocTemplate::m
\_docTypeName}\label{wxdoctemplatemdoctypename
}
50 \member{wxString
}{m
\_docTypeName}
52 The named type of the
document associated with this template.
54 \membersection{wxDocTemplate::m
\_documentManager}\label{wxdoctemplatedocumentmanager
}
56 \member{wxDocTemplate*
}{m
\_documentManager}
58 A pointer to the
document manager for which this template was created.
60 \membersection{wxDocTemplate::m
\_fileFilter}\label{wxdoctemplatemfilefilter
}
62 \member{wxString
}{m
\_fileFilter}
64 The file filter (such as
{\tt *.txt
}) to be used in file selector dialogs.
66 \membersection{wxDocTemplate::m
\_flags}\label{wxdoctemplatemflags
}
68 \member{long
}{m
\_flags}
70 The flags passed to the constructor.
72 \membersection{wxDocTemplate::m
\_viewClassInfo}\label{wxdoctemplatemviewclassinfo
}
74 \member{wxClassInfo*
}{m
\_viewClassInfo}
76 Run-time class information that allows view instances to be constructed dynamically.
78 \membersection{wxDocTemplate::m
\_viewTypeName}\label{wxdoctemplatemviewtypename
}
80 \member{wxString
}{m
\_viewTypeName}
82 The named type of the view associated with this template.
84 \membersection{wxDocTemplate::wxDocTemplate
}\label{wxdoctemplatector
}
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}}
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.
94 {\it manager
} is the
document manager object which manages this template.
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.
99 {\it filter
} is an appropriate file filter such as
{\tt *.txt
}.
101 {\it dir
} is the default directory to use for file selectors.
103 {\it ext
} is the default file extension (such as txt).
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.
108 {\it viewTypeName
} is a name that should be unique for a given view.
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.
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.
120 {\it flags
} is a bit list of the following:
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.
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
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
}
147 \membersection{wxDocTemplate::
\destruct{wxDocTemplate
}}\label{wxdoctemplatedtor
}
149 \func{void
}{\destruct{wxDocTemplate
}}{\void}
153 \membersection{wxDocTemplate::CreateDocument
}\label{wxdoctemplatecreatedocument
}
155 \func{wxDocument *
}{CreateDocument
}{\param{const wxString\&
}{path
},
\param{long
}{ flags =
0}}
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.
161 This function calls wxDocTemplate::InitDocument which in turns
162 calls wxDocument::OnCreate.
164 \membersection{wxDocTemplate::CreateView
}\label{wxdoctemplatecreateview
}
166 \func{wxView *
}{CreateView
}{\param{wxDocument *
}{doc
},
\param{long
}{ flags =
0}}
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.
172 \membersection{wxDocTemplate::GetDefaultExtension
}\label{wxdoctemplategetdefaultextension
}
174 \func{wxString
}{GetDefaultExtension
}{\void}
176 Returns the default file extension for the
document data, as passed to the
document template constructor.
178 \membersection{wxDocTemplate::GetDescription
}\label{wxdoctemplategetdescription
}
180 \func{wxString
}{GetDescription
}{\void}
182 Returns the text description of this template, as passed to the
document template constructor.
184 \membersection{wxDocTemplate::GetDirectory
}\label{wxdoctemplategetdirectory
}
186 \func{wxString
}{GetDirectory
}{\void}
188 Returns the default directory, as passed to the
document template constructor.
190 \membersection{wxDocTemplate::GetDocumentManager
}\label{wxdoctemplategetdocumentmanager
}
192 \func{wxDocManager *
}{GetDocumentManager
}{\void}
194 Returns a pointer to the
document manager instance for which this template was created.
196 \membersection{wxDocTemplate::GetDocumentName
}\label{wxdoctemplategetdocumentname
}
198 \func{wxString
}{GetDocumentName
}{\void}
200 Returns the
document type name, as passed to the
document template constructor.
202 \membersection{wxDocTemplate::GetFileFilter
}\label{wxdoctemplategetfilefilter
}
204 \func{wxString
}{GetFileFilter
}{\void}
206 Returns the file filter, as passed to the
document template constructor.
208 \membersection{wxDocTemplate::GetFlags
}\label{wxdoctemplategetflags
}
210 \func{long
}{GetFlags
}{\void}
212 Returns the flags, as passed to the
document template constructor.
214 \membersection{wxDocTemplate::GetViewName
}\label{wxdoctemplategetviewname
}
216 \func{wxString
}{GetViewName
}{\void}
218 Returns the view type name, as passed to the
document template constructor.
220 \membersection{wxDocTemplate::InitDocument
}\label{wxdoctemplateinitdocument
}
222 \func{bool
}{InitDocument
}{\param{wxDocument*
}{doc
},
\param{const wxString\&
}{path
},
\param{long
}{ flags =
0}}
224 Initialises the
document, calling wxDocument::OnCreate. This is called from
225 wxDocTemplate::CreateDocument.
227 \membersection{wxDocTemplate::IsVisible
}\label{wxdoctemplateisvisible
}
229 \func{bool
}{IsVisible
}{\void}
231 Returns true if the
document template can be shown in user dialogs, false otherwise.
233 \membersection{wxDocTemplate::SetDefaultExtension
}\label{wxdoctemplatesetdefaultextension
}
235 \func{void
}{SetDefaultExtension
}{\param{const wxString\&
}{ext
}}
237 Sets the default file extension.
239 \membersection{wxDocTemplate::SetDescription
}\label{wxdoctemplatesetdescription
}
241 \func{void
}{SetDescription
}{\param{const wxString\&
}{descr
}}
243 Sets the template description.
245 \membersection{wxDocTemplate::SetDirectory
}\label{wxdoctemplatesetdirectory
}
247 \func{void
}{SetDirectory
}{\param{const wxString\&
}{dir
}}
249 Sets the default directory.
251 \membersection{wxDocTemplate::SetDocumentManager
}\label{wxdoctemplatesetdocumentmanager
}
253 \func{void
}{SetDocumentManager
}{\param{wxDocManager *
}{manager
}}
255 Sets the pointer to the
document manager instance for which this template was created.
256 Should not be called by the application.
258 \membersection{wxDocTemplate::SetFileFilter
}\label{wxdoctemplatesetfilefilter
}
260 \func{void
}{SetFileFilter
}{\param{const wxString\&
}{filter
}}
262 Sets the file filter.
264 \membersection{wxDocTemplate::SetFlags
}\label{wxdoctemplatesetflags
}
266 \func{void
}{SetFlags
}{\param{long
}{flags
}}
268 Sets the internal
document template flags (see the constructor description for more details).