]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/view.tex
Make scrollbars appear.
[wxWidgets.git] / docs / latex / wx / view.tex
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{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
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.
30
31 \membersection{wxView::m\_viewFrame}
32
33 \member{wxFrame*}{m\_viewFrame}
34
35 Frame associated with the view, if any.
36
37 \membersection{wxView::m\_viewTypeName}
38
39 \member{wxString}{m\_viewTypeName}
40
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.
43
44 \membersection{wxView::wxView}
45
46 \func{}{wxView}{\void}
47
48 Constructor. Define your own default constructor to initialize application-specific
49 data.
50
51 \membersection{wxView::\destruct{wxView}}
52
53 \func{}{\destruct{wxView}}{\void}
54
55 Destructor. Removes itself from the document's list of views.
56
57 \membersection{wxView::Activate}
58
59 \func{virtual void}{Activate}{\param{bool}{ activate}}
60
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.
65
66 The prepackaged view frame wxDocChildFrame calls wxView::Activate from its OnActivate member
67 and from its OnMenuCommand member.
68
69 This function calls wxView::OnActivateView.
70
71 \membersection{wxView::Close}
72
73 \func{virtual bool}{Close}{\param{bool}{ deleteWindow = TRUE}}
74
75 Closes the view by calling OnClose. If {\it deleteWindow} is TRUE, this function should
76 delete the window associated with the view.
77
78 \membersection{wxView::GetDocument}
79
80 \constfunc{wxDocument*}{GetDocument}{\void}
81
82 Gets a pointer to the document associated with the view.
83
84 \membersection{wxView::GetDocumentManager}
85
86 \constfunc{wxDocumentManager*}{GetDocumentManager}{\void}
87
88 Returns a pointer to the document manager instance associated with this view.
89
90 \membersection{wxView::GetFrame}
91
92 \func{wxFrame *}{GetFrame}{\void}
93
94 Gets the frame associated with the view (if any).
95
96 \membersection{wxView::GetViewName}
97
98 \constfunc{wxString}{GetViewName}{\void}
99
100 Gets the name associated with the view (passed to the wxDocTemplate constructor).
101 Not currently used by the framework.
102
103 \membersection{wxView::OnActivateView}
104
105 \func{virtual void}{OnActivateView}{\param{bool }{activate}, \param{wxView *}{activeView}, \param{wxView *}{deactiveView}}
106
107 Called when a view is activated by means of wxView::Activate. The default implementation does
108 nothing.
109
110 \membersection{wxView::OnChangeFilename}
111
112 \func{virtual void}{OnChangeFilename}{\void}
113
114 Called when the filename has changed. The default implementation constructs a
115 suitable title and sets the title of the view frame (if any).
116
117 \membersection{wxView::OnClose}
118
119 \func{virtual bool}{OnClose}{\param{bool}{ deleteWindow}}
120
121 Implements closing behaviour. The default implementation calls wxDocument::Close
122 to close the associated document. Does not delete the view. The application
123 may wish to do some cleaning up operations in this function, {\it if} a
124 call to wxDocument::Close succeeded. For example, if your application's
125 all share the same window, you need to disassociate the window from the view
126 and perhaps clear the window. If {\it deleteWindow} is TRUE, delete the
127 frame associated with the view.
128
129 \membersection{wxView::OnCreate}
130
131 \func{virtual bool}{OnCreate}{\param{wxDocument* }{doc}, \param{long}{ flags}}
132
133 wxDocManager or wxDocument creates a wxView via a wxDocTemplate.
134 Just after the wxDocTemplate creates the wxView, it calls
135 wxView::OnCreate. In its OnCreate member function, the wxView can create a wxDocChildFrame
136 or a derived class. This wxDocChildFrame provides user interface
137 elements to view and/or edit the contents of the wxDocument.
138
139 By default, simply returns TRUE. If the function returns FALSE, the
140 view will be deleted.
141
142 \membersection{wxView::OnCreatePrintout}
143
144 \func{virtual wxPrintout*}{OnCreatePrintout}{\void}
145
146 If the printing framework is enabled in the library, this function returns a
147 \rtfsp\helpref{wxPrintout}{wxprintout} object for the purposes of printing. It should create a new object
148 everytime it is called; the framework will delete objects it creates.
149
150 By default, this function returns an instance of wxDocPrintout, which prints
151 and previews one page by calling wxView::OnDraw.
152
153 Override to return an instance of a class other than wxDocPrintout.
154
155 \membersection{wxView::OnUpdate}
156
157 \func{virtual void}{OnUpdate}{\param{wxView* }{sender}, \param{wxObject* }{hint}}
158
159 Called when the view should be updated. {\it sender} is a pointer to the view
160 that sent the update request, or NULL if no single view requested the update (for instance,
161 when the document is opened). {\it hint} is as yet unused but may in future contain
162 application-specific information for making updating more efficient.
163
164 \membersection{wxView::SetDocument}
165
166 \func{void}{SetDocument}{\param{wxDocument* }{doc}}
167
168 Associates the given document with the view. Normally called by the
169 framework.
170
171 \membersection{wxView::SetFrame}
172
173 \func{void}{SetFrame}{\param{wxFrame* }{frame}}
174
175 Sets the frame associated with this view. The application should call this
176 if possible, to tell the view about the frame.
177
178 \membersection{wxView::SetViewName}
179
180 \func{void}{SetViewName}{\param{const wxString\& }{name}}
181
182 Sets the view type name. Should only be called by the framework.
183
184