]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/GuiClipboard.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / gtk / GuiClipboard.C
1 // -*- C++ -*-
2 /**
3  * \file gtk/GuiClipboard.C
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Huang Ying
8  * \author Abdelrazak Younes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #include <config.h>
14
15 // Too hard to make concept checks work with this file
16 #ifdef _GLIBCXX_CONCEPT_CHECKS
17 #undef _GLIBCXX_CONCEPT_CHECKS
18 #endif
19 #ifdef _GLIBCPP_CONCEPT_CHECKS
20 #undef _GLIBCPP_CONCEPT_CHECKS
21 #endif
22
23 #include "GuiClipboard.h"
24 #include "debug.h"
25
26 #include <gtkmm.h>
27
28 using std::endl;
29 using std::string;
30
31 namespace lyx {
32 namespace frontend {
33
34 docstring const GuiClipboard::get() const
35 {
36         Glib::RefPtr<Gtk::Clipboard> clipboard =
37                 Gtk::Clipboard::get(GDK_SELECTION_CLIPBOARD);
38         string const str = clipboard->wait_for_text();
39         lyxerr[Debug::ACTION] << "GuiClipboard::get: " << str << endl;
40         return lyx::from_utf8(str);
41 }
42
43
44 void GuiClipboard::put(docstring const & str)
45 {
46         string const utf8 = lyx::to_utf8(str);
47         lyxerr[Debug::ACTION] << "GuiClipboard::put: " << utf8 << endl;
48         Glib::RefPtr<Gtk::Clipboard> clipboard =
49                 Gtk::Clipboard::get(GDK_SELECTION_CLIPBOARD);
50         clipboard->set_text(utf8);
51 }
52
53 } // namespace frontend
54 } // namespace lyx