File: document.tex

package info (click to toggle)
wxwidgets2.8 2.8.10.1-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 239,052 kB
  • ctags: 289,550
  • sloc: cpp: 1,838,857; xml: 396,717; python: 282,506; ansic: 126,171; makefile: 51,406; sh: 14,581; asm: 299; sql: 258; lex: 194; perl: 139; yacc: 128; pascal: 95; php: 39; lisp: 38; tcl: 24; haskell: 20; java: 18; cs: 18; erlang: 17; ruby: 16; ada: 9; ml: 9; csh: 9
file content (363 lines) | stat: -rw-r--r-- 13,444 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
\section{\class{wxDocument}}\label{wxdocument}

The document class can be used to model an application's file-based
data. It is part of the document/view framework supported by wxWidgets,
and cooperates with the \helpref{wxView}{wxview}, \helpref{wxDocTemplate}{wxdoctemplate}\rtfsp
and \helpref{wxDocManager}{wxdocmanager} classes.

\wxheading{Derived from}

\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}

\wxheading{Include files}

<wx/docview.h>

\wxheading{See also}

\helpref{wxDocument overview}{wxdocumentoverview}, \helpref{wxView}{wxview},\rtfsp
\helpref{wxDocTemplate}{wxdoctemplate}, \helpref{wxDocManager}{wxdocmanager}

\latexignore{\rtfignore{\wxheading{Members}}}

\membersection{wxDocument::m\_commandProcessor}\label{wxdocumentmcommandprocessor}

\member{wxCommandProcessor*}{m\_commandProcessor}

A pointer to the command processor associated with this document.

\membersection{wxDocument::m\_documentFile}\label{wxdocumentmdocumentfile}

\member{wxString}{m\_documentFile}

Filename associated with this document (``" if none).

\membersection{wxDocument::m\_documentModified}\label{wxdocumentmdocumentmodified}

\member{bool}{m\_documentModified}

true if the document has been modified, false otherwise.

\membersection{wxDocument::m\_documentTemplate}\label{wxdocumentmdocumenttemplate}

\member{wxDocTemplate *}{m\_documentTemplate}

A pointer to the template from which this document was created.

\membersection{wxDocument::m\_documentTitle}\label{wxdocumentmdocumenttitle}

\member{wxString}{m\_documentTitle}

Document title. The document title is used for an associated
frame (if any), and is usually constructed by the framework from
the filename.

\membersection{wxDocument::m\_documentTypeName}\label{documenttypename}

\member{wxString}{m\_documentTypeName}

The document type name given to the wxDocTemplate constructor, copied to this
variable when the document is created. If several document templates are
created that use the same document type, this variable is used in wxDocManager::CreateView
to collate a list of alternative view types that can be used on this kind of
document. Do not change the value of this variable.

\membersection{wxDocument::m\_documentViews}\label{wxdocumentmdocumentviews}

\member{wxList}{m\_documentViews}

List of wxView instances associated with this document.

\membersection{wxDocument::wxDocument}\label{wxdocumentctor}

\func{}{wxDocument}{\void}

Constructor. Define your own default constructor to initialize application-specific
data.

\membersection{wxDocument::\destruct{wxDocument}}\label{wxdocumentdtor}

\func{}{\destruct{wxDocument}}{\void}

Destructor. Removes itself from the document manager.

\membersection{wxDocument::AddView}\label{wxdocumentaddview}

\func{virtual bool}{AddView}{\param{wxView *}{view}}

If the view is not already in the list of views, adds the view and calls OnChangedViewList.

\membersection{wxDocument::Close}\label{wxdocumentclose}

\func{virtual bool}{Close}{\void}

Closes the document, by calling OnSaveModified and then (if this returned true) OnCloseDocument.
This does not normally delete the document object: use DeleteAllViews to do this implicitly.

\membersection{wxDocument::DeleteAllViews}\label{wxdocumentdeleteviews}

\func{virtual bool}{DeleteAllViews}{\void}

Calls wxView::Close and deletes each view. Deleting the final view will implicitly
delete the document itself, because the wxView destructor calls RemoveView. This
in turns calls wxDocument::OnChangedViewList, whose default implemention is to
save and delete the document if no views exist.

\membersection{wxDocument::GetCommandProcessor}\label{wxdocumentgetcommandprocessor}

\constfunc{wxCommandProcessor*}{GetCommandProcessor}{\void}

Returns a pointer to the command processor associated with this document.

See \helpref{wxCommandProcessor}{wxcommandprocessor}.

\membersection{wxDocument::GetDocumentTemplate}\label{wxdocumentgetdocumenttemplate}

\constfunc{wxDocTemplate*}{GetDocumentTemplate}{\void}

Gets a pointer to the template that created the document.

\membersection{wxDocument::GetDocumentManager}\label{wxdocumentgetdocumentmanager}

\constfunc{wxDocManager*}{GetDocumentManager}{\void}

Gets a pointer to the associated document manager.

\membersection{wxDocument::GetDocumentName}\label{wxdocumentgetdocumentname}

\constfunc{wxString}{GetDocumentName}{\void}

Gets the document type name for this document. See the comment for \helpref{documentTypeName}{documenttypename}.

\membersection{wxDocument::GetDocumentWindow}\label{wxdocumentgetdocumentwindow}

\constfunc{wxWindow*}{GetDocumentWindow}{\void}

Intended to return a suitable window for using as a parent for document-related
dialog boxes. By default, uses the frame associated with the first view.

\membersection{wxDocument::GetFilename}\label{wxdocumentgetfilename}

\constfunc{wxString}{GetFilename}{\void}

Gets the filename associated with this document, or "" if none is
associated.

\membersection{wxDocument::GetFirstView}\label{wxdocumentgetfirstview}

\constfunc{wxView *}{GetFirstView}{\void}

A convenience function to get the first view for a document, because
in many cases a document will only have a single view.

See also: \helpref{GetViews}{wxdocumentgetviews}

\membersection{wxDocument::GetPrintableName}\label{wxdocumentgetprintablename}

\constfunc{virtual void}{GetPrintableName}{\param{wxString\& }{name}}

Copies a suitable document name into the supplied {\it name} buffer. The default
function uses the title, or if there is no title, uses the filename; or if no
filename, the string {\bf unnamed}. 

\perlnote{In wxPerl this function must return the modified name rather
than just modifying the argument.}

\membersection{wxDocument::GetTitle}\label{wxdocumentgettitle}

\constfunc{wxString}{GetTitle}{\void}

Gets the title for this document. The document title is used for an associated
frame (if any), and is usually constructed by the framework from
the filename.

\membersection{wxDocument::GetViews}\label{wxdocumentgetviews}

\constfunc{wxList \&}{GetViews}{\void}

Returns the list whose elements are the views on the document.

See also: \helpref{GetFirstView}{wxdocumentgetfirstview}

\membersection{wxDocument::IsModified}\label{wxdocumentismodified}

\constfunc{virtual bool}{IsModified}{\void}

Returns true if the document has been modified since the last save, false otherwise.
You may need to override this if your document view maintains its own
record of being modified (for example if using wxTextWindow to view and edit the document).

See also \helpref{Modify}{wxdocumentmodify}.

\membersection{wxDocument::LoadObject}\label{wxdocumentloadobject}

\func{virtual istream\&}{LoadObject}{\param{istream\& }{stream}}

\func{virtual wxInputStream\&}{LoadObject}{\param{wxInputStream\& }{stream}}

Override this function and call it from your own LoadObject before
streaming your own data. LoadObject is called by the framework
automatically when the document contents need to be loaded.

Note that only one of these forms exists, depending on how wxWidgets
was configured.

\membersection{wxDocument::Modify}\label{wxdocumentmodify}

\func{virtual void}{Modify}{\param{bool}{ modify}}

Call with true to mark the document as modified since the last save, false otherwise.
You may need to override this if your document view maintains its own
record of being modified (for example if using wxTextWindow to view and edit the document).

See also \helpref{IsModified}{wxdocumentismodified}.

\membersection{wxDocument::OnChangedViewList}\label{wxdocumentonchangedviewlist}

\func{virtual void}{OnChangedViewList}{\void}

Called when a view is added to or deleted from this document. The default
implementation saves and deletes the document if no views exist (the last
one has just been removed).

\membersection{wxDocument::OnCloseDocument}\label{wxdocumentonclosedocument}

\func{virtual bool}{OnCloseDocument}{\void}

The default implementation calls DeleteContents (an empty implementation)
sets the modified flag to false. Override this to
supply additional behaviour when the document is closed with Close.

\membersection{wxDocument::OnCreate}\label{wxdocumentoncreate}

\func{virtual bool}{OnCreate}{\param{const wxString\& }{path}, \param{long}{ flags}}

Called just after the document object is created to give it a chance
to initialize itself. The default implementation uses the
template associated with the document to create an initial view.
If this function returns false, the document is deleted.

\membersection{wxDocument::OnCreateCommandProcessor}\label{wxdocumentoncreatecommandprocessor}

\func{virtual wxCommandProcessor*}{OnCreateCommandProcessor}{\void}

Override this function if you want a different (or no) command processor
to be created when the document is created. By default, it returns
an instance of wxCommandProcessor.

See \helpref{wxCommandProcessor}{wxcommandprocessor}.

\membersection{wxDocument::OnNewDocument}\label{wxdocumentonnewdocument}

\func{virtual bool}{OnNewDocument}{\void}

The default implementation calls OnSaveModified and DeleteContents, makes a default title for the
document, and notifies the views that the filename (in fact, the title) has changed.

\membersection{wxDocument::OnOpenDocument}\label{wxdocumentonopendocument}

\func{virtual bool}{OnOpenDocument}{\param{const wxString\& }{filename}}

Constructs an input file stream for the given filename (which must not be empty),
and calls LoadObject. If LoadObject returns true, the document is set to
unmodified; otherwise, an error message box is displayed. The document's
views are notified that the filename has changed, to give windows an opportunity
to update their titles. All of the document's views are then updated.

\membersection{wxDocument::OnSaveDocument}\label{wxdocumentonsavedocument}

\func{virtual bool}{OnSaveDocument}{\param{const wxString\& }{filename}}

Constructs an output file stream for the given filename (which must not be empty),
and calls SaveObject. If SaveObject returns true, the document is set to
unmodified; otherwise, an error message box is displayed.

\membersection{wxDocument::OnSaveModified}\label{wxdocumentonsavemodified}

\func{virtual bool}{OnSaveModified}{\void}

If the document has been modified, prompts the user to ask if the changes should
be changed. If the user replies Yes, the Save function is called. If No, the
document is marked as unmodified and the function succeeds. If Cancel, the
function fails.

\membersection{wxDocument::RemoveView}\label{wxdocumentremoveview}

\func{virtual bool}{RemoveView}{\param{wxView* }{view}}

Removes the view from the document's list of views, and calls OnChangedViewList.

\membersection{wxDocument::Save}\label{wxdocumentsave}

\func{virtual bool}{Save}{\void}

Saves the document by calling OnSaveDocument if there is an associated filename,
or SaveAs if there is no filename.

\membersection{wxDocument::SaveAs}\label{wxdocumentsaveas}

\func{virtual bool}{SaveAs}{\void}

Prompts the user for a file to save to, and then calls OnSaveDocument.

\membersection{wxDocument::SaveObject}\label{wxdocumentsaveobject}

\func{virtual ostream\&}{SaveObject}{\param{ostream\& }{stream}}

\func{virtual wxOutputStream\&}{SaveObject}{\param{wxOutputStream\& }{stream}}

Override this function and call it from your own SaveObject before
streaming your own data. SaveObject is called by the framework
automatically when the document contents need to be saved.

Note that only one of these forms exists, depending on how wxWidgets
was configured.

\membersection{wxDocument::SetCommandProcessor}\label{wxdocumentsetcommandprocessor}

\func{virtual void}{SetCommandProcessor}{\param{wxCommandProcessor *}{processor}}

Sets the command processor to be used for this document. The document will then be responsible
for its deletion. Normally you should not call this; override OnCreateCommandProcessor
instead.

See \helpref{wxCommandProcessor}{wxcommandprocessor}.

\membersection{wxDocument::SetDocumentName}\label{wxdocumentsetdocumentname}

\func{void}{SetDocumentName}{\param{const wxString\& }{name}}

Sets the document type name for this document. See the comment for \helpref{documentTypeName}{documenttypename}.

\membersection{wxDocument::SetDocumentTemplate}\label{wxdocumentsetdocumenttemplate}

\func{void}{SetDocumentTemplate}{\param{wxDocTemplate* }{templ}}

Sets the pointer to the template that created the document. Should only be called by the
framework.

\membersection{wxDocument::SetFilename}\label{wxdocumentsetfilename}

\func{void}{SetFilename}{\param{const wxString\& }{filename}, \param{bool}{ notifyViews = false}}

Sets the filename for this document. Usually called by the framework.

If {\it notifyViews} is true, wxView::OnChangeFilename is called for all views.

\membersection{wxDocument::SetTitle}\label{wxdocumentsettitle}

\func{void}{SetTitle}{\param{const wxString\& }{title}}

Sets the title for this document. The document title is used for an associated
frame (if any), and is usually constructed by the framework from
the filename.

\membersection{wxDocument::UpdateAllViews}\label{wxdocumentupdateallviews}

\func{void}{UpdateAllViews}{\param{wxView* }{sender = NULL}, \param{wxObject*}{ hint = NULL}}

Updates all views. If {\it sender} is non-NULL, does not update this view.

{\it hint} represents optional information to allow a view to optimize its update.