aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorCameron Cawley2019-09-19 22:20:08 +0100
committerFilippos Karapetis2019-09-21 22:16:01 +0300
commit014bef9eab9fb409cfb3ec66830e033e4aaa29a9 (patch)
tree1d4dedd703446cbf1cb90a279fc186cc293f1486 /common
parentbdd7b6baedea7455fdc1754f7c7b49fef201cc2a (diff)
downloadscummvm-rg350-014bef9eab9fb409cfb3ec66830e033e4aaa29a9.tar.gz
scummvm-rg350-014bef9eab9fb409cfb3ec66830e033e4aaa29a9.tar.bz2
scummvm-rg350-014bef9eab9fb409cfb3ec66830e033e4aaa29a9.zip
BACKENDS: Add a default clipboard implementation
Diffstat (limited to 'common')
-rw-r--r--common/system.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/common/system.h b/common/system.h
index f17625e215..ae0575f0e8 100644
--- a/common/system.h
+++ b/common/system.h
@@ -216,6 +216,12 @@ protected:
*/
FilesystemFactory *_fsFactory;
+ /**
+ * Used by the default clipboard implementation, for backends that don't
+ * implement clipboard support.
+ */
+ Common::String _clipboard;
+
private:
/**
* Indicate if initBackend() has been called.
@@ -374,8 +380,11 @@ public:
kFeatureDisplayLogFile,
/**
- * The presence of this feature indicates whether the hasTextInClipboard(),
- * getTextFromClipboard() and setTextInClipboard() calls are supported.
+ * The presence of this feature indicates whether the system clipboard is
+ * available. If this feature is not present, the hasTextInClipboard(),
+ * getTextFromClipboard() and setTextInClipboard() calls can still be used,
+ * however it should not be used in scenarios where the user is expected to
+ * copy data outside of the application.
*
* This feature has no associated state.
*/
@@ -1451,7 +1460,7 @@ public:
*
* @return true if there is text in the clipboard, false otherwise
*/
- virtual bool hasTextInClipboard() { return false; }
+ virtual bool hasTextInClipboard() { return !_clipboard.empty(); }
/**
* Returns clipboard contents as a String.
@@ -1462,7 +1471,7 @@ public:
*
* @return clipboard contents ("" if hasTextInClipboard() == false)
*/
- virtual Common::String getTextFromClipboard() { return ""; }
+ virtual Common::String getTextFromClipboard() { return _clipboard; }
/**
* Set the content of the clipboard to the given string.
@@ -1473,7 +1482,7 @@ public:
*
* @return true if the text was properly set in the clipboard, false otherwise
*/
- virtual bool setTextInClipboard(const Common::String &text) { return false; }
+ virtual bool setTextInClipboard(const Common::String &text) { _clipboard = text; return true; }
/**
* Open the given Url in the default browser (if available on the target