OWLNext 7.0
Borland's Object Windows Library for the modern age
|
Abstract base class for view access from document. More...
#include <owl/docview.h>
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. | |
TDocument & | GetDocument () |
Returns a reference to the view's document. | |
void | SetDocument (TDocument &) |
uint | GetViewId () |
Returns the unique ID for this view. | |
virtual TMenuDescr * | GetViewMenu () |
Returns the menu descriptor for this view. | |
virtual TBarDescr * | GetViewBar () |
void | SetViewMenu (TMenuDescr *menu) |
void | SetViewBar (TBarDescr *bar) |
Sets the menu descriptor for this view. | |
bool | IsOK () |
true if successfully created | |
TView * | GetNextView () |
Returns the next global view ID to be assigned. | |
virtual LPCTSTR | GetViewName ()=0 |
Pure virtual function that returns 0. | |
virtual TWindow * | GetWindow () |
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. | |
void * | GetTag () 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 | |
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.
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.
owl::TView::TView | ( | TDocument & | doc | ) |
|
virtual |
|
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.
Definition at line 448 of file docview.h.
References FindProperty().
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.
|
inline |
|
inline |
|
inlinestatic |
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.
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.
Definition at line 207 of file view.cpp.
References _A2W, _OBJ_FULLTYPENAME, _T, _tcslen, _USES_CONVERSION, GetViewName(), TRACEX, ViewClass, and ViewName.
|
inline |
|
inline |
|
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.
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
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.
|
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.
|
inline |
|
inlineprotected |
|
inlinevirtual |
Gets the total number of properties for the TDocument object.
Definition at line 1078 of file docview.h.
References NextProperty.
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.
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.
Definition at line 442 of file docview.h.
References SetDocTitle().
Stores the document title.
Reimplemented in owl::TWindowView, owl::TDialogView, owl::TEditView, owl::TListBoxView, owl::TPaneSplitterView, owl::TRichEditView, ocf::TOleView, owl::TTreeViewCtrlView, owl::TListViewCtrlView, owl::TWindowView, owl::TDialogView, owl::TEditView, owl::TListBoxView, owl::TPaneSplitterView, owl::TRichEditView, and owl::TTabbedView.
Sets the menu descriptor for this view.
This can be any existing TMenuDescr object. If no descriptor exists, ViewMenu is 0.
void owl::TView::SetViewMenu | ( | TMenuDescr * | menu | ) |
Definition at line 95 of file view.cpp.
References owl::TMenuDescr::GetModule(), owl::TDocument::GetTemplate(), and owl::TMenuDescr::SetModule().