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 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.docview
.. highlight:: python
.. _wx.lib.docview.View:
==========================================================================================================================================
|phoenix_title| **wx.lib.docview.View**
==========================================================================================================================================
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 :class:`Document`,
:class:`DocTemplate` and :class:`DocManager` classes.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>View</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.lib.docview.View_inheritance.png" alt="Inheritance diagram of View" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.docview.View.html" title="wx.lib.docview.View" alt="" coords="33,160,175,189"/> <area shape="rect" id="node2" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="48,83,159,112"/> <area shape="rect" id="node3" href="wx.Object.html" title="wx.Object" alt="" coords="5,5,87,35"/> <area shape="rect" id="node4" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="112,5,213,35"/> </map>
</p>
|
|super_classes| Known Superclasses
==================================
:class:`wx.EvtHandler`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.docview.View.__init__` Constructor. Define your own default constructor to initialize
:meth:`~wx.lib.docview.View.Activate` Call this from your view frame's ``OnActivate`` member to tell the
:meth:`~wx.lib.docview.View.Close` Closes the view by calling :meth:`OnClose`. If deleteWindow is true, this
:meth:`~wx.lib.docview.View.Destroy` Destructor. Removes itself from the document's list of views.
:meth:`~wx.lib.docview.View.GetDocument` Returns the document associated with the view.
:meth:`~wx.lib.docview.View.GetDocumentManager` Returns the document manager instance associated with this view.
:meth:`~wx.lib.docview.View.GetFrame` Gets the frame associated with the view (if any). Note that this
:meth:`~wx.lib.docview.View.GetViewName` Gets the name associated with the view (passed to the :class:`DocTemplate`
:meth:`~wx.lib.docview.View.OnActivateView` Called when a view is activated by means of :meth:`View.Activate`. The
:meth:`~wx.lib.docview.View.OnChangeFilename` Called when the filename has changed. The default implementation
:meth:`~wx.lib.docview.View.OnClose` Implements closing behaviour. The default implementation calls
:meth:`~wx.lib.docview.View.OnClosingDocument` Override this to clean up the view when the document is being closed.
:meth:`~wx.lib.docview.View.OnCreate` :class:`DocManager` or :class:`Document` creates a :class:`View` via
:meth:`~wx.lib.docview.View.OnCreatePrintout` Returns a :class:`wx.Printout` object for the purposes of printing. It
:meth:`~wx.lib.docview.View.OnDraw` Override this to draw the view for the printing framework. The
:meth:`~wx.lib.docview.View.OnPrint` Override this to print the view for the printing framework. The
:meth:`~wx.lib.docview.View.OnUpdate` Called when the view should be updated. sender is a pointer to the
:meth:`~wx.lib.docview.View.ProcessEvent` Processes an event, searching event tables and calling zero or more
:meth:`~wx.lib.docview.View.ProcessUpdateUIEvent` Processes a UI event, searching event tables and calling zero or more
:meth:`~wx.lib.docview.View.SetDocument` Associates the given document with the view. Normally called by the
:meth:`~wx.lib.docview.View.SetFrame` Sets the frame associated with this view. The application should call
:meth:`~wx.lib.docview.View.SetViewName` Sets the view type name. Should only be called by the framework.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: View(wx.EvtHandler)
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 :class:`Document`,
:class:`DocTemplate` and :class:`DocManager` classes.
.. method:: __init__(self)
Constructor. Define your own default constructor to initialize
application-specific data.
.. method:: Activate(self, activate=True)
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.
The prepackaged view frame :class:`DocChildFrame` calls ``View.Activate` from
its ``OnActivate`` member and from its ``OnMenuCommand`` member.
.. method:: Close(self, deleteWindow=True)
Closes the view by calling :meth:`OnClose`. If deleteWindow is true, this
function should delete the window associated with the view.
.. method:: Destroy(self)
Destructor. Removes itself from the document's list of views.
.. method:: GetDocument(self)
Returns the document associated with the view.
.. method:: GetDocumentManager(self)
Returns the document manager instance associated with this view.
.. method:: GetFrame(self)
Gets the frame associated with the view (if any). Note that this
"frame" is not a :class:`wx.Frame` at all in the generic MDI implementation
which uses the notebook pages instead of the frames and this is why
this method returns a :class:`wx.Window` and not a :class:`wx.Frame`.
.. method:: GetViewName(self)
Gets the name associated with the view (passed to the :class:`DocTemplate`
constructor). Not currently used by the framework.
.. method:: OnActivateView(self, activate, activeView, deactiveView)
Called when a view is activated by means of :meth:`View.Activate`. The
default implementation does nothing.
.. method:: OnChangeFilename(self)
Called when the filename has changed. The default implementation
constructs a suitable title and sets the title of the view frame (if
any).
.. method:: OnClose(self, deleteWindow=True)
Implements closing behaviour. The default implementation calls
:meth:`Document.Close` to close the associated document. Does not delete the
view. The application may wish to do some cleaning up operations in
this function, if a call to :meth:`Document::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
deleteWindow is true, delete the frame associated with the view.
.. method:: OnClosingDocument(self)
Override this to clean up the view when the document is being closed.
The default implementation does nothing.
.. method:: OnCreate(self, doc, flags)
:class:`DocManager` or :class:`Document` creates a :class:`View` via
a :class:`DocTemplate`. Just after the :class:`DocTemplate` creates
the :class:`View`, it calls :meth:`xView.OnCreate`. In its ``OnCreate``
member function, the ``View`` can create a :class:`DocChildFrame` or
a derived class. This :class:`DocChildFrame` provides user
interface elements to view and/or edit the contents of the wxDocument.
By default, simply returns true. If the function returns false, the
view will be deleted.
.. method:: OnCreatePrintout(self)
Returns a :class:`wx.Printout` object for the purposes of printing. It
should create a new object every time it is called; the framework will delete
objects it creates.
By default, this function returns an instance of :class:`DocPrintout`, which
prints and previews one page by calling :meth:`View.OnDraw`.
Override to return an instance of a class other than :class:`DocPrintout`.
.. method:: OnDraw(self, dc)
Override this to draw the view for the printing framework. The
default implementation does nothing.
.. method:: OnPrint(self, dc, info)
Override this to print the view for the printing framework. The
default implementation calls :meth:`View.OnDraw`.
.. method:: OnUpdate(self, sender, hint)
Called when the view should be updated. sender is a pointer to the
view that sent the update request, or None if no single view requested
the update (for instance, when the document is opened). hint is as yet
unused but may in future contain application-specific information for
making updating more efficient.
.. method:: ProcessEvent(self, event)
Processes an event, searching event tables and calling zero or more
suitable event handler function(s).
.. method:: ProcessUpdateUIEvent(self, event)
Processes a UI event, searching event tables and calling zero or more
suitable event handler function(s).
.. method:: SetDocument(self, doc)
Associates the given document with the view. Normally called by the
framework.
.. method:: SetFrame(self, frame)
Sets the frame associated with this view. The application should call
this if possible, to tell the view about the frame. See :meth:`GetFrame`
for the explanation about the mismatch between the "Frame" in the method
name and the type of its parameter.
.. method:: SetViewName(self, name)
Sets the view type name. Should only be called by the framework.
|