wxRuby Documentation Home

Wx::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 Widgets,
and cooperates with the Document, DocTemplate
and DocManager classes.

Derived from

EvtHandler

Object

See also

View overview, Document, DocTemplate, DocManager

Methods

View#m__view_document

Document*m_viewDocument

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.

View#m__view_frame

Frame*m_viewFrame

Frame associated with the view, if any.

View#m__view_type_name

Stringm_viewTypeName

The view type name given to the DocTemplate constructor, copied to this
variable when the view is created. Not currently used by the framework.

View.new

destructor()

Destructor. Removes itself from the document’s list of views.

View#activate

activate(%(arg-type)Boolean% activate)

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 DocChildFrame calls View::Activate from its OnActivate member
and from its OnMenuCommand member.

This function calls View::OnActivateView.

View#close

Boolean close(%(arg-type)Boolean% deleteWindow = true)

Closes the view by calling OnClose. If deleteWindow is true, this function should
delete the window associated with the view.

View#get_document

Document get_document()

Gets a pointer to the document associated with the view.

View#get_document_manager

DocManager get_document_manager()

Returns a pointer to the document manager instance associated with this view.

View#get_frame

Window get_frame()

Gets the frame associated with the view (if any). Note that this ``frame’’ is
not a 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 Window and
not a Frame.

View#get_view_name

String get_view_name()

Gets the name associated with the view (passed to the DocTemplate constructor).
Not currently used by the framework.

View#on_activate_view

on_activate_view(%(arg-type)Boolean% activate, View activeView, View deactiveView)

Called when a view is activated by means of View::Activate. The default implementation does
nothing.

View#on_change_filename

on_change_filename()

Called when the filename has changed. The default implementation constructs a
suitable title and sets the title of the view frame (if any).

View#on_close

Boolean on_close(%(arg-type)Boolean% deleteWindow)

Implements closing behaviour. The default implementation calls 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 Document::Close succeeded. For example, if your views
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.

View#on_closing_document

on_closing_doocument()

Override this to clean up the view when the document is being
closed.

View#on_create

Boolean on_create(%(arg-type)Document% doc, Integer flags)

DocManager or Document creates a View via a DocTemplate.
Just after the DocTemplate creates the View, it calls
View::OnCreate. In its OnCreate member function, the View can create a DocChildFrame
or a derived class. This DocChildFrame provides user interface
elements to view and/or edit the contents of the Document.

By default, simply returns true. If the function returns false, the
view will be deleted.

View#on_create_printout

Printout on_create_printout()

If the printing framework is enabled in the library, this function returns a
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 DocPrintout, which prints
and previews one page by calling View::OnDraw.

Override to return an instance of a class other than DocPrintout.

View#on_draw

on_draw(%(arg-type)DC% dc)

Override this function to render the view on the given device context.

View#on_update

on_update(%(arg-type)View% sender, Object hint)

Called when the view should be updated. sender 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). hint is as yet unused but may in future contain
application-specific information for making updating more efficient.

View#set_document

set_document(%(arg-type)Document% doc)

Associates the given document with the view. Normally called by the
framework.

View#set_frame

set_frame(%(arg-type)Window% frame)

Sets the frame associated with this view. The application should call this
if possible, to tell the view about the frame.

See get_frame for the explanation about the mismatch
between the ``Frame’’ in the method name and the type of its parameter.

View#set_view_name

set_view_name(%(arg-type)String% name)

Sets the view type name. Should only be called by the framework.

[This page automatically generated from the Textile source at 2023-06-09 00:45:27 +0000]