25 #ifndef TBX_CLIPBOARD_H_
26 #define TBX_CLIPBOARD_H_
33 #include "loadermanager.h"
90 void copy(
const std::string &text,
int file_type = 0xFFF);
91 void copy(
int file_type,
char *bytes,
int size,
bool copy_bytes =
true);
92 void paste(
int file_type,
Gadget &gadget,
int x = 0,
int y = 0);
93 void paste(
int *file_types,
int num_types,
Gadget &gadget,
int x = 0,
int y = 0);
94 void paste(
int file_type,
Window &window,
int x = 0,
int y = 0);
95 void paste(
int *file_types,
int num_types,
Window &window,
int x = 0,
int y = 0);
98 void check(
int *file_types,
int num_types,
Window &window);
118 void claim_clipboard();
119 void fire_claimed(
bool clipboard_claimed,
bool caret_claimed);
120 void paste(
int *file_types,
int num_types,
Window window,
Gadget gadget,
int x,
int y);
121 void fire_format_found(
int file_type);
122 void fire_clipboard_empty();
133 public LoaderManager::MessageIntercept
137 virtual ~MessageHandler();
139 void paste_ref(
int ref) {_paste_ref = ref;}
141 virtual void user_message(WimpMessageEvent &event);
142 virtual void recorded_message(WimpMessageEvent &event,
int reply_to);
143 virtual void acknowledge_message(WimpMessageEvent &event);
147 virtual void saver_save_to_file(
tbx::Saver saver, std::string file_name);
148 virtual void saver_fill_buffer(
tbx::Saver saver,
int size,
void *buffer,
int already_transmitted);
154 ClipboardData *_save_data;
158 friend class MessageHandler;
161 bool _owns_clipboard;
163 int _native_file_type;
164 std::map<int, ClipboardData *> _data;
165 std::vector<ClipboardClaimedListener *> _claimed_listeners;
166 std::vector<ClipboardFormatListener *> *_format_listeners;
167 static Clipboard *s_instance;
202 virtual const char *
data() = 0;
224 int size() {
return static_cast<int>(_text.size());}
225 const char *
data() {
return _text.data();}
241 const char *
data() {
return _data;}
void clear()
Clear all the local clipboard data.
Definition: clipboard.cc:348
Listener for when the save as dialogue box has been closed.
Definition: saver.h:218
A library for creating RISC OS toolbox applications.
Definition: abouttobeshownlistener.cc:35
int native_file_type() const
Return the native file type.
Definition: clipboard.cc:412
int size()
The size of the data in bytes.
Definition: clipboard.h:224
The Window object represents a toolbox window.
Definition: window.h:70
SendType
Enumeration specifying the type of message to send.
Definition: wimpmessagelistener.h:191
ClipboardData * native_data() const
Get the native data from the data stored locally.
Definition: clipboard.cc:401
Listener for when a save has been completed.
Definition: saver.h:266
virtual const char * data()=0
The data to copy.
void paste(int file_type, Gadget &gadget, int x=0, int y=0)
Paste data from global clipboard.
Definition: clipboard.cc:129
void remove_format_listener(ClipboardFormatListener *listener)
Remove a listener for the result of a Clipboard::check call.
Definition: clipboard.cc:468
Class to handler the global RISC OS clipboard.
Definition: clipboard.h:83
void copy(int file_type, ClipboardData *data, bool add=false)
Copy the given data to the local clipboard and make if available to the global clipboard.
Definition: clipboard.cc:80
virtual void clipboard_claimed()
Called when another application has claimed the global clipboard.
Definition: clipboard.h:52
Clipboard * clipboard()
Return pointer to the global clipboard.
Definition: clipboard.h:177
Listener to handle WimpRecordedMessages (event code 18)
Definition: wimpmessagelistener.h:270
void add_format_listener(ClipboardFormatListener *listener)
Add a listener for the result of a Clipboard::check call.
Definition: clipboard.cc:458
void check(int file_type, Window &window)
Check the global clipboard for a given file type.
Definition: clipboard.cc:280
void add_claimed_listener(ClipboardClaimedListener *listener)
Add a listener for when the clipboard has been claimed by another application.
Definition: clipboard.cc:431
virtual void copy_finished()
Called when a copy of the data has finished.
Definition: clipboard.h:212
Handler for SaverFillBuffer handler.
Definition: saver.h:303
Listener for clipboard related events.
Definition: clipboard.h:42
static Clipboard * instance()
Return the global clipboard instance, creating it if it does not exist.
Definition: clipboard.cc:62
ClipboardData * data(int file_type) const
Get data stored locally of the given file type.
Definition: clipboard.cc:388
Convenience class to create clipboard data containing a string.
Definition: clipboard.h:219
void remove_claimed_listener(ClipboardClaimedListener *listener)
Remove a listener for when the clipboard has been claimed by another application.
Definition: clipboard.cc:440
ClipboardBytes(char *bytes, int size, bool copy=true)
Construct a clipboard data object to hold an array of bytes.
Definition: clipboard.cc:723
Listener to handle WimpUserMessages (event code 17)
Definition: wimpmessagelistener.h:253
virtual void copy_started()
Called when data is about to be copied to another application from via clipboard.
Definition: clipboard.h:208
int size()
The size of the data in bytes.
Definition: clipboard.h:240
Convenience class to create clipboard data for an array of bytes.
Definition: clipboard.h:235
const char * data()
The data to copy.
Definition: clipboard.h:225
Event for SaverSaveCompletedHandler.
Definition: saver.h:235
virtual void clipboard_claimed_caret()
Called when another application has claimed the caret/selection.
Definition: clipboard.h:48
Event information for when saver dialogue has been completed.
Definition: saver.h:191
This is the base class for all Gadgets.
Definition: gadget.h:49
Listener to handle WimpAcnowledgeMessages (event code 19)
Definition: wimpmessagelistener.h:290
bool owns_clipboard() const
Check if global clipboard is currently owned by this application.
Definition: clipboard.h:111
void claim_caret()
Claim the caret/selection for this application.
Definition: clipboard.cc:371
Base class for data used on the clipboard.
Definition: clipboard.h:188
virtual int size()=0
The size of the data in bytes.
Handler to save data to a file.
Definition: saver.h:282
Class to give the same interface to saving to an external application as the SaveAs dialogue.
Definition: saver.h:61
const char * data()
The data to copy.
Definition: clipboard.h:241