31 #ifndef TBX_DOCMANAGER_H_
32 #define TBX_DOCMANAGER_H_
35 #include "../prequitlistener.h"
37 #include "../command.h"
38 #include "../loader.h"
133 std::list<Document *> _documents;
141 virtual ~NewDocumentCommand() {}
142 virtual void execute();
151 virtual ~QuitCommand() {};
152 virtual void execute();
161 virtual ~FileLoader() {}
166 void remove_document(
Document *doc);
205 bool load_files(
int num_files,
char *file_names[]);
206 bool load_file(
const std::string &file_name,
int estimated_size = -1,
bool from_filer =
true);
Base class to help create a document and a window to show it in.
Definition: docmanager.h:51
Class to manage all the documents.
Definition: docmanager.h:129
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:35
unsigned int modified_count() const
Return number of documents modified.
Definition: docmanager.cc:89
bool load_files(int num_files, char *file_names[])
Load multiple files into documents and show windows for them.
Definition: docmanager.cc:219
virtual void create_window(Document *doc)=0
Create the window used to display the given document.
Listen for the pre quit message from the desktop.
Definition: prequitlistener.h:110
tbx::Loader * file_loader()
Return a loader to load a document into a new window.
Definition: docmanager.h:198
Base class for a document.
Definition: document.h:53
Class to handle file/data loading from the filer or an external application.
Definition: loader.h:179
virtual Document * create_document()
Override this method to create the document object.
Definition: docmanager.h:96
Class to show a toolbox Quit object that gives the user an option to Quit or Cancel the application.
Definition: quit.h:61
int file_type() const
Get the document file type.
Definition: docmanager.h:203
tbx::Command * quit_command()
Return a command that can be executed to quit the application showing a Quit dialogue if necessary.
Definition: docmanager.h:193
Event passed to pre quit listeners.
Definition: prequitlistener.h:83
DocManager(DocCreatorBase *doc_creator)
Construct the document manager for the application.
Definition: docmanager.cc:53
Listener for when a Quit is selected from the Quit dialog.
Definition: quit.h:195
DocCreatorBase * doc_creator()
Get the object that creates documents and their main window.
Definition: docmanager.h:180
Templated class to provide information on a documents file type and how to create the document and it...
Definition: docmanager.h:87
bool load_file(const std::string &file_name, int estimated_size=-1, bool from_filer=true)
Load a file into a document and show it in a window.
Definition: docmanager.cc:239
Class with details of a file load operation.
Definition: loader.h:42
Base class for commands in tbx.
Definition: command.h:37
DocCreatorBase(int file_type)
Construct a document and window creator for a file type.
Definition: docmanager.h:59
int file_type() const
Return the file type handled by this document creator.
Definition: docmanager.h:65
Class to allow a quit cancelled during the prequit message to be restarted.
Definition: prequitlistener.h:46
DocCreator(int file_type)
Construct document creator for a file type.
Definition: docmanager.h:94
tbx::Command * new_document_command()
Return a command that can be executed to create a new document with its window.
Definition: docmanager.h:188
static DocManager * instance()
Get single instance of the document manager.
Definition: docmanager.h:176
virtual void create_window(Document *doc)
Create the window used to display the given document.
Definition: docmanager.h:97
virtual Document * create_document()=0
Override this method to create the document object.
virtual void pre_quit(tbx::PreQuitEvent &event)
Called when the prequit message is received by the application.
Definition: docmanager.cc:130
Class to provide information on a toolbox event.
Definition: eventinfo.h:49