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
}
15 \helpref{wxView overview
}{wxviewoverview
},
\helpref{wxDocument
}{wxdocument
},
\helpref{wxDocTemplate
}{wxdoctemplate
},
\rtfsp
16 \helpref{wxDocManager
}{wxdocmanager
}
18 \latexignore{\rtfignore{\wxheading{Members
}}}
20 \membersection{wxView::m
\_viewDocument}
22 \member{wxDocument*
}{m
\_viewDocument}
24 The
document associated with this view. There may be more than one view per
25 document, but there can never be more than one
document for one view.
27 \membersection{wxView::m
\_viewFrame}
29 \member{wxFrame*
}{m
\_viewFrame}
31 Frame associated with the view, if any.
33 \membersection{wxView::m
\_viewTypeName}
35 \member{wxString
}{m
\_viewTypeName}
37 The view type name given to the wxDocTemplate constructor, copied to this
38 variable when the view is created. Not currently used by the framework.
40 \membersection{wxView::wxView
}
42 \func{}{wxView
}{\param{wxDocument*
}{doc = NULL
}}
44 Constructor. Define your own default constructor to initialize application-specific
47 \membersection{wxView::
\destruct{wxView
}}
49 \func{}{\destruct{wxView
}}{\void}
51 Destructor. Removes itself from the
document's list of views.
53 \membersection{wxView::Activate
}
55 \func{virtual void
}{Activate
}{\param{bool
}{ activate
}}
57 Call this from your view frame's OnActivate member to tell the framework which view is
58 currently active. If your windowing system doesn't call OnActivate, you may need to
59 call this function from OnMenuCommand or any place where you know the view must
60 be active, and the framework will need to get the current view.
62 The prepackaged view frame wxDocChildFrame calls wxView::Activate from its OnActivate member
63 and from its OnMenuCommand member.
65 This function calls wxView::OnActivateView.
67 \membersection{wxView::Close
}
69 \func{virtual bool
}{Close
}{\param{bool
}{ deleteWindow = TRUE
}}
71 Closes the view by calling OnClose. If
{\it deleteWindow
} is TRUE, this function should
72 delete the window associated with the view.
74 \membersection{wxView::GetDocument
}
76 \constfunc{wxDocument*
}{GetDocument
}{\void}
78 Gets a pointer to the
document associated with the view.
80 \membersection{wxView::GetDocumentManager
}
82 \constfunc{wxDocumentManager*
}{GetDocumentManager
}{\void}
84 Returns a pointer to the
document manager instance associated with this view.
86 \membersection{wxView::GetFrame
}
88 \func{wxFrame *
}{GetFrame
}{\void}
90 Gets the frame associated with the view (if any).
92 \membersection{wxView::GetViewName
}
94 \constfunc{wxString
}{GetViewName
}{\void}
96 Gets the name associated with the view (passed to the wxDocTemplate constructor).
97 Not currently used by the framework.
99 \membersection{wxView::OnActivateView
}
101 \func{virtual void
}{OnActivateView
}{\param{bool
}{activate
},
\param{wxView *
}{activeView
},
\param{wxView *
}{deactiveView
}}
103 Called when a view is activated by means of wxView::Activate. The default implementation does
106 \membersection{wxView::OnChangeFilename
}
108 \func{virtual void
}{OnChangeFilename
}{\void}
110 Called when the filename has changed. The default implementation constructs a
111 suitable title and sets the title of the view frame (if any).
113 \membersection{wxView::OnClose
}
115 \func{virtual bool
}{OnClose
}{\param{bool
}{ deleteWindow
}}
117 Implements closing behaviour. The default implementation calls wxDocument::Close
118 to close the associated
document. Does not delete the view. The application
119 may wish to do some cleaning up operations in this function,
{\it if
} a
120 call to wxDocument::Close succeeded. For example, if your application's
121 all share the same window, you need to disassociate the window from the view
122 and perhaps clear the window. If
{\it deleteWindow
} is TRUE, delete the
123 frame associated with the view.
125 \membersection{wxView::OnCreate
}
127 \func{virtual bool
}{OnCreate
}{\param{wxDocument*
}{doc
},
\param{long
}{ flags
}}
129 Called just after view construction to give the view a chance to initialize
130 itself based on the passed
document and flags (unused). By default, simply
131 returns TRUE. If the function returns FALSE, the view will be deleted.
133 The predefined
document child frame, wxDocChildFrame, calls this function
136 \membersection{wxView::OnCreatePrintout
}
138 \func{virtual wxPrintout*
}{OnCreatePrintout
}{\void}
140 If 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
142 everytime it is called; the framework will delete objects it creates.
144 By default, this function returns an instance of wxDocPrintout, which prints
145 and previews one page by calling wxView::OnDraw.
147 Override to return an instance of a class other than wxDocPrintout.
149 \membersection{wxView::OnUpdate
}
151 \func{virtual void
}{OnUpdate
}{\param{wxView*
}{sender
},
\param{wxObject*
}{hint
}}
153 Called when the view should be updated.
{\it sender
} is a pointer to the view
154 that sent the update request, or NULL if no single view requested the update (for instance,
155 when the
document is opened).
{\it hint
} is as yet unused but may in future contain
156 application-specific information for making updating more efficient.
158 \membersection{wxView::SetDocument
}
160 \func{void
}{SetDocument
}{\param{wxDocument*
}{doc
}}
162 Associates the given
document with the view. Normally called by the
165 \membersection{wxView::SetFrame
}
167 \func{void
}{SetFrame
}{\param{wxFrame*
}{frame
}}
169 Sets the frame associated with this view. The application should call this
170 if possible, to tell the view about the frame.
172 \membersection{wxView::SetViewName
}
174 \func{void
}{SetViewName
}{\param{const wxString\&
}{name
}}
176 Sets the view type name. Should only be called by the framework.