| 1 |
#pragma once |
| 2 |
|
| 3 |
#include <string> |
| 4 |
#include "imodule.h" |
| 5 |
|
| 6 |
namespace radiant |
| 7 |
{ |
| 8 |
|
| 9 |
/** |
| 10 |
* Interface to DarkRadiant's clipboard which is able to |
| 11 |
* store and retrieve a string from and to the system clipboard. |
| 12 |
* Access it through the GlobalClipboard() function. |
| 13 |
* |
| 14 |
* This module might not be present in all configurations |
| 15 |
* so its advisable to check for its presence first. |
| 16 |
*/ |
| 17 |
class IClipboard : |
| 18 |
public RegisterableModule |
| 19 |
{ |
| 20 |
public: |
| 21 |
virtual ~IClipboard() {} |
| 22 |
|
| 23 |
/// Return the contents of the clipboard as a string |
| 24 |
virtual std::string getString() = 0; |
| 25 |
|
| 26 |
/// Copy the given string to the system clipboard |
| 27 |
virtual void setString(const std::string& str) = 0; |
| 28 |
|
| 29 |
// A signal that is emitted when the contents of the system clipboard changes |
| 30 |
virtual sigc::signal<void>& signal_clipboardContentChanged() = 0; |
| 31 |
}; |
| 32 |
|
| 33 |
} |
| 34 |
|
| 35 |
const char* const MODULE_CLIPBOARD("Clipboard"); |
| 36 |
|
| 37 |
inline radiant::IClipboard& GlobalClipboard() |
| 38 |
{ |
| 39 |
static module::InstanceReference<radiant::IClipboard> _reference(MODULE_CLIPBOARD); |
| 40 |
return _reference; |
| 41 |
} |