3 * \file gtk/GuiSelection.C
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Abdelrazak Younes
10 * Full author contact details are available in file CREDITS.
15 // Too hard to make concept checks work with this file
16 #ifdef _GLIBCXX_CONCEPT_CHECKS
17 #undef _GLIBCXX_CONCEPT_CHECKS
19 #ifdef _GLIBCPP_CONCEPT_CHECKS
20 #undef _GLIBCPP_CONCEPT_CHECKS
23 #include "GuiSelection.h"
34 docstring const GuiSelection::get() const
36 Glib::RefPtr<Gtk::Clipboard> clipboard =
37 Gtk::Clipboard::get(GDK_SELECTION_PRIMARY);
38 string const str = clipboard->wait_for_text();
39 lyxerr[Debug::ACTION] << "GuiSelection::get: " << str << endl;
40 return lyx::from_utf8(str);
44 void GuiSelection::put(docstring const & str)
46 string const utf8 = lyx::to_utf8(str);
47 lyxerr[Debug::ACTION] << "GuiSelection::put: " << utf8 << endl;
48 Glib::RefPtr<Gtk::Clipboard> clipboard =
49 Gtk::Clipboard::get(GDK_SELECTION_PRIMARY);
50 clipboard->set_text(utf8);
53 } // namespace frontend