Views
Application Framework Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions
IlvDvDocViewInterface Class Referenceabstract

Application Framework document view base class. More...

#include <ilviews/appframe/view.h>

Inheritance diagram for IlvDvDocViewInterface:
IlvDvSerializable IlvDvInterface IlvDvFormView IlvDvHierarchicalSheetView IlvDvListView IlvDvMatrixView IlvDvSheetView IlvDvTextView IlvDvTreeView IlvDvView

Public Member Functions

IlvDvDocumentgetDocument () const
 Gets the document associated with the view. More...
 
IlvDvApplicationgetDvApplication () const
 Gets the application in which the document view is displayed. More...
 
virtual IlvAbstractViewgetDvView ()
 Gets the IlvAbstractView of the document view. More...
 
virtual IlvGraphicgetGraphic ()
 Gets the graphic object of the document view. More...
 
IlvDvViewContainerInterfacegetViewContainer () const
 Gets the document view container that owns the view. More...
 
virtual void initializeView ()
 Initializes the document view. More...
 
virtual void serialize (IlvDvStream &)
 Serializes the object in the stream stream.
Typically, the body of the method has the following form:
More...
 
- 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 isProcessingAction (const IlSymbol *methodName) const
 Returns IlTrue if the given action can be processed by the class. More...
 
virtual IlBoolean processAction (const IlSymbol *actionName)
 Processes an action. 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...
 

Detailed Description

Application Framework document view base class.

Library: ilvappframe

The IlvDvDocViewInterface class is an interface for document views. It displays an attached document given by method getDocument(), and interacts with it using Application Framework interfaces.

Usually, the IlvDvDocViewInterface interface does not need to be implemented. The Application Framework package provides many gadget or view classes that implement this interface. It is recommended to inherit from these. In this case, the inherited class has to redefine the method initializeView() and track the user interactions in order to reflect them to the attached document.

However, for a specific use, it is possible to implement the IlvDvDocViewInterface interface. For that, the implementation must define and handle an IlvDvDocViewContext field member as follows:

class MyDocumentView
: public MyGadget, public IlvDvDocViewInterface {
public:
MyDocumentView(<list of parameters>) : _context(0) {}
~MyDocumentView() { if (_context) delete _context; }
protected:
virtual IlvDvDocViewContext* createViewContext();
virtual IlvDvDocViewContext* getViewContext() const;
};
MyDocumentView::createViewContext()
{
_context = new IlvDvDocViewContext(this);
return _context;
}
MyDocumentView::getViewContext() const
{
return _context;
}

Member Function Documentation

◆ getDocument()

IlvDvDocument* IlvDvDocViewInterface::getDocument ( ) const

Gets the document associated with the view.

Returns
The document associated with the view.

◆ getDvApplication()

IlvDvApplication* IlvDvDocViewInterface::getDvApplication ( ) const

Gets the application in which the document view is displayed.

Returns
The application in which the document view is displayed.

◆ getDvView()

virtual IlvAbstractView* IlvDvDocViewInterface::getDvView ( )
virtual

Gets the IlvAbstractView of the document view.

Must be redefined by the class that implements the interface if the class inherits from the IlvAbstractView class. In this case, the redefined method must only return this object. For example, the IlvDvView class redefines the method to return (IlvView*)this object. By default, the method returns 0.

Returns
The abstract view of the document view.

Reimplemented in IlvDvView, and IlvDvFormView.

◆ getGraphic()

virtual IlvGraphic* IlvDvDocViewInterface::getGraphic ( )
virtual

Gets the graphic object of the document view.

Must be redefined by the class that implements the interface if the class inherits from the IlvGraphic class. In this case, the redefined method only returns this object. For example, the IlvDvTextView class redefines this method to return (IlvText*)this object. By default, the method returns 0.

Returns
The graphic object of the document view.

Reimplemented in IlvDvHierarchicalSheetView, IlvDvSheetView, IlvDvMatrixView, IlvDvTreeView, IlvDvListView, IlvDvTextView, and IlvDvFormView.

◆ getViewContainer()

IlvDvViewContainerInterface* IlvDvDocViewInterface::getViewContainer ( ) const

Gets the document view container that owns the view.

Returns
The document view container that owns the view.

◆ initializeView()

virtual void IlvDvDocViewInterface::initializeView ( )
virtual

Initializes the document view.

Called by the document associated with the view to initialize its contents. Typically, gadget classes that implement the IlvDvDocViewInterface interface initialize the gadget using the associated document data.

Reimplemented in IlvDvTextView, IlvDvProjectView, IlvDvManagerView, IlvDvGrapherView, and IlvDvFormView.

◆ serialize()

virtual void IlvDvDocViewInterface::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.

IlvDvDocViewContext
The IlvDvDocViewContext class is used internally by the IlvDvDocViewInterface class.
Definition: view.h:65
IlvDvStream
Application Framework stream base class.
Definition: stream.h:73
IlvDvDocViewInterface
Application Framework document view base class.
Definition: view.h:162
IlvDvStream::isSaving
IlBoolean isSaving() const
Returns IlTrue if the stream is used for saving data.
Definition: stream.h:342