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 Document,
DocTemplate and DocManager classes.
Class Hierarchy¶
Known Superclasses¶
Methods Summary¶
Constructor. Define your own default constructor to initialize |
|
Call this from your view frame’s |
|
Closes the view by calling |
|
Destructor. Removes itself from the document’s list of views. |
|
Returns the document associated with the view. |
|
Returns the document manager instance associated with this view. |
|
Gets the frame associated with the view (if any). Note that this |
|
Gets the name associated with the view (passed to the |
|
Called when a view is activated by means of |
|
Called when the filename has changed. The default implementation |
|
Implements closing behaviour. The default implementation calls |
|
Override this to clean up the view when the document is being closed. |
|
|
|
Returns a |
|
Override this to draw the view for the printing framework. The |
|
Override this to print the view for the printing framework. The |
|
Called when the view should be updated. sender is a pointer to the |
|
Processes an event, searching event tables and calling zero or more |
|
Processes a UI event, searching event tables and calling zero or more |
|
Associates the given document with the view. Normally called by the |
|
Sets the frame associated with this view. The application should call |
|
Sets the view type name. Should only be called by the framework. |
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
Document,DocTemplateandDocManagerclasses.
Methods¶
- __init__(self)¶
Constructor. Define your own default constructor to initialize application-specific data.
- Activate(self, activate=True)¶
Call this from your view frame’s
OnActivatemember to tell the framework which view is currently active. If your windowing system doesn’t callOnActivate, 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
DocChildFramecallsView.Activate` from its ``OnActivatemember and from itsOnMenuCommandmember.
- Close(self, deleteWindow=True)¶
Closes the view by calling
OnClose. If deleteWindow is true, this function should delete the window associated with the view.
- Destroy(self)¶
Destructor. Removes itself from the document’s list of views.
- GetDocument(self)¶
Returns the document associated with the view.
- GetDocumentManager(self)¶
Returns the document manager instance associated with this view.
- GetFrame(self)¶
Gets the frame associated with the view (if any). Note that this “frame” is not a
wx.Frameat all in the generic MDI implementation which uses the notebook pages instead of the frames and this is why this method returns awx.Windowand not awx.Frame.
- GetViewName(self)¶
Gets the name associated with the view (passed to the
DocTemplateconstructor). Not currently used by the framework.
- OnActivateView(self, activate, activeView, deactiveView)¶
Called when a view is activated by means of
View.Activate. The default implementation does nothing.
- 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).
- OnClose(self, deleteWindow=True)¶
Implements closing behaviour. The default implementation calls
Document.Closeto 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 toDocument::Closesucceeded. 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.
- OnClosingDocument(self)¶
Override this to clean up the view when the document is being closed. The default implementation does nothing.
- OnCreate(self, doc, flags)¶
DocManagerorDocumentcreates aViewvia aDocTemplate. Just after theDocTemplatecreates theView, it callsxView.OnCreate. In itsOnCreatemember function, theViewcan create aDocChildFrameor a derived class. ThisDocChildFrameprovides 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.
- OnCreatePrintout(self)¶
Returns a
wx.Printoutobject 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
DocPrintout, which prints and previews one page by callingView.OnDraw.Override to return an instance of a class other than
DocPrintout.
- OnDraw(self, dc)¶
Override this to draw the view for the printing framework. The default implementation does nothing.
- OnPrint(self, dc, info)¶
Override this to print the view for the printing framework. The default implementation calls
View.OnDraw.
- 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.
- ProcessEvent(self, event)¶
Processes an event, searching event tables and calling zero or more suitable event handler function(s).
- ProcessUpdateUIEvent(self, event)¶
Processes a UI event, searching event tables and calling zero or more suitable event handler function(s).
- SetDocument(self, doc)¶
Associates the given document with the view. Normally called by the framework.
- 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
GetFramefor the explanation about the mismatch between the “Frame” in the method name and the type of its parameter.
- SetViewName(self, name)¶
Sets the view type name. Should only be called by the framework.