Views Application Framework Package API Reference Guide |
Views Documentation Home |
Application Framework document template base class. More...
#include <ilviews/appframe/doctempl.h>
Public Member Functions | |
IlvDvDocTemplate (const char *name=0) | |
Initializes a new IlvDvDocTemplate . More... | |
virtual IlvDvDocument * | createDocument () |
Creates a new empty document. More... | |
IlvDvDocument * | getOpenedDocumentFromPath (const IlvPathName &) const |
Retrieves the open document whose path matches the path pathName. More... | |
IlvToolBar * | getToolBar (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 IlvDvDocument * | newDocument (IlBoolean createWindow=IlTrue, IlAny data=0) |
Creates a new empty document. More... | |
virtual IlvDvDocument * | openDocument (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... | |
IlvDvValue & | getFieldValue (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 IlvDvViewContainerInterface * | createContainer (IlUInt viewTemplateIndex=0) |
Called to create a document view container. More... | |
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.
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.
name | The name for this new object. This string is copied. |
|
protectedvirtual |
Called to create a document view container.
By default, the method calls the method createContainer()
of its container factory.
|
virtual |
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.
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 IlTrue
if the given action can be processed by the class.
IlTrue
if the given action can be processed by the class. Reimplemented from IlvDvInterface.
|
virtual |
Returns IlTrue
if a path name matches the file filters contained in the document template.
pathName | The path name to test. |
IlTrue
if the given path matches with the document template filters.
|
virtual |
Creates a new empty document.
An associated document view container and its document views are automatically created and displayed.
createWindow | If IlTrue , a view container, along with its views, is created for the new document. |
data | It is given as the parameter of the initializeDocument() method of the document. |
|
virtual |
Opens a new document using a file path.
An associated container and its document views are automatically created and displayed.
pathname | Specifies the file path. |
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. |
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.
IlTrue
if the action is processed. Reimplemented from IlvDvInterface.
|
virtual |
Serializes the object in the stream stream.
Typically, the body of the method has the following form:
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.