25 #ifndef TBX_APPLICATION_H
26 #define TBX_APPLICATION_H
29 #include "messagefile.h"
36 class AutoCreateListener;
38 class WimpUserMessageListener;
39 class WimpRecordedMessageListener;
40 class WimpAcknowledgeMessageListener;
41 class PreQuitListener;
43 class ModeChangedListener;
44 class PaletteChangedListener;
48 class PrePollListener;
49 class PostPollListener;
50 class PostEventListener;
51 class UncaughtHandler;
162 void quit() {_running =
false;}
189 void os_cli(std::string command);
A SpriteArea holds zero or more user sprites.
Definition: sprite.h:232
bool unix_file_name_translation() const
Check if some unix file name translations are being used.
Definition: application.cc:564
static const int * NO_EVENTS
Don't deliver any toolbox event.
Definition: application.h:84
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:35
void add_command(int command_id, Command *command)
Add a command to be run for the specified event ID.
Definition: application.cc:200
Base class for a resource object that can be edited.
Definition: resobject.h:53
void add_recorded_message_listener(int message_id, WimpRecordedMessageListener *listener)
Add a listener for the given recorded message (event code 18)
Definition: application.cc:268
std::string directory() const
Return the name of the directory that was used to initialised this application.
Definition: application.cc:517
static const int MIN_WIMP_VERSION
Minimum Wimp version TBX supports.
Definition: application.h:81
void add_user_message_listener(int message_id, WimpUserMessageListener *listener)
Add a listener for the given user message (event code 17)
Definition: application.cc:246
static const int * NO_MESSAGES
Don't deliver any wimp messages (except QUIT)
Definition: application.h:82
static const int * ALL_MESSAGES
Deliver all messages.
Definition: application.h:83
bool running() const
Check if application is running.
Definition: application.h:171
Listen for the pre quit message from the desktop.
Definition: prequitlistener.h:110
void remove_acknowledge_message_listener(int message_id, WimpAcknowledgeMessageListener *listener)
Remove a listener for the given acknowledge message.
Definition: application.cc:301
void remove_opener(Loader *loader, int file_type)
Remove a file opener.
Definition: application.cc:483
void catch_poll_exceptions(bool on)
Catch any uncaught exceptions thrown during polling and show them in an error box.
Definition: application.cc:602
void set_pre_poll_listener(PrePollListener *listener)
Set listener to run just before the internal call to Wimp_Poll.
Definition: application.cc:637
void add_idle_command(Command *command)
Add a command to be run when no events are being received from the desktop.
Definition: application.cc:224
Application(const char *task_directory, int wimp_version=MIN_WIMP_VERSION, const int *deliver_messages=ALL_MESSAGES, const int *deliver_events=ALL_EVENTS)
Initialise the application.
Definition: application.cc:79
void add_palette_changed_listener(PaletteChangedListener *listener)
Add listener for changes to desktop palette.
Definition: application.cc:409
int start_wimp_task(std::string command)
Start a child task from this application.
Definition: application.cc:704
Class to handle file/data loading from the filer or an external application.
Definition: loader.h:179
void set_post_event_listener(PostEventListener *listener)
Set listener to call after the event processing in TBX.
Definition: application.cc:676
The main application class.
Definition: application.h:79
TaskHandle task_handle() const
Get WIMP task handle for application.
Definition: application.h:147
Class to simplify handling of Quit WIMP message.
Definition: palettechangedlistener.h:45
void remove_idle_command(Command *command)
Remove a command to be run when no events are being received from the desktop.
Definition: application.cc:235
void remove_command(int command_id, Command *command)
Remove a command.
Definition: application.cc:214
void run()
Run the main polling loop for the application.
Definition: application.cc:130
void add_prequit_listener(PreQuitListener *listener)
Add a listener for the pre quit message sent (usually) by the desktop.
Definition: application.cc:315
Class to simplify handling of Quit WIMP message.
Definition: quitlistener.h:46
Class to provide a listener to allow processing before the call to wimp poll.
Definition: posteventlistener.h:48
void remove_user_message_listener(int message_id, WimpUserMessageListener *listener)
Remove a listener for the given user message.
Definition: application.cc:257
Listener to handle WimpRecordedMessages (event code 18)
Definition: wimpmessagelistener.h:270
Callback class for a timer.
Definition: timer.h:43
void add_opener(Loader *loader, int file_type)
Add a file opener.
Definition: application.cc:469
void remove_prequit_listener(PreQuitListener *listener)
Remove a prequit listener.
Definition: application.cc:329
void set_autocreate_listener(std::string template_name, AutoCreateListener *listener)
Set the AutoCreateListener to be called when an object with the specified template is created.
Definition: application.cc:173
void set_post_poll_listener(PostPollListener *listener)
Set listener to look at the results of the internal call to Wimp_Poll.
Definition: application.cc:657
const MessageFile & messages() const
Return the default message file for this application.
Definition: application.h:154
Base Listener for auto create events.
Definition: autocreatelistener.h:42
void remove_quit_listener(QuitListener *listener)
Remove a quit listener.
Definition: application.cc:358
void add_quit_listener(QuitListener *listener)
Add a listener to process the Quit message.
Definition: application.cc:348
Application * app()
Get the current application instance.
Definition: application.h:206
Class to simplify handling of Quit WIMP message.
Definition: modechangedlistener.h:45
void remove_palette_changed_listener(PaletteChangedListener *listener)
Remove listener for changes to the desktop palette.
Definition: application.cc:419
void remove_recorded_message_listener(int message_id, WimpRecordedMessageListener *listener)
Remove a listener for the given recorded message.
Definition: application.cc:279
int WindowHandle
Type for WIMP windows handle.
Definition: handles.h:35
bool owns_window(WindowHandle window_handle, IconHandle icon_handle=0)
Check if this application owns WIMP window/icon bar icon.
Definition: application.cc:688
void remove_mode_changed_listener(ModeChangedListener *listener)
Remove mode changed listener.
Definition: application.cc:385
bool yield()
Allow other applications and events in this application to be run.
Definition: application.cc:152
void clear_autocreate_listener(std::string template_name)
Clear the autocreate listener for the specified template.
Definition: application.cc:183
Listener to handle WimpUserMessages (event code 17)
Definition: wimpmessagelistener.h:253
static const int * ALL_EVENTS
Deliver all toolbox events.
Definition: application.h:85
Class to provide a listener to allow processing before the call to wimp poll.
Definition: prepolllistener.h:48
Base class for commands in tbx.
Definition: command.h:37
Class to lookup token translations from a messages file.
Definition: messagefile.h:43
int unix_file_name_control() const
Get the flags that control the unix file name translation process.
Definition: application.cc:582
void add_timer(int elapsed, Timer *timer)
Add a timer to the application that will be called at a regular interval.
Definition: application.cc:435
void uncaught_handler(UncaughtHandler *handler)
Report any uncaught exceptions to the given interface.
Definition: application.cc:620
int TaskHandle
Type for a Wimp Task.
Definition: handles.h:56
void os_cli(std::string command)
Run a command using the RISC OS Command Line interpreter.
Definition: application.cc:724
Class to provide a listener to allow inspection of the values returned from the Wimp_Poll call.
Definition: postpolllistener.h:43
void add_acknowledge_message_listener(int message_id, WimpAcknowledgeMessageListener *listener)
Add a listener for the given acknowledge message (event code 18)
Definition: application.cc:290
SpriteArea * sprite_area() const
Get the sprite area.
Definition: application.h:103
void add_mode_changed_listener(ModeChangedListener *listener)
Listen for changes to the Desktop mode.
Definition: application.cc:375
res::ResObject resource(std::string template_name)
Get a Resource object template from the main toolbox templates.
Definition: application.cc:497
Interface to process uncaught exceptions in an application.
Definition: uncaughthandler.h:44
static Application * instance()
Get the application instance.
Definition: application.h:96
Listener to handle WimpAcnowledgeMessages (event code 19)
Definition: wimpmessagelistener.h:290
int IconHandle
Type for WIMP icon handle.
Definition: handles.h:37
void remove_timer(Timer *timer)
Remove the given timer.
Definition: application.cc:445
void quit()
Quit the application.
Definition: application.h:162