]>
Commit | Line | Data |
---|---|---|
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 | ||
20 | #if wxUSE_CLIPBOARD | |
21 | ||
22 | #include "wx/object.h" | |
23 | #include "wx/list.h" | |
24 | #include "wx/dataobj.h" | |
25 | #include "wx/control.h" | |
26 | #include "wx/module.h" | |
27 | ||
28 | //----------------------------------------------------------------------------- | |
29 | // classes | |
30 | //----------------------------------------------------------------------------- | |
31 | ||
32 | class wxClipboard; | |
33 | class wxClipboardModule; | |
34 | ||
35 | //----------------------------------------------------------------------------- | |
36 | // global data | |
37 | //----------------------------------------------------------------------------- | |
38 | ||
39 | extern wxClipboard* wxTheClipboard; | |
40 | ||
41 | //----------------------------------------------------------------------------- | |
42 | // wxClipboard | |
43 | //----------------------------------------------------------------------------- | |
44 | ||
45 | class wxClipboard : public wxObject | |
46 | { | |
47 | public: | |
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 | |
64 | virtual bool IsSupported( wxDataFormat format ); | |
65 | ||
66 | // fill data with data on the clipboard (if available) | |
67 | virtual bool GetData( wxDataObject *data ); | |
68 | ||
69 | // clears wxTheClipboard and the system's clipboard if possible | |
70 | virtual void Clear(); | |
71 | ||
72 | /// If primary == TRUE, use primary selection in all further ops, | |
73 | /// primary=FALSE resets it. | |
74 | inline void UsePrimarySelection(bool primary = TRUE) { m_usePrimary = primary; } | |
75 | ||
76 | // implementation | |
77 | ||
78 | bool m_open; | |
79 | ||
80 | bool m_ownsClipboard; | |
81 | bool m_ownsPrimarySelection; | |
82 | ||
83 | wxDataBroker *m_dataBroker; | |
84 | GtkWidget *m_clipboardWidget; /* for getting and offering data */ | |
85 | GtkWidget *m_targetsWidget; /* for getting list of supported formats */ | |
86 | bool m_waiting; /* querying data or formats is asynchronous */ | |
87 | ||
88 | bool m_formatSupported; | |
89 | GdkAtom m_targetRequested; | |
90 | bool m_usePrimary; | |
91 | wxDataObject *m_receivedData; | |
92 | ||
93 | private: | |
94 | DECLARE_DYNAMIC_CLASS(wxClipboard) | |
95 | }; | |
96 | ||
97 | //----------------------------------------------------------------------------- | |
98 | // wxClipboardModule | |
99 | //----------------------------------------------------------------------------- | |
100 | ||
101 | class wxClipboardModule: public wxModule | |
102 | { | |
103 | public: | |
104 | wxClipboardModule() {} | |
105 | bool OnInit(); | |
106 | void OnExit(); | |
107 | ||
108 | private: | |
109 | DECLARE_DYNAMIC_CLASS(wxClipboardModule) | |
110 | }; | |
111 | ||
112 | #endif | |
113 | ||
114 | // wxUSE_CLIPBOARD | |
115 | ||
116 | #endif | |
117 | // __GTKCLIPBOARDH__ |