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