]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/view.tex
added functions to read/write several elements at once (patch 754986)
[wxWidgets.git] / docs / latex / wx / view.tex
... / ...
CommitLineData
1\section{\class{wxView}}\label{wxview}
2
3The view class can be used to model the viewing and editing component of
4an application's file-based data. It is part of the document/view framework supported by wxWindows,
5and cooperates with the \helpref{wxDocument}{wxdocument}, \helpref{wxDocTemplate}{wxdoctemplate}
6and \helpref{wxDocManager}{wxdocmanager} classes.
7
8\wxheading{Derived from}
9
10\helpref{wxEvtHandler}{wxevthandler}\\
11\helpref{wxObject}{wxobject}
12
13\wxheading{Include files}
14
15<wx/docview.h>
16
17\wxheading{See also}
18
19\helpref{wxView overview}{wxviewoverview}, \helpref{wxDocument}{wxdocument}, \helpref{wxDocTemplate}{wxdoctemplate},\rtfsp
20\helpref{wxDocManager}{wxdocmanager}
21
22\latexignore{\rtfignore{\wxheading{Members}}}
23
24\membersection{wxView::m\_viewDocument}
25
26\member{wxDocument*}{m\_viewDocument}
27
28The document associated with this view. There may be more than one view per
29document, but there can never be more than one document for one view.
30
31\membersection{wxView::m\_viewFrame}
32
33\member{wxFrame*}{m\_viewFrame}
34
35Frame associated with the view, if any.
36
37\membersection{wxView::m\_viewTypeName}
38
39\member{wxString}{m\_viewTypeName}
40
41The view type name given to the wxDocTemplate constructor, copied to this
42variable when the view is created. Not currently used by the framework.
43
44\membersection{wxView::wxView}
45
46\func{}{wxView}{\void}
47
48Constructor. Define your own default constructor to initialize application-specific
49data.
50
51\membersection{wxView::\destruct{wxView}}
52
53\func{}{\destruct{wxView}}{\void}
54
55Destructor. Removes itself from the document's list of views.
56
57\membersection{wxView::Activate}
58
59\func{virtual void}{Activate}{\param{bool}{ activate}}
60
61Call this from your view frame's OnActivate member to tell the framework which view is
62currently active. If your windowing system doesn't call OnActivate, you may need to
63call this function from OnMenuCommand or any place where you know the view must
64be active, and the framework will need to get the current view.
65
66The prepackaged view frame wxDocChildFrame calls wxView::Activate from its OnActivate member
67and from its OnMenuCommand member.
68
69This function calls wxView::OnActivateView.
70
71\membersection{wxView::Close}
72
73\func{virtual bool}{Close}{\param{bool}{ deleteWindow = true}}
74
75Closes the view by calling OnClose. If {\it deleteWindow} is true, this function should
76delete the window associated with the view.
77
78\membersection{wxView::GetDocument}
79
80\constfunc{wxDocument*}{GetDocument}{\void}
81
82Gets a pointer to the document associated with the view.
83
84\membersection{wxView::GetDocumentManager}
85
86\constfunc{wxDocumentManager*}{GetDocumentManager}{\void}
87
88Returns a pointer to the document manager instance associated with this view.
89
90\membersection{wxView::GetFrame}\label{wxviewgetframe}
91
92\func{wxWindow *}{GetFrame}{\void}
93
94Gets the frame associated with the view (if any). Note that this ``frame'' is
95not a wxFrame at all in the generic MDI implementation which uses the notebook
96pages instead of the frames and this is why this method returns a wxWindow and
97not a wxFrame.
98
99\membersection{wxView::GetViewName}
100
101\constfunc{wxString}{GetViewName}{\void}
102
103Gets the name associated with the view (passed to the wxDocTemplate constructor).
104Not currently used by the framework.
105
106\membersection{wxView::OnActivateView}
107
108\func{virtual void}{OnActivateView}{\param{bool }{activate}, \param{wxView *}{activeView}, \param{wxView *}{deactiveView}}
109
110Called when a view is activated by means of wxView::Activate. The default implementation does
111nothing.
112
113\membersection{wxView::OnChangeFilename}
114
115\func{virtual void}{OnChangeFilename}{\void}
116
117Called when the filename has changed. The default implementation constructs a
118suitable title and sets the title of the view frame (if any).
119
120\membersection{wxView::OnClose}
121
122\func{virtual bool}{OnClose}{\param{bool}{ deleteWindow}}
123
124Implements closing behaviour. The default implementation calls wxDocument::Close
125to close the associated document. Does not delete the view. The application
126may wish to do some cleaning up operations in this function, {\it if} a
127call to wxDocument::Close succeeded. For example, if your application's
128all share the same window, you need to disassociate the window from the view
129and perhaps clear the window. If {\it deleteWindow} is true, delete the
130frame associated with the view.
131
132\membersection{wxView::OnClosingDocument}\label{wxviewonclosingdocument}
133
134\func{virtual void}{OnClosingDoocument}{\void}
135
136Override this to clean up the view when the document is being
137closed.
138
139\membersection{wxView::OnCreate}
140
141\func{virtual bool}{OnCreate}{\param{wxDocument* }{doc}, \param{long}{ flags}}
142
143wxDocManager or wxDocument creates a wxView via a wxDocTemplate.
144Just after the wxDocTemplate creates the wxView, it calls
145wxView::OnCreate. In its OnCreate member function, the wxView can create a wxDocChildFrame
146or a derived class. This wxDocChildFrame provides user interface
147elements to view and/or edit the contents of the wxDocument.
148
149By default, simply returns true. If the function returns false, the
150view will be deleted.
151
152\membersection{wxView::OnCreatePrintout}
153
154\func{virtual wxPrintout*}{OnCreatePrintout}{\void}
155
156If the printing framework is enabled in the library, this function returns a
157\rtfsp\helpref{wxPrintout}{wxprintout} object for the purposes of printing. It should create a new object
158every time it is called; the framework will delete objects it creates.
159
160By default, this function returns an instance of wxDocPrintout, which prints
161and previews one page by calling wxView::OnDraw.
162
163Override to return an instance of a class other than wxDocPrintout.
164
165\membersection{wxView::OnUpdate}
166
167\func{virtual void}{OnUpdate}{\param{wxView* }{sender}, \param{wxObject* }{hint}}
168
169Called when the view should be updated. {\it sender} is a pointer to the view
170that sent the update request, or NULL if no single view requested the update (for instance,
171when the document is opened). {\it hint} is as yet unused but may in future contain
172application-specific information for making updating more efficient.
173
174\membersection{wxView::SetDocument}
175
176\func{void}{SetDocument}{\param{wxDocument* }{doc}}
177
178Associates the given document with the view. Normally called by the
179framework.
180
181\membersection{wxView::SetFrame}
182
183\func{void}{SetFrame}{\param{wxWindow* }{frame}}
184
185Sets the frame associated with this view. The application should call this
186if possible, to tell the view about the frame.
187
188See \helpref{GetFrame}{wxviewgetframe} for the explanation about the mismatch
189between the ``Frame'' in the method name and the type of its parameter.
190
191\membersection{wxView::SetViewName}
192
193\func{void}{SetViewName}{\param{const wxString\& }{name}}
194
195Sets the view type name. Should only be called by the framework.
196
197