class XGDocument

Declared in <XDocument.h>
Declared from XGSend, XGDispatch

This is the basic document class. This is the root object used for defining a document, a database which mediates between the contents of a file and the editing done in a window.


Construction/Destruction

XGDocument::XGDocument
XGDocument::~XGDocument

Document message wrappers

XGDocument::DispatchChanged
XGDocument::DocumentChanged
XGDocument::DocumentRenamed
XGDocument::DocumentSaved

Document save/restore hooks

XGDocument::DoDocumentRevert
XGDocument::DoDocumentSave
XGDocument::DoDocumentSaveAs
XGDocument::GetDocumentName
XGDocument::IsDocumentDirty
XGDocument::IsDocumentNamed

Window Management

XGDocument::AttachWindow
XGDocument::DetachWindow
XGDocument::GetAttachedWindow
XGDocument::GetNumAttachWindows
XGDocument::LastEditWindow


Construction/Destruction

XGDocument::XGDocument

Usage: long XGDispatch::DoDispatch(long msg,long arg,void*parg,bool par)

Create this

XGDocument::~XGDocument

Usage: XGDocument::~XGDocument()

Delete this

Document message wrappers

XGDocument::DispatchChanged

Usage: void XGDocument::DispatchChanged(void)

Run through and notify all the windows that the contents changed

XGDocument::DocumentChanged

Usage: void DocumentChanged()

This method is called by the document when it's contents are changed. This marks the document as changed, and at the end of the current event loop, dispatches a message that this document changed to all registered dispatch listeners.

XGDocument::DocumentRenamed

Usage: void XGDocument::DocumentRenamed(void)

Send the document renamed message to all interested receivers

XGDocument::DocumentSaved

Usage: void XGDocument::DocumentSaved(void)

Send the document savedc message to all interested receivers

Document save/restore hooks

XGDocument::DoDocumentRevert

Usage: virtual bool IsDocumentNamed()=0 virtual bool IsDocumentDirty()=0 virtual void GetDocumentName(char*)=0 virtual bool DoDocumentSave()=0 virtual bool DoDocumentSaveAs()=0 virtual void DoDocumentRevert()=0

Reverts the contents of this file from the values written to disk.

XGDocument::DoDocumentSave

Usage: virtual bool IsDocumentNamed()=0 virtual bool IsDocumentDirty()=0 virtual void GetDocumentName(char*)=0 virtual bool DoDocumentSave()=0

Attempts to save this document. Returns 'true' if the file was successfully saved.

XGDocument::DoDocumentSaveAs

Usage: virtual bool IsDocumentNamed()=0 virtual bool IsDocumentDirty()=0 virtual void GetDocumentName(char*)=0 virtual bool DoDocumentSave()=0 virtual bool DoDocumentSaveAs()=0

Attempts to save this document to a new file. Returns 'true' if successful.

XGDocument::GetDocumentName

Usage: virtual bool IsDocumentNamed()=0 virtual bool IsDocumentDirty()=0 virtual void GetDocumentName(char*)=0

Returns the name of this document.

XGDocument::IsDocumentDirty

Usage: virtual bool IsDocumentNamed()=0 virtual bool IsDocumentDirty()=0

Returns 'true' if this document is dirty and needs to be saved to file.

XGDocument::IsDocumentNamed

Usage: virtual bool IsDocumentNamed()=0

Returns 'true' if this document has a file name.

Window Management

XGDocument::AttachWindow

Usage: void XGDocument::AttachWindow(XGWindow*w,bool sdf)

Attach to this window.

the 'sdf' parameter is true if this is a 'sub-document editor'.

The idea is this. There are two types of windows which are associated with a document; a 'top level' editor window which is associated with the document, and a 'sub editor' which only views part of that document. This permits both the 'every window is a snapshot into a document' (such as used by text editors), and the 'window edits only one part of a document' model, such as that used by ResEdit.

When all the top level windows into a document is closed, the document destroys itself, and all the 'subwindows' that are also open; this is the same behaviour as used by ResEdit.

Note: there needs to be at least one top level editor window.

Also note: while the document is created first, and the document pointer is provided to the window, the window must be explicitly attached to the document.

XGDocument::DetachWindow

Usage: void XGDocument::DetachWindow(XGWindow*w)

Search and delete this window

XGDocument::GetAttachedWindow

Usage: XGWindow*XGDocument::GetAttachedWindow(long index)

Get this attached window

XGDocument::GetNumAttachWindows

Usage: long XGDocument::GetNumAttachWindows()

Get the number of attached windows in this thing

XGDocument::LastEditWindow

Usage: bool XGDocument::LastEditWindow(XGWindow*w)

This returns true if there is only one non-fSubDoc window left