1 // Fixes primary selection problem in wxClipboard under Gtk
2 // patched from wx-gtk-clipbrd.patch:
3 // http://sourceforge.net/tracker/index.php?func=detail&aid=1280049&group_id=9863&atid=309863
4 
5 /////////////////////////////////////////////////////////////////////////////
6 // Name:        clipboard.h
7 // Purpose:
8 // Author:      Robert Roebling
9 // Id:          $Id: clipbrd.h,v 1.24 2006/09/05 20:45:29 VZ Exp $
10 // Copyright:   (c) 1998 Robert Roebling
11 // Licence:     wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
13 
14 #ifdef __WXGTK__
15 
16 #ifndef _WX_GTK_CLIPBOARD_GTK_H_
17 #define _WX_GTK_CLIPBOARD_GTK_H_
18 
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 #include <wx/clipbrd.h>
25 
26 // ----------------------------------------------------------------------------
27 // wxClipboardGtk
28 // ----------------------------------------------------------------------------
29 
30 class WXDLLIMPEXP_CORE wxClipboardGtk : public wxClipboardBase
31 {
32 public:
33     wxClipboardGtk();
34     virtual ~wxClipboardGtk();
35 
36     // open the clipboard before SetData() and GetData()
37     virtual bool Open();
38 
39     // close the clipboard after SetData() and GetData()
40     virtual void Close();
41 
42     // query whether the clipboard is opened
43     virtual bool IsOpened() const;
44 
45     // set the clipboard data. all other formats will be deleted.
46     virtual bool SetData( wxDataObject *data );
47 
48     // add to the clipboard data.
49     virtual bool AddData( wxDataObject *data );
50 
51     // ask if data in correct format is available
52     virtual bool IsSupported( const wxDataFormat& format );
53 
54     // fill data with data on the clipboard (if available)
55     virtual bool GetData( wxDataObject& data );
56 
57     // clears wxTheClipboard and the system's clipboard if possible
58     virtual void Clear();
59 
60     // If primary == TRUE, use primary selection in all further ops,
61     // primary == FALSE resets it.
62     virtual void UsePrimarySelection(bool primary = TRUE)
63         { m_usePrimary = primary; }
64 
65     // implementation from now on
66     bool              m_open;
67     bool              m_ownsClipboard;
68     bool              m_ownsPrimarySelection;
69     //[Mad]wxDataObject     *m_data;
70     wxDataObject     *m_clipboardData;//[Mad]
71     wxDataObject     *m_primarySelectionData;//[Mad]
72 
73     GtkWidget        *m_clipboardWidget;  /* for getting and offering data */
74     GtkWidget        *m_targetsWidget;    /* for getting list of supported formats */
75     bool              m_waiting;          /* querying data or formats is asynchronous */
76 
77     bool              m_formatSupported;
78     GdkAtom           m_targetRequested;
79     bool              m_usePrimary;
80     wxDataObject     *m_receivedData;
81 
82 private:
83     DECLARE_DYNAMIC_CLASS(wxClipboardGtk)
84 };
85 
86 
87 extern wxClipboardGtk *GetClipboardGtk();
88 #ifdef wxTheClipboard
89 #undef wxTheClipboard
90 #endif
91 #define wxTheClipboard GetClipboardGtk()
92 
93 
94 #endif // _WX_GTK_CLIPBOARD_GTK_H_
95 
96 #endif // __WXGTK__
97