Rogue Wave Views
Application Framework Package API Reference Guide
Product Documentation:

Rogue Wave Views
Documentation Home
List of all members | Public Member Functions | Protected Member Functions
IlvDvDocTemplate Class Reference

Application Framework document template base class. More...

#include <ilviews/appframe/doctempl.h>

Inheritance diagram for IlvDvDocTemplate:
IlvDvSerializable IlvDvInterface

Public Member Functions

 IlvDvDocTemplate (const char *name=0)
 Initializes a new IlvDvDocTemplate. More...
 
virtual IlvDvDocumentcreateDocument ()
 Creates a new empty document. More...
 
IlvDvDocumentgetOpenedDocumentFromPath (const IlvPathName &) const
 Retrieves the open document whose path matches the path pathName. More...
 
IlvToolBargetToolBar (const char *name) const
 Returns a toolbar contained by the document template. More...
 
virtual IlBoolean isProcessingAction (const IlSymbol *methodName) const
 Returns IlTrue if the given action can be processed by the class. More...
 
virtual IlBoolean matchPathName (const IlvPathName &pathName)
 Returns IlTrue if a path name matches the file filters contained in the document template. More...
 
virtual IlvDvDocumentnewDocument (IlBoolean createWindow=IlTrue, IlAny data=0)
 Creates a new empty document. More...
 
virtual IlvDvDocumentopenDocument (const IlvPathName &pathname, IlBoolean createWindow=IlTrue, IlBoolean addToMRU=IlTrue, IlAny data=0)
 Opens a new document using a file path. More...
 
virtual IlBoolean processAction (const IlSymbol *actionName)
 Processes an action. More...
 
virtual void serialize (IlvDvStream &)
 Serializes the object in the stream stream.
Typically, the body of the method has the following form:
More...
 
void setContainerHandler (IlvDvContainerHandler *handler, IlUInt viewTemplateIndex=0)
 Sets the container handler handler to the document template. The previous container factory is deleted.
 
- Public Member Functions inherited from IlvDvInterface
IlBoolean callMethod (const IlSymbol *methodName, IlvDvValue *returnedValue,...)
 Generic method for calling a method that is exported in a class interface. More...
 
IlvDvValuegetFieldValue (const IlSymbol *fieldName, IlvDvValue &value) const
 Gets a field value. More...
 
virtual IlBoolean refreshAction (const IlSymbol *actionName, IlvDvActionDescriptor *desc) const
 Refresh all the menu items that reference the action given by the parameter actionName. More...
 
void setFieldValue (const IlSymbol *fieldName, const IlvDvValue &value)
 Sets a field value. More...
 

Protected Member Functions

virtual IlvDvViewContainerInterfacecreateContainer (IlUInt viewTemplateIndex=0)
 Called to create a document view container. More...
 

Detailed Description

Application Framework document template base class.

Library: ilvappframe

The IlvDvDocTemplate class manages all documents of a given class. These documents must be derived from IlvDvDocument. You do not need to subclass or even use the document template class directly.

All data specified in the Application Framework Editor is usually sufficient and does not require additional data or behaviors for the document template.

Document template goal

The document template manages all aspects of the creation and the display of the document; everything from the activation of the menu items File/Open... or File/New..., to the creation of a window with document views inside.

Document creation steps

When methods newDocument() or openDocument() are called, the document template creates and displays the document by following these steps. First, it creates a document. If a file name is specified, it calls the IlvDvDocument::serialize() method. Otherwise, it calls the IlvDvDocument::initializeDocument() method.

Then, it creates a window called a document view container. This window can be a view frame (IlvDvViewFrame class) or a dockable bar (IlvDvViewPane class), depending on the generated options.

After the document view container is created, it creates document views that are inserted in the container. Then, it makes the window active and inserts dynamic menus and toolbars into the main menus and toolbars of the IlvDvDockableMainWindow frame.

Finally, the added menu items are refreshed by the active document view or its document, according to the attached actions.

Constructor & Destructor Documentation

§ IlvDvDocTemplate()

IlvDvDocTemplate::IlvDvDocTemplate ( const char *  name = 0)

Initializes a new IlvDvDocTemplate.

This name is unique to that particular document template. When reading options (default case), the specified name is replaced by the option one.

Parameters
nameThe name for this new object. This string is copied.

Member Function Documentation

§ createContainer()

virtual IlvDvViewContainerInterface* IlvDvDocTemplate::createContainer ( IlUInt  viewTemplateIndex = 0)
protectedvirtual

Called to create a document view container.

By default, the method calls the method createContainer() of its container factory.

Returns
A new document view container.

§ createDocument()

virtual IlvDvDocument* IlvDvDocTemplate::createDocument ( )
virtual

Creates a new empty document.

The method newDocument() must not be called.

Returns
The new document.

§ getOpenedDocumentFromPath()

IlvDvDocument* IlvDvDocTemplate::getOpenedDocumentFromPath ( const IlvPathName &  ) const

Retrieves the open document whose path matches the path pathName.

If no document was found, this method returns 0.

§ getToolBar()

IlvToolBar* IlvDvDocTemplate::getToolBar ( const char *  name) const

Returns a toolbar contained by the document template.

This method returns the toolbar owned by the document with the name name. Document template toolbars are docked to the main window when a document created by this document template becomes active (by activating one of its views, for example).

Returns
The toolbar with the name name. It returns 0 if no toolbar with this name is found.

§ isProcessingAction()

virtual IlBoolean IlvDvDocTemplate::isProcessingAction ( const IlSymbol methodName) const
virtual

Returns IlTrue if the given action can be processed by the class.

Returns
IlTrue if the given action can be processed by the class.

Reimplemented from IlvDvInterface.

§ matchPathName()

virtual IlBoolean IlvDvDocTemplate::matchPathName ( const IlvPathName &  pathName)
virtual

Returns IlTrue if a path name matches the file filters contained in the document template.

Parameters
pathNameThe path name to test.
Returns
IlTrue if the given path matches with the document template filters.

§ newDocument()

virtual IlvDvDocument* IlvDvDocTemplate::newDocument ( IlBoolean  createWindow = IlTrue,
IlAny  data = 0 
)
virtual

Creates a new empty document.

An associated document view container and its document views are automatically created and displayed.

Parameters
createWindowIf IlTrue, a view container, along with its views, is created for the new document.
dataIt is given as the parameter of the initializeDocument() method of the document.

§ openDocument()

virtual IlvDvDocument* IlvDvDocTemplate::openDocument ( const IlvPathName &  pathname,
IlBoolean  createWindow = IlTrue,
IlBoolean  addToMRU = IlTrue,
IlAny  data = 0 
)
virtual

Opens a new document using a file path.

An associated container and its document views are automatically created and displayed.

Parameters
pathnameSpecifies the file path.
createWindowIf IlTrue, a view container, along with its views, is created for the new document.
addToMRUIf IlTrue, the given file name is added to the list of the most recently used files.
dataIf the given path is empty, the data is given as the parameter of the initializeDocument() method of the document.

§ processAction()

virtual IlBoolean IlvDvDocTemplate::processAction ( const IlSymbol actionName)
virtual

Processes an action.

Tries to process the action given by the parameter actionName. If a macro Action(actionName, actionMethod) is inserted in the interface table of the class with a specified external name equal to the actionName parameter, the processAction method will automatically call the actionMethod method.

Returns
IlTrue if the action is processed.

Reimplemented from IlvDvInterface.

§ serialize()

virtual void IlvDvDocTemplate::serialize ( IlvDvStream stream)
virtual

Serializes the object in the stream stream.
Typically, the body of the method has the following form:

void
MyClass::serialize(IlvDvStream& stream) {
Superclass::serialize(stream);
if (stream.isSaving()) {
// Here, write your persistent data
} else {
// Here, read data from stream
}
}

There are two ways to load and save data.
One way is to use istream or ostream objects given by methods istream* getInStream() const and ostream* getOutStream() const from the IlvDvStream class directly.
The other way, which is usually easier, is to use specific serialization methods provided by the IlvDvStream class.
This class provides serialization operators for basic types (IlInt, IlBoolean, and so on), and provides methods that make it easy to save a string, a bitmap, an IlvDvSerializable object, and an array of IlvDvSerializable objects.

Reimplemented from IlvDvSerializable.


© Copyright 2017, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.