24 #ifndef TBX_TASKWINDOW_H
25 #define TBX_TASKWINDOW_H
30 #include "wimpmessagelistener.h"
35 class TaskWindowStartedListener;
36 class TaskWindowFinishedListener;
37 class TaskWindowOutputListener;
47 unsigned int _options;
48 unsigned int _child_task;
51 static unsigned int _next_txt_id;
60 std::vector<TaskWindowStartedListener *> _started_listeners;
61 std::vector<TaskWindowFinishedListener *> _finished_listeners;
62 std::vector<TaskWindowOutputListener *> _output_listeners;
97 const std::string &
command()
const {
return _command; }
108 const std::string &
name()
const {
return _name; }
130 unsigned int options()
const {
return _options; }
136 void options(
unsigned int new_opts) { _options = new_opts; }
161 void send_input(
const char *text,
int size = -1);
void remove_finished_listener(TaskWindowFinishedListener *listener)
Remove listener to detect when the child task has finished.
Definition: taskwindow.cc:134
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:35
Class to start a child task in a RISC OS task window.
Definition: taskwindow.h:43
@ DISPLAY
Show the taskwindow output window before any output comes from the task.
Definition: taskwindow.h:81
Listener for when a task window has started.
Definition: taskwindow.h:172
int wimp_slot() const
Get the wimp slot size in KB for the task window.
Definition: taskwindow.h:118
void remove_output_listener(TaskWindowOutputListener *listener)
Remove listener to detect output from the child task.
Definition: taskwindow.cc:171
virtual void taskwindow_finished(TaskWindow &task_window)=0
Called when the task window has finished.
void command(const std::string &command)
Set the command run by this task window.
Definition: taskwindow.h:103
const std::string & command() const
Get the command run by this task window.
Definition: taskwindow.h:97
void add_finished_listener(TaskWindowFinishedListener *listener)
Add listener to detect when the child task has finished.
Definition: taskwindow.cc:124
const std::string & name() const
Get the task name for the task window.
Definition: taskwindow.h:108
TaskWindow()
Uninitialised task window.
Definition: taskwindow.cc:50
void resume()
Resume the current child task after it has been suspended with a call to suspend.
Definition: taskwindow.cc:296
void add_started_listener(TaskWindowStartedListener *listener)
Add listener to detect when the child task is started.
Definition: taskwindow.cc:95
Listener to handle WimpRecordedMessages (event code 18)
Definition: wimpmessagelistener.h:270
virtual void taskwindow_output(TaskWindow &task_window, int size, const char *text)=0
Called when there is output from the task window has.
void options(unsigned int new_opts)
Set the options when the task window is executed Changing this will have no effect on a currently run...
Definition: taskwindow.h:136
Listener for when a task window has finished.
Definition: taskwindow.h:188
unsigned int child_task() const
task id of the child task.
Definition: taskwindow.h:150
Options
Task window run options.
Definition: taskwindow.h:73
Listener for output from a task window.
Definition: taskwindow.h:204
unsigned int options() const
The options applied when the task window is executed.
Definition: taskwindow.h:130
virtual void taskwindow_started(TaskWindow &task_window)=0
Called when the task window has started.
void run()
Run the child task.
Definition: taskwindow.cc:209
void name(const std::string &name)
Set the name of the task window Changing this will have no effect on a currently running task window.
Definition: taskwindow.h:114
void suspend()
Suspend the current child task.
Definition: taskwindow.cc:283
void kill()
Kill the current child task.
Definition: taskwindow.cc:307
@ ALLOW_CONTROL
Allow control characters to be sent to the output.
Definition: taskwindow.h:77
Listener to handle WimpUserMessages (event code 17)
Definition: wimpmessagelistener.h:253
bool running() const
Check if task window is running.
Definition: taskwindow.h:144
void remove_started_listener(TaskWindowStartedListener *listener)
Remove listener to detect when the child task is started.
Definition: taskwindow.cc:105
void send_input(const char *text, int size=-1)
Send input to the task window.
Definition: taskwindow.cc:250
Base class for all toolbox event listeners.
Definition: listener.h:34
Wimp message received event.
Definition: wimpmessagelistener.h:210
~TaskWindow()
Destructor, remove interest in the task window.
Definition: taskwindow.cc:86
@ QUIT
Quit the task windo wht the child task finishes.
Definition: taskwindow.h:85
void add_output_listener(TaskWindowOutputListener *listener)
Add listener to capture output from the child task.
Definition: taskwindow.cc:156
void wimp_slot(int slot)
Set the wimp slot for the task window Changing this will have no effect on a currently running task w...
Definition: taskwindow.h:124