-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathclipboard.h
53 lines (48 loc) · 1.98 KB
/
clipboard.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//////////////////////////////////////////////////////////////////////
// Yet Another Tibia Client
//////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//////////////////////////////////////////////////////////////////////
#include <string>
#if defined(USE_X11_CLIPBOARD)
// NOTE (nfries88): This should include req'd X11 headers for compilation.
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#elif defined(__APPLE__)
extern "C" char* getPasteboardText();
extern "C" void putPasteboardText(const char*);
#elif !defined(WIN32)
// NOTE (nfries88): Using an internal std::string on unsupported platforms.
#define __USE_INTERNAL_CLIPBOARD
#endif
// NOTE (nfries88): we'll only bother supporting text for the clipboard,
// since that's all the official client uses it for.
class yatcClipboard
{
public:
yatcClipboard();
~yatcClipboard();
std::string getText();
void setText(const std::string& text);
private:
#ifdef __USE_INTERNAL_CLIPBOARD
std::string m_text;
#elif defined(USE_X11_CLIPBOARD)
std::string m_text;
static void clipboard_filter(GtkClipboard *clipboard, GdkAtom format, const guint8 *text, gsize length, gpointer data);
#endif
};