]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/clipbrd.h
added wxGrid::UseNativeColHeader() (column reordering doesn't work yet); more wxGrid...
[wxWidgets.git] / include / wx / gtk / clipbrd.h
CommitLineData
dc86cb34 1/////////////////////////////////////////////////////////////////////////////
eddb9644
VZ
2// Name: wx/gtk/clipboard.h
3// Purpose: wxClipboard for wxGTK
4// Author: Robert Roebling, Vadim Zeitlin
dc86cb34
RR
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling
eddb9644 7// (c) 2007 Vadim Zeitlin
65571936 8// Licence: wxWindows licence
dc86cb34
RR
9/////////////////////////////////////////////////////////////////////////////
10
0416c418
PC
11#ifndef _WX_GTK_CLIPBOARD_H_
12#define _WX_GTK_CLIPBOARD_H_
dc86cb34 13
e1ee679c 14// ----------------------------------------------------------------------------
dc86cb34 15// wxClipboard
e1ee679c 16// ----------------------------------------------------------------------------
dc86cb34 17
20123d49 18class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase
dc86cb34 19{
dc86cb34 20public:
eddb9644
VZ
21 // there are several clipboards in X11 (and in GDK)
22 enum Kind
23 {
24 Primary,
25 Clipboard
26 };
27
26f86486 28 wxClipboard();
d3c7fc99 29 virtual ~wxClipboard();
26f86486
VZ
30
31 // open the clipboard before SetData() and GetData()
32 virtual bool Open();
33
34 // close the clipboard after SetData() and GetData()
35 virtual void Close();
36
f536e0f2
VZ
37 // query whether the clipboard is opened
38 virtual bool IsOpened() const;
39
26f86486
VZ
40 // set the clipboard data. all other formats will be deleted.
41 virtual bool SetData( wxDataObject *data );
42
43 // add to the clipboard data.
44 virtual bool AddData( wxDataObject *data );
45
46 // ask if data in correct format is available
e1ee679c 47 virtual bool IsSupported( const wxDataFormat& format );
26f86486
VZ
48
49 // fill data with data on the clipboard (if available)
e1ee679c 50 virtual bool GetData( wxDataObject& data );
26f86486
VZ
51
52 // clears wxTheClipboard and the system's clipboard if possible
53 virtual void Clear();
54
9005f2ed 55
06f5d975 56
e1ee679c 57 // implementation from now on
06f5d975
VZ
58 // --------------------------
59
eddb9644
VZ
60 // get our clipboard item (depending on m_usePrimary value)
61 GdkAtom GTKGetClipboardAtom() const;
62
63 // get the data object currently being used
64 wxDataObject *GTKGetDataObject() { return Data(); }
26f86486 65
eddb9644
VZ
66 // clear the data for the given clipboard kind
67 void GTKClearData(Kind kind);
26f86486 68
eddb9644
VZ
69 // called when selection data is received
70 void GTKOnSelectionReceived(const GtkSelectionData& sel);
71
72 // called when available target information is received
73 bool GTKOnTargetReceived(const wxDataFormat& format);
b527aac5 74
738f9e5a 75private:
511383f9
VZ
76 // the data object for the specific selection
77 wxDataObject *& Data(Kind kind)
78 {
79 return kind == Primary ? m_dataPrimary : m_dataClipboard;
80 }
81
eddb9644
VZ
82 // the data object we're currently using
83 wxDataObject *& Data()
84 {
511383f9 85 return Data(m_usePrimary ? Primary : Clipboard);
eddb9644
VZ
86 }
87
511383f9 88
eddb9644
VZ
89 // set or unset selection ownership
90 bool SetSelectionOwner(bool set = true);
91
92 // add atom to the list of supported targets
93 void AddSupportedTarget(GdkAtom atom);
94
95 // check if the given format is supported
96 bool DoIsSupported(const wxDataFormat& format);
97
98
99 // both of these pointers can be non-NULL simultaneously but we only use
100 // one of them at any moment depending on m_usePrimary value, use Data()
101 // (from inside) or GTKGetDataObject() (from outside) accessors
102 wxDataObject *m_dataPrimary,
103 *m_dataClipboard;
104
105 // this is used to temporarily hold the object passed to our GetData() so
106 // that GTK callbacks could access it
107 wxDataObject *m_receivedData;
108
109 // used to pass information about the format we need from DoIsSupported()
110 // to GTKOnTargetReceived()
111 GdkAtom m_targetRequested;
112
113 GtkWidget *m_clipboardWidget; // for getting and offering data
114 GtkWidget *m_targetsWidget; // for getting list of supported formats
115
116 bool m_open;
eddb9644
VZ
117 bool m_formatSupported;
118
119
e1ee679c 120 DECLARE_DYNAMIC_CLASS(wxClipboard)
dc86cb34
RR
121};
122
0416c418 123#endif // _WX_GTK_CLIPBOARD_H_