[Home] [Prev] [Next] [Up]
XGDocument class
Document base class
Usage:
#include <XDocument.h>
class XGDocument;
Description
This is the base class for constructing a document object. The document object is an object inserted in the XGDispatch hierarchy just above the window(s) that display the contents of this document, provides for managing the file and data associated with a document, if the window is a document-centric window.
The functionality of this class still needs work. In particular, the ReceiveDispatch routine needs to be written to have the document store which windows are opened to this document. And messages need to be derived to notify a window (and interested views) that a document changed, so the view can also be updated.
This is the one place where the YAAF framework is still pretty incomplete and bug-riddled. This and the XGDialog class, that is.
Inheritance
The XGDocument class inherits from the XGDispatch class, and is expected to be constructed before the XGWindow which displays this class, in order to make this the above the the XGWindow in the dispatch hierarchy. That allows the document to receive all messages sent to it's display windows, and allow the document to handle functionality like save and restore.
Construction/Destruction
XGDocument::XGDocument()
This constructs the document class. By default does nothing.
XGDocument::~XGDocument()
This does nothing currently. I think this should close the windows which are showing this document.
File Handling Methods
These methods are abstract; it is expected that these methods are provided by all documents. In particular, two methods (IsDirty and DoSave) are expected to be implemented by the XGWindow class--so that it can warn you tos ave the file before the winodw is closed.
bool XGDocument::IsNamed(void)
Return true if the document is associated with a file.
bool XGDocument::IsDirty(void)
Return true if the file needs to be saved.
bool XGDocument::DoSave(void)
Return true if the file was successfully saved. Returns false if the file wasn't saved because the save operation was canceled somehow.
bool XGDocument::DoSaveAs(void)
This renames the file before saving it, and returns true if the file is saved correctly.
bool XGDocument::DoRevert(void)
Return true if the file was reverted, and false if the file revert process was canceled.