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{wxDocTemplate overview
}{wxdoctemplateoverview
},
\helpref{wxDocument
}{wxdocument
},
\helpref{wxView
}{wxview
}
18 \latexignore{\rtfignore{\wxheading{Members
}}}
20 \membersection{wxDocTemplate::m
\_defaultExt}
22 \member{wxString
}{m
\_defaultExt}
24 The default extension for files of this type.
26 \membersection{wxDocTemplate::m
\_description}
28 \member{wxString
}{m
\_description}
30 A short description of this template.
32 \membersection{wxDocTemplate::m
\_directory}
34 \member{wxString
}{m
\_directory}
36 The default directory for files of this type.
38 \membersection{wxDocTemplate::m
\_docClassInfo}
40 \member{wxClassInfo*
}{m
\_docClassInfo}
42 Run-time class information that allows
document instances to be constructed dynamically.
44 \membersection{wxDocTemplate::m
\_docTypeName}
46 \member{wxString
}{m
\_docTypeName}
48 The named type of the
document associated with this template.
50 \membersection{wxDocTemplate::m
\_documentManager}
52 \member{wxDocTemplate*
}{m
\_documentManager}
54 A pointer to the
document manager for which this template was created.
56 \membersection{wxDocTemplate::m
\_fileFilter}
58 \member{wxString
}{m
\_fileFilter}
60 The file filter (such as
{\tt *.txt
}) to be used in file selector dialogs.
62 \membersection{wxDocTemplate::m
\_flags}
64 \member{long
}{m
\_flags}
66 The flags passed to the constructor.
68 \membersection{wxDocTemplate::m
\_viewClassInfo}
70 \member{wxClassInfo*
}{m
\_viewClassInfo}
72 Run-time class information that allows view instances to be constructed dynamically.
74 \membersection{wxDocTemplate::m
\_viewTypeName}
76 \member{wxString
}{m
\_viewTypeName}
78 The named type of the view associated with this template.
80 \membersection{wxDocTemplate::wxDocTemplate
}
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}}
87 Constructor. Create instances dynamically near the start of your application after creating
88 a wxDocManager instance, and before doing any
document or view operations.
90 {\it manager
} is the
document manager object which manages this template.
92 {\it descr
} is a short description of what the template is for. This string will be displayed in the
93 file filter list of Windows file selectors.
95 {\it filter
} is an appropriate file filter such as
{\tt *.txt
}.
97 {\it dir
} is the default directory to use for file selectors.
99 {\it ext
} is the default file extension (such as txt).
101 {\it docTypeName
} is a name that should be unique for a given type of
document, used for
102 gathering a list of views relevant to a particular
document.
104 {\it viewTypeName
} is a name that should be unique for a given view.
106 {\it docClassInfo
} is a pointer to the run-time
document class information as returned
107 by the CLASSINFO macro, e.g. CLASSINFO(MyDocumentClass). If this is not supplied,
108 you will need to derive a new wxDocTemplate class and override the CreateDocument
109 member to return a new
document instance on demand.
111 {\it viewClassInfo
} is a pointer to the run-time view class information as returned
112 by the CLASSINFO macro, e.g. CLASSINFO(MyViewClass). If this is not supplied,
113 you will need to derive a new wxDocTemplate class and override the CreateView
114 member to return a new view instance on demand.
116 {\it flags
} is a bit list of the following:
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.
124 \perlnote{In wxPerl
{\tt docClassInfo
} and
{\tt viewClassInfo
} can be
125 either
{\tt Wx::ClassInfo
} objects or strings which contain the name
126 of 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
130 \indented{2cm
}{\begin{twocollist
}
131 \twocolitem{{\bf Wx::DocTemplate->new( docmgr, descr, filter, dir,
132 ext, 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,
135 ext, 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,
138 ext, docTypeName, viewTypeName )
}}{
139 {\tt Wx::DocTemplate::CreateDocument()
} and
140 {\tt Wx::DocTemplate::CreateView()
} must be overridden
}
143 \membersection{wxDocTemplate::
\destruct{wxDocTemplate
}}
145 \func{void
}{\destruct{wxDocTemplate
}}{\void}
149 \membersection{wxDocTemplate::CreateDocument
}
151 \func{wxDocument *
}{CreateDocument
}{\param{const wxString\&
}{path
},
\param{long
}{ flags =
0}}
153 Creates a new instance of the associated
document class. If you have not supplied
154 a wxClassInfo parameter to the template constructor, you will need to override this
155 function to return an appropriate
document instance.
157 \membersection{wxDocTemplate::CreateView
}
159 \func{wxView *
}{CreateView
}{\param{wxDocument *
}{doc
},
\param{long
}{ flags =
0}}
161 Creates a new instance of the associated view class. If you have not supplied
162 a wxClassInfo parameter to the template constructor, you will need to override this
163 function to return an appropriate view instance.
165 \membersection{wxDocTemplate::GetDefaultExtension
}
167 \func{wxString
}{GetDefaultExtension
}{\void}
169 Returns the default file extension for the
document data, as passed to the
document template constructor.
171 \membersection{wxDocTemplate::GetDescription
}
173 \func{wxString
}{GetDescription
}{\void}
175 Returns the text description of this template, as passed to the
document template constructor.
177 \membersection{wxDocTemplate::GetDirectory
}
179 \func{wxString
}{GetDirectory
}{\void}
181 Returns the default directory, as passed to the
document template constructor.
183 \membersection{wxDocTemplate::GetDocumentManager
}
185 \func{wxDocManager *
}{GetDocumentManager
}{\void}
187 Returns a pointer to the
document manager instance for which this template was created.
189 \membersection{wxDocTemplate::GetDocumentName
}
191 \func{wxString
}{GetDocumentName
}{\void}
193 Returns the
document type name, as passed to the
document template constructor.
195 \membersection{wxDocTemplate::GetFileFilter
}
197 \func{wxString
}{GetFileFilter
}{\void}
199 Returns the file filter, as passed to the
document template constructor.
201 \membersection{wxDocTemplate::GetFlags
}
203 \func{long
}{GetFlags
}{\void}
205 Returns the flags, as passed to the
document template constructor.
207 \membersection{wxDocTemplate::GetViewName
}
209 \func{wxString
}{GetViewName
}{\void}
211 Returns the view type name, as passed to the
document template constructor.
213 \membersection{wxDocTemplate::IsVisible
}
215 \func{bool
}{IsVisible
}{\void}
217 Returns true if the
document template can be shown in user dialogs, false otherwise.
219 \membersection{wxDocTemplate::SetDefaultExtension
}
221 \func{void
}{SetDefaultExtension
}{\param{const wxString\&
}{ext
}}
223 Sets the default file extension.
225 \membersection{wxDocTemplate::SetDescription
}
227 \func{void
}{SetDescription
}{\param{const wxString\&
}{descr
}}
229 Sets the template description.
231 \membersection{wxDocTemplate::SetDirectory
}
233 \func{void
}{SetDirectory
}{\param{const wxString\&
}{dir
}}
235 Sets the default directory.
237 \membersection{wxDocTemplate::SetDocumentManager
}
239 \func{void
}{SetDocumentManager
}{\param{wxDocManager *
}{manager
}}
241 Sets the pointer to the
document manager instance for which this template was created.
242 Should not be called by the application.
244 \membersection{wxDocTemplate::SetFileFilter
}
246 \func{void
}{SetFileFilter
}{\param{const wxString\&
}{filter
}}
248 Sets the file filter.
250 \membersection{wxDocTemplate::SetFlags
}
252 \func{void
}{SetFlags
}{\param{long
}{flags
}}
254 Sets the internal
document template flags (see the constructor description for more details).