rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Application Framework Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvDvDocTemplate Class Reference

Application Framework document template base class. More...

#include <ilviews/appframe/doctempl.h>

Inheritance diagram for IlvDvDocTemplate:
IlvDvSerializable IlvDvInterface

List of all members.

Public Member Functions

 IlvDvDocTemplate (const char *name=0)
 Constructs an IlvDvDocTemplate object.
virtual IlvDvDocumentcreateDocument ()
 Creates a new empty document.
IlvDvDocumentgetOpenedDocumentFromPath (const IlvPathName &pathName) const
 Retrieves the open document whose path matches the path pathName.
IlvToolBargetToolBar (const char *name) const
 Returns a toolbar contained by the document template.
virtual IlBoolean isProcessingAction (const IlSymbol *methodName) const
 Returns IlTrue if the given action can be processed by the class.
virtual IlBoolean matchPathName (const IlvPathName &pathName)
 Returns IlTrue if the path pathname matches the file filters contained in the document template.
virtual IlvDvDocumentnewDocument (IlBoolean createWindow=IlTrue, IlAny data=0)
 Creates a new empty document.
virtual IlvDvDocumentopenDocument (const IlvPathName &pathname, IlBoolean createWindow=IlTrue, IlBoolean addToMRU=IlTrue, IlAny data=0)
 Opens a new document using the path pathname.
virtual IlBoolean processAction (const IlSymbol *actionName)
 Processes an action.
virtual void serialize (IlvDvStream &)
 Serializes the object in the stream stream.
Typically, the body of the method has the following form:
.
void setContainerHandler (IlvDvContainerHandler *handler, IlUInt viewTemplateIndex=0)
 Sets the container handler handler to the document template. The previous container factory is deleted.

Protected Member Functions

virtual
IlvDvViewContainerInterface
createContainer (IlUInt viewTemplateIndex=0)
 Called to create a document view container.

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 ( const char *  name = 0  ) 

Constructs an IlvDvDocTemplate object.

This constructor creates an instance of IlvDvDocTemplate whose name is given by the parameter name. This name is unique to that particular document template. When reading options (default case), the specified name is replaced by the option one.


Member Function Documentation

virtual IlvDvViewContainerInterface* IlvDvDocTemplate::createContainer ( IlUInt  viewTemplateIndex = 0  )  [protected, virtual]

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.
virtual IlvDvDocument* IlvDvDocTemplate::createDocument (  )  [virtual]

Creates a new empty document.

The method newDocument must not be called.

Returns:
The new document.
IlvDvDocument* IlvDvDocTemplate::getOpenedDocumentFromPath ( const IlvPathName &  pathName  )  const

Retrieves the open document whose path matches the path pathName.

If no document was found, this method returns 0.

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.
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.

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

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

Returns:
IlTrue if the given path matches with the document template filters.
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:
data It is given as the parameter of the initializeDocument method of the document.
virtual IlvDvDocument* IlvDvDocTemplate::openDocument ( const IlvPathName &  pathname,
IlBoolean  createWindow = IlTrue,
IlBoolean  addToMRU = IlTrue,
IlAny  data = 0 
) [virtual]

Opens a new document using the path pathname.

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

Parameters:
createWindow If IlTrue, a view container, along with its views, is created for the new document.
addToMRU If IlTrue, the given file name is added to the list of the most recently used files.
data If the given path is empty, the data is given as the parameter of the initializeDocument method of the document.
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.

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.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

© Copyright 2012, 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.