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