]>
Commit | Line | Data |
---|---|---|
dc86cb34 RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: clipboard.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
5 | // Id: $Id$ | |
6 | // Copyright: (c) 1998 Robert Roebling | |
26f86486 | 7 | // Licence: wxWindows licence |
dc86cb34 RR |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
10 | ||
11 | #ifndef __GTKCLIPBOARDH__ | |
12 | #define __GTKCLIPBOARDH__ | |
13 | ||
14 | #ifdef __GNUG__ | |
15 | #pragma interface | |
16 | #endif | |
17 | ||
18 | #include "wx/defs.h" | |
ac57418f | 19 | |
06cfab17 | 20 | #if wxUSE_CLIPBOARD |
ac57418f | 21 | |
dc86cb34 RR |
22 | #include "wx/object.h" |
23 | #include "wx/list.h" | |
8b53e5a2 | 24 | #include "wx/dataobj.h" |
dc86cb34 | 25 | #include "wx/control.h" |
b527aac5 | 26 | #include "wx/module.h" |
dc86cb34 RR |
27 | |
28 | //----------------------------------------------------------------------------- | |
29 | // classes | |
30 | //----------------------------------------------------------------------------- | |
31 | ||
32 | class wxClipboard; | |
b527aac5 | 33 | class wxClipboardModule; |
dc86cb34 RR |
34 | |
35 | //----------------------------------------------------------------------------- | |
36 | // global data | |
37 | //----------------------------------------------------------------------------- | |
38 | ||
39 | extern wxClipboard* wxTheClipboard; | |
40 | ||
41 | //----------------------------------------------------------------------------- | |
42 | // wxClipboard | |
43 | //----------------------------------------------------------------------------- | |
44 | ||
26f86486 | 45 | class wxClipboard : public wxObject |
dc86cb34 | 46 | { |
dc86cb34 | 47 | public: |
26f86486 VZ |
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 | // set the clipboard data. all other formats will be deleted. | |
58 | virtual bool SetData( wxDataObject *data ); | |
59 | ||
60 | // add to the clipboard data. | |
61 | virtual bool AddData( wxDataObject *data ); | |
62 | ||
63 | // ask if data in correct format is available | |
5f699c22 | 64 | virtual bool IsSupported( wxDataFormat format ); |
26f86486 VZ |
65 | |
66 | // fill data with data on the clipboard (if available) | |
5f699c22 | 67 | virtual bool GetData( wxDataObject *data ); |
26f86486 VZ |
68 | |
69 | // clears wxTheClipboard and the system's clipboard if possible | |
70 | virtual void Clear(); | |
71 | ||
1dd989e1 RR |
72 | // flushes the clipboard: not available under GTK |
73 | virtual bool Flush() { return FALSE; } | |
74 | ||
e839ce8d KB |
75 | /// If primary == TRUE, use primary selection in all further ops, |
76 | /// primary=FALSE resets it. | |
77 | inline void UsePrimarySelection(bool primary = TRUE) { m_usePrimary = primary; } | |
78 | ||
1dd989e1 | 79 | // implementation |
26f86486 | 80 | bool m_open; |
26f86486 VZ |
81 | bool m_ownsClipboard; |
82 | bool m_ownsPrimarySelection; | |
1dd989e1 | 83 | wxDataObject *m_data; |
26f86486 | 84 | |
034be888 RR |
85 | GtkWidget *m_clipboardWidget; /* for getting and offering data */ |
86 | GtkWidget *m_targetsWidget; /* for getting list of supported formats */ | |
87 | bool m_waiting; /* querying data or formats is asynchronous */ | |
26f86486 VZ |
88 | |
89 | bool m_formatSupported; | |
90 | GdkAtom m_targetRequested; | |
e839ce8d | 91 | bool m_usePrimary; |
26f86486 | 92 | wxDataObject *m_receivedData; |
738f9e5a RR |
93 | |
94 | private: | |
95 | DECLARE_DYNAMIC_CLASS(wxClipboard) | |
b527aac5 RR |
96 | }; |
97 | ||
98 | //----------------------------------------------------------------------------- | |
99 | // wxClipboardModule | |
100 | //----------------------------------------------------------------------------- | |
101 | ||
102 | class wxClipboardModule: public wxModule | |
103 | { | |
b527aac5 RR |
104 | public: |
105 | wxClipboardModule() {} | |
106 | bool OnInit(); | |
107 | void OnExit(); | |
738f9e5a RR |
108 | |
109 | private: | |
110 | DECLARE_DYNAMIC_CLASS(wxClipboardModule) | |
dc86cb34 RR |
111 | }; |
112 | ||
ac57418f RR |
113 | #endif |
114 | ||
115 | // wxUSE_CLIPBOARD | |
b527aac5 | 116 | |
dc86cb34 RR |
117 | #endif |
118 | // __GTKCLIPBOARDH__ |