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