]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/view.tex
Some manual updates; in MDI sample, child frames now have default size/position ...
[wxWidgets.git] / docs / latex / wx / view.tex
CommitLineData
a660d684
KB
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{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
24The document associated with this view. There may be more than one view per
25document, 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
31Frame associated with the view, if any.
32
33\membersection{wxView::m\_viewTypeName}
34
35\member{wxString}{m\_viewTypeName}
36
37The view type name given to the wxDocTemplate constructor, copied to this
38variable 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
44Constructor. Define your own default constructor to initialize application-specific
45data.
46
47\membersection{wxView::\destruct{wxView}}
48
49\func{}{\destruct{wxView}}{\void}
50
51Destructor. Removes itself from the document's list of views.
52
53\membersection{wxView::Activate}
54
55\func{virtual void}{Activate}{\param{bool}{ activate}}
56
57Call this from your view frame's OnActivate member to tell the framework which view is
58currently active. If your windowing system doesn't call OnActivate, you may need to
59call this function from OnMenuCommand or any place where you know the view must
60be active, and the framework will need to get the current view.
61
62The prepackaged view frame wxDocChildFrame calls wxView::Activate from its OnActivate member
63and from its OnMenuCommand member.
64
65This function calls wxView::OnActivateView.
66
67\membersection{wxView::Close}
68
69\func{virtual bool}{Close}{\param{bool}{ deleteWindow = TRUE}}
70
71Closes the view by calling OnClose. If {\it deleteWindow} is TRUE, this function should
72delete the window associated with the view.
73
74\membersection{wxView::GetDocument}
75
76\constfunc{wxDocument*}{GetDocument}{\void}
77
78Gets a pointer to the document associated with the view.
79
80\membersection{wxView::GetDocumentManager}
81
82\constfunc{wxDocumentManager*}{GetDocumentManager}{\void}
83
84Returns a pointer to the document manager instance associated with this view.
85
86\membersection{wxView::GetFrame}
87
88\func{wxFrame *}{GetFrame}{\void}
89
90Gets the frame associated with the view (if any).
91
92\membersection{wxView::GetViewName}
93
94\constfunc{wxString}{GetViewName}{\void}
95
96Gets the name associated with the view (passed to the wxDocTemplate constructor).
97Not 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
103Called when a view is activated by means of wxView::Activate. The default implementation does
104nothing.
105
106\membersection{wxView::OnChangeFilename}
107
108\func{virtual void}{OnChangeFilename}{\void}
109
110Called when the filename has changed. The default implementation constructs a
111suitable 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
117Implements closing behaviour. The default implementation calls wxDocument::Close
118to close the associated document. Does not delete the view. The application
119may wish to do some cleaning up operations in this function, {\it if} a
120call to wxDocument::Close succeeded. For example, if your application's
fe604ccd
JS
121all share the same window, you need to disassociate the window from the view
122and perhaps clear the window. If {\it deleteWindow} is TRUE, delete the
a660d684
KB
123frame associated with the view.
124
125\membersection{wxView::OnCreate}
126
127\func{virtual bool}{OnCreate}{\param{wxDocument* }{doc}, \param{long}{ flags}}
128
129Called just after view construction to give the view a chance to initialize
130itself based on the passed document and flags (unused). By default, simply
131returns TRUE. If the function returns FALSE, the view will be deleted.
132
133The predefined document child frame, wxDocChildFrame, calls this function
134automatically.
135
136\membersection{wxView::OnCreatePrintout}
137
138\func{virtual wxPrintout*}{OnCreatePrintout}{\void}
139
140If 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
142everytime it is called; the framework will delete objects it creates.
143
144By default, this function returns an instance of wxDocPrintout, which prints
145and previews one page by calling wxView::OnDraw.
146
147Override 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
153Called when the view should be updated. {\it sender} is a pointer to the view
154that sent the update request, or NULL if no single view requested the update (for instance,
155when the document is opened). {\it hint} is as yet unused but may in future contain
156application-specific information for making updating more efficient.
157
158\membersection{wxView::SetDocument}
159
160\func{void}{SetDocument}{\param{wxDocument* }{doc}}
161
162Associates the given document with the view. Normally called by the
163framework.
164
165\membersection{wxView::SetFrame}
166
167\func{void}{SetFrame}{\param{wxFrame* }{frame}}
168
169Sets the frame associated with this view. The application should call this
170if possible, to tell the view about the frame.
171
172\membersection{wxView::SetViewName}
173
174\func{void}{SetViewName}{\param{const wxString\& }{name}}
175
176Sets the view type name. Should only be called by the framework.
177
178