[dasher] Gtk2 implement SupportsClipboard & CopyToClipboard => DasherCore copy funcs
- From: Patrick Welche <pwelche src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dasher] Gtk2 implement SupportsClipboard & CopyToClipboard => DasherCore copy funcs
- Date: Tue, 18 Jan 2011 17:19:11 +0000 (UTC)
commit b60fc84eac2033624a00fa8c9695de437093ff5d
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date: Thu Dec 23 19:12:27 2010 +0000
Gtk2 implement SupportsClipboard & CopyToClipboard => DasherCore copy funcs
Src/Gtk2/DasherControl.cpp | 11 ++++++++++-
Src/Gtk2/DasherControl.h | 6 ++++++
2 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/Src/Gtk2/DasherControl.cpp b/Src/Gtk2/DasherControl.cpp
index a5ae24e..74e1af4 100644
--- a/Src/Gtk2/DasherControl.cpp
+++ b/Src/Gtk2/DasherControl.cpp
@@ -38,7 +38,7 @@ CDasherControl::CDasherControl(GtkVBox *pVBox, GtkDasherControl *pDasherControl)
m_pDasherControl = pDasherControl;
m_pVBox = GTK_WIDGET(pVBox);
-
+ pClipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
Realize();
// m_pKeyboardHelper = new CKeyboardHelper(this);
@@ -197,6 +197,15 @@ std::string CDasherControl::GetAllContext() {
return text;
}
+bool CDasherControl::SupportsClipboard() {
+ return true;
+}
+
+void CDasherControl::CopyToClipboard(const std::string &strText) {
+ const gchar *the_text(strText.c_str());
+ gtk_clipboard_set_text(pClipboard, the_text, strlen(the_text));
+}
+
#ifdef GNOME_SPEECH
bool CDasherControl::SupportsSpeech() {
return m_Speech.Init();
diff --git a/Src/Gtk2/DasherControl.h b/Src/Gtk2/DasherControl.h
index 1f1305a..e68a2a2 100644
--- a/Src/Gtk2/DasherControl.h
+++ b/Src/Gtk2/DasherControl.h
@@ -137,6 +137,9 @@ public:
virtual std::string GetAllContext();
+ virtual bool SupportsClipboard();
+ virtual void CopyToClipboard(const std::string &strText);
+
#ifdef GNOME_SPEECH
///override default non-implementation if compiling with speech...
virtual bool SupportsSpeech();
@@ -205,6 +208,9 @@ private:
// CKeyboardHelper *m_pKeyboardHelper;
+ //Cache the clipboard object...
+ GtkClipboard *pClipboard;
+
#ifdef GNOME_SPEECH
CSpeech m_Speech;
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]