A SERVICE OF

logo

TView contains some pure virtual functions that you must provide in every
Adding
new view class. It also contains a few placeholder functions that have no
functionality to
base class functionality Y u need to provide new versions of these. o
views
functions if you plan to use them for anything.
Much like TDocument, you should not override a TView function unless that
function is a virtual. When functions in TDocument call functions in your
view they address the view object as a TView. If you override a nonvirtual,
function and the document calls that function, the document actually calls
the TView version of that function, rendering your function useless in that
context.
The following functions are declared virtual so you can override them to
TView virtual
provide some useful functionality But most are not declared as pure.
functions
virtuals; you are not required to override them to construct a view. Instead,
you need to override these functions only if you plan to view them.
GetViewName returns the static name of the view. This function is declared
as a pure
virtual function; you must provide a definition of this function in
your view class.
GetWindow returns a TWindow * that should reference the view’ associateds
interface object if it has one; otherwise, GetWindow returns 0.
SetDocTitle sets the view window’ caption. It should be set to call thes
SetDocTitle function in the interface object.
TView contains the TMenuDescr * data member ViewMenu. Y u can assigno
Adding a menu
any existing TMenuDescr object to this member The menu should normally.
be set up in the view’ constructor This menu is then merged with thes .
frame window’ menu when the view is activated.s
TView itself makes no provision for displaying data—it has no pointer to a
Adding a display
window no graphics functions, no text display functions, and no keyboard,
to a view
handling. Y u need to provide this functionality in your derived classes;o
you can use one of the following methods to do so:
Add a pointer to an interface object in your derived view class
Mix in the functionality of an interface object with that of TView when
deriving your new view class
Each of these methods has its advantages and drawbacks, which are
discussed in the following sections. Y u should weigh the pros and cons ofo
each approach before deciding how to build your view class.
Chapter 9, Doc/View objects
215