|
JX Application Framework
|
#include <JXDocument.h>
Public Member Functions | |
| JXDocument (JXDirector *supervisor) | |
| ~JXDocument () override | |
| bool | Close () override |
| bool | Deactivate () override |
| bool | GetMenuIcon (const JXImage **icon) const override |
| bool | NeedsSave () const override |
| virtual bool | NeedDocument (JXDocument *doc) const |
| void | RevertToSaved () |
| virtual void | SafetySave (const JXDocumentManager::SafetySaveReason reason)=0 |
Public Member Functions inherited from JXWindowDirector | |
| JXWindowDirector (JXDirector *supervisor) | |
| ~JXWindowDirector () override | |
| void | Activate () override |
| bool | Deactivate () override |
| void | Suspend () override |
| void | Resume () override |
| JXWindow * | GetWindow () const |
| JXDisplay * | GetDisplay () const |
| virtual const JString & | GetName () const |
Public Member Functions inherited from JXDirector | |
| JXDirector (JXDirector *supervisor) | |
| ~JXDirector () override | |
| bool | IsClosing () const |
| bool | IsActive () const |
| bool | IsSuspended () const |
| bool | HasSubdirectors () const |
| bool | GetSubdirectors (const JPtrArray< JXDirector > **list) const |
Public Member Functions inherited from JBroadcaster | |
| JBroadcaster () | |
| virtual | ~JBroadcaster () |
| JBroadcaster & | operator= (const JBroadcaster &source) |
| bool | HasSenders () const |
| JSize | GetSenderCount () const |
| bool | HasRecipients () const |
| JSize | GetRecipientCount () const |
| virtual JString | ToString () const |
| template<class T > | |
| void | ListenTo (const JBroadcaster *sender, const std::function< void(const T &)> &f) |
Protected Member Functions | |
| virtual bool | OKToClose ()=0 |
| virtual bool | OKToRevert ()=0 |
| virtual bool | CanRevert ()=0 |
| virtual void | DiscardChanges ()=0 |
| bool | OKToDeactivate () override |
Protected Member Functions inherited from JXDirector | |
| JXDirector * | GetSupervisor () const |
| bool | CloseAllSubdirectors () |
| virtual void | DirectorClosed (JXDirector *theDirector) |
Protected Member Functions inherited from JBroadcaster | |
| JBroadcaster (const JBroadcaster &source) | |
| void | ListenTo (const JBroadcaster *sender) |
| void | StopListening (const JBroadcaster *sender) |
| void | ClearWhenGoingAway (const JBroadcaster *sender, void *pointerToMember) |
| void | StopListening (const JBroadcaster *sender, const std::type_info &messageType) |
| template<class T > | |
| void | Send (JBroadcaster *recipient, const T &message) |
| template<class T > | |
| void | Broadcast (const T &message) |
| virtual void | Receive (JBroadcaster *sender, const Message &message) |
| void | SendWithFeedback (JBroadcaster *recipient, Message *message) |
| void | BroadcastWithFeedback (Message *message) |
| virtual void | ReceiveWithFeedback (JBroadcaster *sender, Message *message) |
| virtual void | ReceiveGoingAway (JBroadcaster *sender) |
Interface for the JXDocument class
Maintains some information and a window that displays it.
Derived classes must override OKToClose so they can save data
or otherwise let the user clean things up before closing. (Clean up
that doesn't involve the user should be done in the destructor.)
OKToDeactivate() is automatically wired to OKToClose() on the assumption
that the user can't tell the difference (and shouldn't have to, either!)
between closing a document and merely hiding its window.
Derived classes must also override the following function:
NeedsSave
Returns true if the data needs to be saved.
OKToRevert
Ask the user if it is OK to revert to the latest saved version
of this document.
CanRevert
Returns true if it is possible to revert to a saved version
of this document.
SafetySave
Save the data in a temporary file, in case the program crashes.
No error reporting is allowed because one possibility is
that the GUI itself has died.
GetMenuIcon
Return a small icon for the document. This is used when building
a menu of all the documents that are open. JXFileDocument
implements this to return jx_plain_file_small.
The result is JXPM instead of JXImage because JXImage is
restricted to a single display.
Derived classes may want to override the following functions:
GetName
Return a name for the document. This is used when building
a menu of all the documents that are open, so it should be
unique (though it doesn't have to be). The default implementation
is to return the title of our window. JXFileDocument overrides
this to return the name of its file.
NeedDocument
Return true if you need the given document to stay open.
The document dependency graph must be acyclic.
| JXDocument::JXDocument | ( | JXDirector * | supervisor | ) |
|
override |
|
protectedpure virtual |
Implemented in JXFileDocument.
|
overridevirtual |
Returns true if the user ok's it and nobody needs us.
Reimplemented from JXDirector.
|
overridevirtual |
The user can't tell the difference between hiding and closing.
Reimplemented from JXDirector.
|
protectedpure virtual |
Return an icon to display in JXWDMenu.
Does not return JXImage* because that would force all derived classes to provide an icon, and many don't need it.
The client retains ownership of the JXImage.
Reimplemented from JXWindowDirector.
|
virtual |
Derived classes should override if they require that other documents must stay open.
The dependency graph must be acyclic!
|
overridevirtual |
Must be overridden, but can't be pure virtual because originally defined in JXWindowDirector.
Reimplemented from JXWindowDirector.
Reimplemented in JXFileDocument.
|
protectedpure virtual |
Implemented in JXFileDocument.
|
overrideprotectedvirtual |
The user can't tell the difference between hiding and closing.
Reimplemented from JXWindowDirector.
|
protectedpure virtual |
Implemented in JXFileDocument.
| void JXDocument::RevertToSaved | ( | ) |
|
pure virtual |
Implemented in JXFileDocument.