| 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 | #ifndef _WX_GTK_CLIPBOARD_H_ |
| 11 | #define _WX_GTK_CLIPBOARD_H_ |
| 12 | |
| 13 | // ---------------------------------------------------------------------------- |
| 14 | // wxClipboard |
| 15 | // ---------------------------------------------------------------------------- |
| 16 | |
| 17 | class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase |
| 18 | { |
| 19 | public: |
| 20 | wxClipboard(); |
| 21 | virtual ~wxClipboard(); |
| 22 | |
| 23 | // open the clipboard before SetData() and GetData() |
| 24 | virtual bool Open(); |
| 25 | |
| 26 | // close the clipboard after SetData() and GetData() |
| 27 | virtual void Close(); |
| 28 | |
| 29 | // query whether the clipboard is opened |
| 30 | virtual bool IsOpened() const; |
| 31 | |
| 32 | // set the clipboard data. all other formats will be deleted. |
| 33 | virtual bool SetData( wxDataObject *data ); |
| 34 | |
| 35 | // add to the clipboard data. |
| 36 | virtual bool AddData( wxDataObject *data ); |
| 37 | |
| 38 | // ask if data in correct format is available |
| 39 | virtual bool IsSupported( const wxDataFormat& format ); |
| 40 | |
| 41 | // fill data with data on the clipboard (if available) |
| 42 | virtual bool GetData( wxDataObject& data ); |
| 43 | |
| 44 | // clears wxTheClipboard and the system's clipboard if possible |
| 45 | virtual void Clear(); |
| 46 | |
| 47 | // If primary == TRUE, use primary selection in all further ops, |
| 48 | // primary == FALSE resets it. |
| 49 | virtual void UsePrimarySelection(bool primary = TRUE) |
| 50 | { m_usePrimary = primary; } |
| 51 | |
| 52 | // implementation from now on |
| 53 | bool m_open; |
| 54 | bool m_ownsClipboard; |
| 55 | bool m_ownsPrimarySelection; |
| 56 | wxDataObject *m_data; |
| 57 | |
| 58 | GtkWidget *m_clipboardWidget; /* for getting and offering data */ |
| 59 | GtkWidget *m_targetsWidget; /* for getting list of supported formats */ |
| 60 | bool m_waiting; /* querying data or formats is asynchronous */ |
| 61 | |
| 62 | bool m_formatSupported; |
| 63 | GdkAtom m_targetRequested; |
| 64 | bool m_usePrimary; |
| 65 | wxDataObject *m_receivedData; |
| 66 | |
| 67 | private: |
| 68 | DECLARE_DYNAMIC_CLASS(wxClipboard) |
| 69 | }; |
| 70 | |
| 71 | #endif // _WX_GTK_CLIPBOARD_H_ |