1 \section{\class{wxView
}}\label{wxview
}
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.
8 \wxheading{Derived from
}
10 \helpref{wxEvtHandler
}{wxevthandler
}\\
11 \helpref{wxObject
}{wxobject
}
13 \wxheading{Include files
}
19 \helpref{wxView overview
}{wxviewoverview
},
\helpref{wxDocument
}{wxdocument
},
\helpref{wxDocTemplate
}{wxdoctemplate
},
\rtfsp
20 \helpref{wxDocManager
}{wxdocmanager
}
22 \latexignore{\rtfignore{\wxheading{Members
}}}
24 \membersection{wxView::m
\_viewDocument}
26 \member{wxDocument*
}{m
\_viewDocument}
28 The
document associated with this view. There may be more than one view per
29 document, but there can never be more than one
document for one view.
31 \membersection{wxView::m
\_viewFrame}
33 \member{wxFrame*
}{m
\_viewFrame}
35 Frame associated with the view, if any.
37 \membersection{wxView::m
\_viewTypeName}
39 \member{wxString
}{m
\_viewTypeName}
41 The view type name given to the wxDocTemplate constructor, copied to this
42 variable when the view is created. Not currently used by the framework.
44 \membersection{wxView::wxView
}
46 \func{}{wxView
}{\void}
48 Constructor. Define your own default constructor to initialize application-specific
51 \membersection{wxView::
\destruct{wxView
}}
53 \func{}{\destruct{wxView
}}{\void}
55 Destructor. Removes itself from the
document's list of views.
57 \membersection{wxView::Activate
}
59 \func{virtual void
}{Activate
}{\param{bool
}{ activate
}}
61 Call this from your view frame's OnActivate member to tell the framework which view is
62 currently active. If your windowing system doesn't call OnActivate, you may need to
63 call this function from OnMenuCommand or any place where you know the view must
64 be active, and the framework will need to get the current view.
66 The prepackaged view frame wxDocChildFrame calls wxView::Activate from its OnActivate member
67 and from its OnMenuCommand member.
69 This function calls wxView::OnActivateView.
71 \membersection{wxView::Close
}
73 \func{virtual bool
}{Close
}{\param{bool
}{ deleteWindow = true
}}
75 Closes the view by calling OnClose. If
{\it deleteWindow
} is true, this function should
76 delete the window associated with the view.
78 \membersection{wxView::GetDocument
}
80 \constfunc{wxDocument*
}{GetDocument
}{\void}
82 Gets a pointer to the
document associated with the view.
84 \membersection{wxView::GetDocumentManager
}
86 \constfunc{wxDocumentManager*
}{GetDocumentManager
}{\void}
88 Returns a pointer to the
document manager instance associated with this view.
90 \membersection{wxView::GetFrame
}\label{wxviewgetframe
}
92 \func{wxWindow *
}{GetFrame
}{\void}
94 Gets the frame associated with the view (if any). Note that this ``frame'' is
95 not a wxFrame at all in the generic MDI implementation which uses the notebook
96 pages instead of the frames and this is why this method returns a wxWindow and
99 \membersection{wxView::GetViewName
}
101 \constfunc{wxString
}{GetViewName
}{\void}
103 Gets the name associated with the view (passed to the wxDocTemplate constructor).
104 Not currently used by the framework.
106 \membersection{wxView::OnActivateView
}
108 \func{virtual void
}{OnActivateView
}{\param{bool
}{activate
},
\param{wxView *
}{activeView
},
\param{wxView *
}{deactiveView
}}
110 Called when a view is activated by means of wxView::Activate. The default implementation does
113 \membersection{wxView::OnChangeFilename
}
115 \func{virtual void
}{OnChangeFilename
}{\void}
117 Called when the filename has changed. The default implementation constructs a
118 suitable title and sets the title of the view frame (if any).
120 \membersection{wxView::OnClose
}
122 \func{virtual bool
}{OnClose
}{\param{bool
}{ deleteWindow
}}
124 Implements closing behaviour. The default implementation calls wxDocument::Close
125 to close the associated
document. Does not delete the view. The application
126 may wish to do some cleaning up operations in this function,
{\it if
} a
127 call to wxDocument::Close succeeded. For example, if your application's
128 all share the same window, you need to disassociate the window from the view
129 and perhaps clear the window. If
{\it deleteWindow
} is true, delete the
130 frame associated with the view.
132 \membersection{wxView::OnClosingDocument
}\label{wxviewonclosingdocument
}
134 \func{virtual void
}{OnClosingDoocument
}{\void}
136 Override this to clean up the view when the
document is being
139 \membersection{wxView::OnCreate
}
141 \func{virtual bool
}{OnCreate
}{\param{wxDocument*
}{doc
},
\param{long
}{ flags
}}
143 wxDocManager or wxDocument creates a wxView via a wxDocTemplate.
144 Just after the wxDocTemplate creates the wxView, it calls
145 wxView::OnCreate. In its OnCreate member function, the wxView can create a wxDocChildFrame
146 or a derived class. This wxDocChildFrame provides user interface
147 elements to view and/or edit the contents of the wxDocument.
149 By default, simply returns true. If the function returns false, the
150 view will be deleted.
152 \membersection{wxView::OnCreatePrintout
}
154 \func{virtual wxPrintout*
}{OnCreatePrintout
}{\void}
156 If 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
158 every time it is called; the framework will delete objects it creates.
160 By default, this function returns an instance of wxDocPrintout, which prints
161 and previews one page by calling wxView::OnDraw.
163 Override to return an instance of a class other than wxDocPrintout.
165 \membersection{wxView::OnUpdate
}
167 \func{virtual void
}{OnUpdate
}{\param{wxView*
}{sender
},
\param{wxObject*
}{hint
}}
169 Called when the view should be updated.
{\it sender
} is a pointer to the view
170 that sent the update request, or NULL if no single view requested the update (for instance,
171 when the
document is opened).
{\it hint
} is as yet unused but may in future contain
172 application-specific information for making updating more efficient.
174 \membersection{wxView::SetDocument
}
176 \func{void
}{SetDocument
}{\param{wxDocument*
}{doc
}}
178 Associates the given
document with the view. Normally called by the
181 \membersection{wxView::SetFrame
}
183 \func{void
}{SetFrame
}{\param{wxWindow*
}{frame
}}
185 Sets the frame associated with this view. The application should call this
186 if possible, to tell the view about the frame.
188 See
\helpref{GetFrame
}{wxviewgetframe
} for the explanation about the mismatch
189 between the ``Frame'' in the method name and the type of its parameter.
191 \membersection{wxView::SetViewName
}
193 \func{void
}{SetViewName
}{\param{const wxString\&
}{name
}}
195 Sets the view type name. Should only be called by the framework.