1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
|
<HTML>
<head><title>wxView</title></head>
<BODY BGCOLOR=#FFFFFF>
<A NAME="wxview"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx257.htm#wxvariantdata"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx259.htm#wxwave"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>
<H2>wxView</H2>
<P>
The view class can be used to model the viewing and editing component of
an application's file-based data. It is part of the document/view framework supported by wxWindows,
and cooperates with the <A HREF="wx79.htm#wxdocument">wxDocument</A>, <A HREF="wx78.htm#wxdoctemplate">wxDocTemplate</A>
and <A HREF="wx74.htm#wxdocmanager">wxDocManager</A> classes.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx85.htm#wxevthandler">wxEvtHandler</A><BR>
<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
<wx/docview.h><P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx298.htm#wxviewoverview">wxView overview</A>, <A HREF="wx79.htm#wxdocument">wxDocument</A>, <A HREF="wx78.htm#wxdoctemplate">wxDocTemplate</A>,
<A HREF="wx74.htm#wxdocmanager">wxDocManager</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#topic1006">wxView::m_viewDocument</A><BR>
<A HREF="#topic1007">wxView::m_viewFrame</A><BR>
<A HREF="#topic1008">wxView::m_viewTypeName</A><BR>
<A HREF="#topic1009">wxView::wxView</A><BR>
<A HREF="#topic1010">wxView::~wxView</A><BR>
<A HREF="#topic1011">wxView::Activate</A><BR>
<A HREF="#topic1012">wxView::Close</A><BR>
<A HREF="#topic1013">wxView::GetDocument</A><BR>
<A HREF="#topic1014">wxView::GetDocumentManager</A><BR>
<A HREF="#topic1015">wxView::GetFrame</A><BR>
<A HREF="#topic1016">wxView::GetViewName</A><BR>
<A HREF="#topic1017">wxView::OnActivateView</A><BR>
<A HREF="#topic1018">wxView::OnChangeFilename</A><BR>
<A HREF="#topic1019">wxView::OnClose</A><BR>
<A HREF="#topic1020">wxView::OnCreate</A><BR>
<A HREF="#topic1021">wxView::OnCreatePrintout</A><BR>
<A HREF="#topic1022">wxView::OnUpdate</A><BR>
<A HREF="#topic1023">wxView::SetDocument</A><BR>
<A HREF="#topic1024">wxView::SetFrame</A><BR>
<A HREF="#topic1025">wxView::SetViewName</A><BR>
<P>
<HR>
<A NAME="topic1006"></A>
<H3>wxView::m_viewDocument</H3>
<P>
wxDocument* m_viewDocument<P>
The document associated with this view. There may be more than one view per
document, but there can never be more than one document for one view.<P>
<HR>
<A NAME="topic1007"></A>
<H3>wxView::m_viewFrame</H3>
<P>
wxFrame* m_viewFrame<P>
Frame associated with the view, if any.<P>
<HR>
<A NAME="topic1008"></A>
<H3>wxView::m_viewTypeName</H3>
<P>
wxString m_viewTypeName<P>
The view type name given to the wxDocTemplate constructor, copied to this
variable when the view is created. Not currently used by the framework.<P>
<HR>
<A NAME="topic1009"></A>
<H3>wxView::wxView</H3>
<P>
<B></B> <B>wxView</B>()<P>
Constructor. Define your own default constructor to initialize application-specific
data.<P>
<HR>
<A NAME="topic1010"></A>
<H3>wxView::~wxView</H3>
<P>
<B></B> <B>~wxView</B>()<P>
Destructor. Removes itself from the document's list of views.<P>
<HR>
<A NAME="topic1011"></A>
<H3>wxView::Activate</H3>
<P>
<B>virtual void</B> <B>Activate</B>(<B>bool</B><I> activate</I>)<P>
Call this from your view frame's OnActivate member to tell the framework which view is
currently active. If your windowing system doesn't call OnActivate, you may need to
call this function from OnMenuCommand or any place where you know the view must
be active, and the framework will need to get the current view.<P>
The prepackaged view frame wxDocChildFrame calls wxView::Activate from its OnActivate member
and from its OnMenuCommand member.<P>
This function calls wxView::OnActivateView.<P>
<HR>
<A NAME="topic1012"></A>
<H3>wxView::Close</H3>
<P>
<B>virtual bool</B> <B>Close</B>(<B>bool</B><I> deleteWindow = TRUE</I>)<P>
Closes the view by calling OnClose. If <I>deleteWindow</I> is TRUE, this function should
delete the window associated with the view.<P>
<HR>
<A NAME="topic1013"></A>
<H3>wxView::GetDocument</H3>
<P>
<B>wxDocument*</B> <B>GetDocument</B>() <B>const</B><P>
Gets a pointer to the document associated with the view.<P>
<HR>
<A NAME="topic1014"></A>
<H3>wxView::GetDocumentManager</H3>
<P>
<B>wxDocumentManager*</B> <B>GetDocumentManager</B>() <B>const</B><P>
Returns a pointer to the document manager instance associated with this view.<P>
<HR>
<A NAME="topic1015"></A>
<H3>wxView::GetFrame</H3>
<P>
<B>wxFrame *</B> <B>GetFrame</B>()<P>
Gets the frame associated with the view (if any).<P>
<HR>
<A NAME="topic1016"></A>
<H3>wxView::GetViewName</H3>
<P>
<B>wxString</B> <B>GetViewName</B>() <B>const</B><P>
Gets the name associated with the view (passed to the wxDocTemplate constructor).
Not currently used by the framework.<P>
<HR>
<A NAME="topic1017"></A>
<H3>wxView::OnActivateView</H3>
<P>
<B>virtual void</B> <B>OnActivateView</B>(<B>bool </B><I>activate</I>, <B>wxView *</B><I>activeView</I>, <B>wxView *</B><I>deactiveView</I>)<P>
Called when a view is activated by means of wxView::Activate. The default implementation does
nothing.<P>
<HR>
<A NAME="topic1018"></A>
<H3>wxView::OnChangeFilename</H3>
<P>
<B>virtual void</B> <B>OnChangeFilename</B>()<P>
Called when the filename has changed. The default implementation constructs a
suitable title and sets the title of the view frame (if any).<P>
<HR>
<A NAME="topic1019"></A>
<H3>wxView::OnClose</H3>
<P>
<B>virtual bool</B> <B>OnClose</B>(<B>bool</B><I> deleteWindow</I>)<P>
Implements closing behaviour. The default implementation calls wxDocument::Close
to close the associated document. Does not delete the view. The application
may wish to do some cleaning up operations in this function, <I>if</I> a
call to wxDocument::Close succeeded. For example, if your application's
all share the same window, you need to disassociate the window from the view
and perhaps clear the window. If <I>deleteWindow</I> is TRUE, delete the
frame associated with the view.<P>
<HR>
<A NAME="topic1020"></A>
<H3>wxView::OnCreate</H3>
<P>
<B>virtual bool</B> <B>OnCreate</B>(<B>wxDocument* </B><I>doc</I>, <B>long</B><I> flags</I>)<P>
Called just after view construction to give the view a chance to initialize
itself based on the passed document and flags (unused). By default, simply
returns TRUE. If the function returns FALSE, the view will be deleted.<P>
The predefined document child frame, wxDocChildFrame, calls this function
automatically.<P>
<HR>
<A NAME="topic1021"></A>
<H3>wxView::OnCreatePrintout</H3>
<P>
<B>virtual wxPrintout*</B> <B>OnCreatePrintout</B>()<P>
If the printing framework is enabled in the library, this function returns a
<A HREF="wx180.htm#wxprintout">wxPrintout</A> object for the purposes of printing. It should create a new object
everytime it is called; the framework will delete objects it creates.<P>
By default, this function returns an instance of wxDocPrintout, which prints
and previews one page by calling wxView::OnDraw.<P>
Override to return an instance of a class other than wxDocPrintout.<P>
<HR>
<A NAME="topic1022"></A>
<H3>wxView::OnUpdate</H3>
<P>
<B>virtual void</B> <B>OnUpdate</B>(<B>wxView* </B><I>sender</I>, <B>wxObject* </B><I>hint</I>)<P>
Called when the view should be updated. <I>sender</I> is a pointer to the view
that sent the update request, or NULL if no single view requested the update (for instance,
when the document is opened). <I>hint</I> is as yet unused but may in future contain
application-specific information for making updating more efficient.<P>
<HR>
<A NAME="topic1023"></A>
<H3>wxView::SetDocument</H3>
<P>
<B>void</B> <B>SetDocument</B>(<B>wxDocument* </B><I>doc</I>)<P>
Associates the given document with the view. Normally called by the
framework.<P>
<HR>
<A NAME="topic1024"></A>
<H3>wxView::SetFrame</H3>
<P>
<B>void</B> <B>SetFrame</B>(<B>wxFrame* </B><I>frame</I>)<P>
Sets the frame associated with this view. The application should call this
if possible, to tell the view about the frame.<P>
<HR>
<A NAME="topic1025"></A>
<H3>wxView::SetViewName</H3>
<P>
<B>void</B> <B>SetViewName</B>(<B>const wxString& </B><I>name</I>)<P>
Sets the view type name. Should only be called by the framework.<P>
</BODY></HTML>
|