OWLNext 6.32
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
owl::TView Class Reference

Abstract base class for view access from document. More...

#include <docview.h>

Inheritance diagram for owl::TView:
owl::TEventHandler owl::TStreamableBase ocf::TOleLinkView ocf::TOleView owl::TDialogView owl::TEditView owl::TListBoxView owl::TListViewCtrlView owl::TPaneSplitterView owl::TRichEditView owl::TTabbedView owl::TTreeViewCtrlView owl::TWindowView

List of all members.

Public Types

enum  { PrevProperty = 0, ViewClass, ViewName, NextProperty }

Public Member Functions

 TView (TDocument &doc)
virtual ~TView ()
TDocumentGetDocument ()
void SetDocument (TDocument &)
uint GetViewId ()
virtual TMenuDescrGetViewMenu ()
virtual TBarDescrGetViewBar ()
void SetViewMenu (TMenuDescr *menu)
void SetViewBar (TBarDescr *bar)
bool IsOK ()
TViewGetNextView ()
virtual LPCTSTR GetViewName ()=0
virtual TWindowGetWindow ()
virtual bool SetDocTitle (LPCTSTR docname, int index)
bool SetDocTitle (const tstring &docname, int index)
virtual int PropertyCount ()
virtual int FindProperty (LPCTSTR name)
int FindProperty (const tstring &name)
virtual int PropertyFlags (int index)
virtual LPCTSTR PropertyName (int index)
virtual int GetProperty (int index, void *dest, int textlen=0)
virtual bool SetProperty (int index, const void *src)
void * GetTag () const
void SetTag (void **tag)

Static Public Member Functions

static uint GetNextViewId ()
static void BumpNextViewId ()

Protected Member Functions

void NotOK ()

Friends

class TDocument
class TDocument::Streamer

Detailed Description

Abstract base class for view access from document.

Derived virtually from both TEventHandler and TStreamableBase, TView is the interface presented to a document so it can access its client views. Views then call the document functions to request input and output streams. Views own the streams and are responsible for attaching and deleting them.

Instead of creating an instance of TView, you create a derived class that can implement TView's virtual functions. The derived class must have a way of knowing the associated window (provided by GetWindow()) and of describing the view (provided by GetViewName()). The view must also be able to display the document title in its window (SetDocTitle()). Classes derived from TView may need to handle several notification messages. For example, if a view is associated with a window that can gain focus, then the view should handle the vnIsWindow notification message.

View classes can take various forms. For example, a view class can be a window (through inheritance), can contain a window (an embedded object), can reference a window, or can be contained within a window object. A view class might not even have a window, as in the case of a voice mail or a format converter. Some remote views (for example, those displayed by DDE servers) might not have local windows.

Other viewer classes derived from TView include TEditView, TListBoxView, and TWindowView. These classes display different types of data: TEditView displays unformatted text files, TListBoxView displays text information in a list box, and TWindowView is a basic viewer from which you can derive other types of viewers such as hexadecimal file viewers.

For OLE-enabled applications, use TOleView, which supports views for embedded objects and compound documents.


Member Enumeration Documentation

anonymous enum

These property values, which describe the basic properties of a view, are available in classes derived from TView. They can be used to update and query the attributes of a view. PrevProperty and NextProperty are delimiters for every view's property list.

Enumerator:
PrevProperty 

Index of last property in base class.

ViewClass 

Name of the C++ class encapsulating the view. (text)

ViewName 

Name of the view. (text)

NextProperty 

Next index to be used by derived class.


Constructor & Destructor Documentation

owl::TView::TView ( TDocument doc)

Constructs a TView object of the document associated with the view. Sets the private data member ViewId to NextViewId. Calls TDocument's private member function AttachView to attach the view to the associated document.

owl::TView::~TView ( ) [virtual]

Frees a TView object and calls TDocument's private member function DetachView to detach the view from the associated document.


Member Function Documentation

void owl::TView::BumpNextViewId ( ) [static]

Increments an internal count used by the Doc/View subsystem to identify each view.

int owl::TView::FindProperty ( LPCTSTR  name) [virtual]

return property index

Gets the property index, given the property name (name). Returns 0 if the name is not found.

References NextProperty, and PrevProperty.

TDocument & owl::TView::GetDocument ( ) [inline]

Returns a reference to the view's document.

TView * owl::TView::GetNextView ( ) [inline]

Returns the next global view ID to be assigned.

uint owl::TView::GetNextViewId ( ) [inline, static]

Next global ID to assign.

Returns the next view ID to be assigned.

int owl::TView::GetProperty ( int  prop,
void *  dest,
int  textlen = 0 
) [virtual]

Returns the total number of properties, where index is the property index, dest contains the property data, and textlen is the size of the property array. If textlen is 0, property data is returned as binary data; otherwise, property data is returned as text data.

References GetViewName(), ViewClass, and ViewName.

void * owl::TView::GetTag ( ) const [inline]

Retrieves the user-defined pointer attached to this view.

uint owl::TView::GetViewId ( ) [inline]

Returns the unique ID for this view.

TMenuDescr * owl::TView::GetViewMenu ( ) [inline, virtual]

Returns the menu descriptor for this view. This can be any existing TMenuDescr object. If no descriptor exists, ViewMenu is 0.

Reimplemented in ocf::TOleView.

virtual LPCTSTR owl::TView::GetViewName ( ) [pure virtual]

Pure virtual function that returns 0. Override this function in your derived class to return the name of the class. Must implement, used by template manager for selection

 static LPCTSTR StaticName() {return "name of view";}

Implemented in owl::TTreeViewCtrlView, owl::TListViewCtrlView, owl::TWindowView, owl::TDialogView, owl::TEditView, owl::TListBoxView, owl::TPaneSplitterView, owl::TRichEditView, owl::TTabbedView, ocf::TOleView, and ocf::TOleLinkView.

TWindow * owl::TView::GetWindow ( ) [inline, virtual]
bool owl::TView::IsOK ( ) [inline]

true if successfully created

Returns a nonzero value if the view is successfully constructed.

void owl::TView::NotOK ( ) [inline, protected]

To flag errors in creation.

Sets the view to an invalid state, causing IsOK to return 0.

int owl::TView::PropertyCount ( ) [inline, virtual]

Gets the total number of properties for the TDocument object.

References NextProperty.

int owl::TView::PropertyFlags ( int  index) [virtual]

pfXxxxx bit array

Returns the attributes of a specified property given the index of the property whose attributes you want to retrieve.

References NextProperty, and PrevProperty.

const tchar * owl::TView::PropertyName ( int  index) [virtual]

locale invariant name

Returns the text name of the property given the index value.

References NextProperty, and PrevProperty.

bool owl::TView::SetDocTitle ( LPCTSTR  docname,
int  index 
) [inline, virtual]
bool owl::TView::SetProperty ( int  index,
const void *  src 
) [inline, virtual]

Sets the value of the property, given the index of the property, and src, the data type (either binary or text) to which the property must be set.

void owl::TView::SetTag ( void **  tag) [inline]

Associates an arbitrary (user-defined) pointer with this view.

Note:
The 'Tag' is not used by the Doc/View subsystem.
void owl::TView::SetViewBar ( TBarDescr bar)

Sets the menu descriptor for this view. This can be any existing TMenuDescr object. If no descriptor exists, ViewMenu is 0.


Friends And Related Function Documentation

friend class TDocument [friend]

needs access to NextView

friend class TDocument::Streamer [friend]

needs access to NextView


The documentation for this class was generated from the following files: