Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Application Framework document view base class. More...
#include <ilviews/appframe/view.h>
Public Member Functions | |
IlvDvDocument * | getDocument () const |
Gets the document associated with the view. | |
IlvDvApplication * | getDvApplication () const |
Gets the application in which the document view is displayed. | |
virtual IlvAbstractView * | getDvView () |
Gets the IlvAbstractView of the document view. | |
virtual IlvGraphic * | getGraphic () |
Gets the graphic object of the document view. | |
IlvDvViewContainerInterface * | getViewContainer () const |
Gets the document view container that owns the view. | |
virtual void | initializeView () |
Initializes the document view. | |
virtual void | serialize (IlvDvStream &) |
Serializes the object in the stream stream. Typically, the body of the method has the following form: . |
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: IlvDvDocViewContext* _context; virtual IlvDvDocViewContext* createViewContext(); virtual IlvDvDocViewContext* getViewContext() const; }; IlvDvDocViewContext* MyDocumentView::createViewContext() { _context = new IlvDvDocViewContext(this); return _context; } IlvDvDocViewContext* MyDocumentView::getViewContext() const { return _context; }
IlvDvDocument* IlvDvDocViewInterface::getDocument | ( | ) | const |
Gets the document associated with the view.
IlvDvApplication* IlvDvDocViewInterface::getDvApplication | ( | ) | const |
Gets the application in which the document view is displayed.
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
.
Reimplemented in IlvDvFormView, and IlvDvView.
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
.
Reimplemented in IlvDvFormView, IlvDvTextView, IlvDvListView, IlvDvTreeView, IlvDvMatrixView, IlvDvSheetView, and IlvDvHierarchicalSheetView.
IlvDvViewContainerInterface* IlvDvDocViewInterface::getViewContainer | ( | ) | const |
Gets the document view container that owns the view.
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 IlvDvFormView, IlvDvGrapherView, IlvDvManagerView, IlvDvProjectView, and IlvDvTextView.
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.
© 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.