]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/clipbrd.h
New wxDataObject, DnD and Clipboard code
[wxWidgets.git] / include / wx / gtk / clipbrd.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: clipboard.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10
11 #ifndef __GTKCLIPBOARDH__
12 #define __GTKCLIPBOARDH__
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "wx/defs.h"
19 #include "wx/object.h"
20 #include "wx/list.h"
21 #include "wx/dataobj.h"
22 #include "wx/control.h"
23 #include "wx/module.h"
24
25 //-----------------------------------------------------------------------------
26 // classes
27 //-----------------------------------------------------------------------------
28
29 class wxClipboard;
30 class wxClipboardModule;
31
32 //-----------------------------------------------------------------------------
33 // global data
34 //-----------------------------------------------------------------------------
35
36 extern wxClipboard* wxTheClipboard;
37
38 //-----------------------------------------------------------------------------
39 // wxClipboard
40 //-----------------------------------------------------------------------------
41
42 class wxClipboard: public wxObject
43 {
44 DECLARE_DYNAMIC_CLASS(wxClipboard)
45
46 public:
47
48 wxClipboard();
49 ~wxClipboard();
50
51 // open the clipboard before SetData() and GetData()
52 virtual bool Open();
53
54 // close the clipboard after SetData() and GetData()
55 virtual void Close();
56
57 // can be called several times
58 virtual bool SetData( wxDataObject *data );
59
60 // format available on the clipboard ?
61 // supply ID if private format, the same as wxPrivateDataObject::SetId()
62 virtual bool IsSupportedFormat( wxDataFormat format, const wxString &id = "" );
63
64 // fill data with data on the clipboard (if available)
65 virtual bool GetData( wxDataObject *data );
66
67 // clears wxTheClipboard and the system's clipboard if possible
68 virtual void Clear();
69
70 // implementation
71
72 GdkAtom GetTargetAtom( wxDataFormat format, const wxString &id = "" );
73
74 bool m_open;
75
76 wxList m_dataObjects;
77 char *m_sentString,
78 *m_receivedString;
79 void *m_receivedTargets;
80 GtkWidget *m_clipboardWidget;
81
82 bool m_formatSupported;
83 GdkAtom m_targetRequested;
84
85 wxDataObject *m_receivedData;
86 };
87
88 //-----------------------------------------------------------------------------
89 // wxClipboardModule
90 //-----------------------------------------------------------------------------
91
92 class wxClipboardModule: public wxModule
93 {
94 DECLARE_DYNAMIC_CLASS(wxClipboardModule)
95
96 public:
97 wxClipboardModule() {}
98 bool OnInit();
99 void OnExit();
100 };
101
102
103 #endif
104 // __GTKCLIPBOARDH__