OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TView Class Referenceabstract

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

#include <owl/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

Public Types

enum  TViewProp { PrevProperty = 0 , ViewClass , ViewName , NextProperty }
 These property values, which describe the basic properties of a view, are available in classes derived from TView. More...
 
- Public Types inherited from owl::TEventHandler
typedef bool(* TEqualOperator) (const TGenericTableEntry &, const TEventInfo &)
 

Public Member Functions

 TView (TDocument &doc)
 Constructs a TView object of the document associated with the view.
 
virtual ~TView ()
 Frees a TView object and calls TDocument's private member function DetachView to detach the view from the associated document.
 
TDocumentGetDocument ()
 Returns a reference to the view's document.
 
void SetDocument (TDocument &)
 
uint GetViewId ()
 Returns the unique ID for this view.
 
virtual TMenuDescrGetViewMenu ()
 Returns the menu descriptor for this view.
 
virtual TBarDescrGetViewBar ()
 
void SetViewMenu (TMenuDescr *menu)
 
void SetViewBar (TBarDescr *bar)
 Sets the menu descriptor for this view.
 
bool IsOK ()
 true if successfully created
 
TViewGetNextView ()
 Returns the next global view ID to be assigned.
 
virtual LPCTSTR GetViewName ()=0
 Pure virtual function that returns 0.
 
virtual TWindowGetWindow ()
 Returns the TWindow instance associated with the view, or 0 if no view exists.
 
virtual bool SetDocTitle (LPCTSTR docname, int index)
 Stores the document title.
 
bool SetDocTitle (const tstring &docname, int index)
 
virtual int PropertyCount ()
 Gets the total number of properties for the TDocument object.
 
virtual int FindProperty (LPCTSTR name)
 return property index
 
int FindProperty (const tstring &name)
 
virtual int PropertyFlags (int index)
 pfXxxxx bit array
 
virtual LPCTSTR PropertyName (int index)
 locale invariant name
 
virtual int GetProperty (int index, void *dest, int textlen=0)
 Retrieves the property identified by the given index.
 
virtual bool SetProperty (int index, const void *src)
 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.
 
voidGetTag () const
 Retrieves the user-defined pointer attached to this view.
 
void SetTag (void **tag)
 Associates an arbitrary (user-defined) pointer with this view.
 
- Public Member Functions inherited from owl::TEventHandler
virtual bool Find (TEventInfo &info, TEqualOperator op=0)
 Searches the list of response table entries looking for a match.
 
TResult Dispatch (TEventInfo &info, TParam1, TParam2=0)
 Takes the message data from TEventInfo's Msg data member and dispatches it to the correct event-handling function.
 
TResult DispatchMsg (TMsgId, uint id, TParam1, TParam2)
 Search for the event given the message and it and dispatch to the event handler if found.
 
- Public Member Functions inherited from owl::TStreamableBase
virtual ~TStreamableBase ()
 

Static Public Member Functions

static uint GetNextViewId ()
 Next global ID to assign.
 
static void BumpNextViewId ()
 Increments an internal count used by the Doc/View subsystem to identify each view.
 

Protected Member Functions

void NotOK ()
 To flag errors in creation.
 
- Protected Member Functions inherited from owl::TEventHandler
bool SearchEntries (const TGenericTableEntry *entries, TEventInfo &info, TEqualOperator op)
 Low-level response table search function.
 

Friends

class TDocument
 needs access to NextView
 

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.

Definition at line 393 of file docview.h.

Member Enumeration Documentation

◆ TViewProp

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.

Definition at line 400 of file docview.h.

Constructor & Destructor Documentation

◆ TView()

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.

Definition at line 34 of file view.cpp.

◆ ~TView()

owl::TView::~TView ( )
virtual

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

Definition at line 48 of file view.cpp.

References _T, and WARN.

Member Function Documentation

◆ BumpNextViewId()

void owl::TView::BumpNextViewId ( )
static

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

Definition at line 247 of file view.cpp.

References owl::MinUniqueViewId.

◆ FindProperty() [1/2]

int owl::TView::FindProperty ( const tstring & name)
inline

Definition at line 445 of file docview.h.

References FindProperty().

◆ FindProperty() [2/2]

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.

Definition at line 169 of file view.cpp.

References _T, _tcscmp, NextProperty, PRECONDITION, PrevProperty, and TRACEX.

◆ GetDocument()

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

Returns a reference to the view's document.

Definition at line 1001 of file docview.h.

◆ GetNextView()

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

Returns the next global view ID to be assigned.

Definition at line 1041 of file docview.h.

◆ GetNextViewId()

uint owl::TView::GetNextViewId ( )
inlinestatic

Next global ID to assign.

Returns the next view ID to be assigned.

Definition at line 1034 of file docview.h.

◆ GetProperty()

int owl::TView::GetProperty ( int index,
void * dest,
int textlen = 0 )
virtual

Retrieves the property identified by the given index.

If the requested property is text, then dest should point to a text buffer, and textlen should specify the maximum number of characters the buffer can hold, excluding the terminating null-character, i.e. the buffer must have room for (textlen + 1) characters.

If the requested property is numerical, then it may be requested either as text or in its binary form. To request the property as text, pass a text buffer as described above. To request the property in binary form, dest should point to storage of sufficent size, and textlen should be zero.

Non-text properties without textual representation, e.g. file handles, may only be requested in binary form, i.e. dest must point to sufficient storage, and textlen must be zero.

Returns
If the parameter textlen is non-zero, which means that the property is requested in string form, the function returns the length of the string, i.e. the character count excluding the terminating null-character. If the parameter textlen is zero, which means that property is requested in binary form, the return value is the size of the data in bytes.

If the property is text, and textlen is zero, the function fails and returns 0. The function also fails and returns 0 if textlen is non-zero and the property requested can not be expressed as text. It also returns 0 if the property is not defined.

See also
TView::TViewProp

Definition at line 207 of file view.cpp.

References _A2W, _OBJ_FULLTYPENAME, _T, _tcslen, _USES_CONVERSION, GetViewName(), TRACEX, ViewClass, and ViewName.

◆ GetTag()

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

Retrieves the user-defined pointer attached to this view.

Definition at line 1053 of file docview.h.

◆ GetViewBar()

TBarDescr * owl::TView::GetViewBar ( )
inlinevirtual

Definition at line 1021 of file docview.h.

◆ GetViewId()

uint owl::TView::GetViewId ( )
inline

Returns the unique ID for this view.

Definition at line 1008 of file docview.h.

◆ GetViewMenu()

TMenuDescr * owl::TView::GetViewMenu ( )
inlinevirtual

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.

Definition at line 1016 of file docview.h.

◆ GetViewName()

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 ocf::TOleView, ocf::TOleLinkView, owl::TTreeViewCtrlView, owl::TListViewCtrlView, owl::TWindowView, owl::TDialogView, owl::TEditView, owl::TListBoxView, owl::TPaneSplitterView, owl::TRichEditView, and owl::TTabbedView.

◆ GetWindow()

TWindow * owl::TView::GetWindow ( )
inlinevirtual

Returns the TWindow instance associated with the view, or 0 if no view exists.

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

Definition at line 1046 of file docview.h.

◆ IsOK()

bool owl::TView::IsOK ( )
inline

true if successfully created

Returns a nonzero value if the view is successfully constructed.

Definition at line 1028 of file docview.h.

◆ NotOK()

void owl::TView::NotOK ( )
inlineprotected

To flag errors in creation.

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

Definition at line 1090 of file docview.h.

◆ PropertyCount()

int owl::TView::PropertyCount ( )
inlinevirtual

Gets the total number of properties for the TDocument object.

Definition at line 1075 of file docview.h.

References NextProperty.

◆ PropertyFlags()

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.

Definition at line 150 of file view.cpp.

References _T, NextProperty, PrevProperty, and TRACEX.

◆ PropertyName()

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

locale invariant name

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

Definition at line 131 of file view.cpp.

References _T, NextProperty, PrevProperty, and TRACEX.

◆ SetDocTitle() [1/2]

bool owl::TView::SetDocTitle ( const tstring & docname,
int index )
inline

Definition at line 439 of file docview.h.

References SetDocTitle().

◆ SetDocTitle() [2/2]

◆ SetDocument()

void owl::TView::SetDocument ( TDocument & new_doc)

Definition at line 67 of file view.cpp.

References CHECK.

◆ SetProperty()

bool owl::TView::SetProperty ( int index,
const void * src )
inlinevirtual

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.

Definition at line 1083 of file docview.h.

◆ SetTag()

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.

Definition at line 1061 of file docview.h.

◆ SetViewBar()

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.

Definition at line 111 of file view.cpp.

◆ SetViewMenu()

void owl::TView::SetViewMenu ( TMenuDescr * menu)

Friends And Related Symbol Documentation

◆ TDocument

needs access to NextView

Definition at line 474 of file docview.h.


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