1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxClipboad class and clipboard functions
4 // Author: Vadim Zeitlin
8 // Copyright: (c) wxWindows Team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_CLIPBRD_H_BASE_
13 #define _WX_CLIPBRD_H_BASE_
16 #pragma interface "clipboardbase.h"
24 #include "wx/object.h"
25 #include "wx/wxchar.h"
27 class WXDLLEXPORT wxDataFormat
;
28 class WXDLLEXPORT wxDataObject
;
30 // ----------------------------------------------------------------------------
31 // wxClipboard represents the system clipboard. Normally, you should use
32 // wxTheClipboard which is a global pointer to the (unique) clipboard.
34 // Clipboard can be used to copy data to/paste data from. It works together
36 // ----------------------------------------------------------------------------
38 class WXDLLEXPORT wxClipboardBase
: public wxObject
43 // open the clipboard before Add/SetData() and GetData()
44 virtual bool Open() = 0;
46 // close the clipboard after Add/SetData() and GetData()
47 virtual void Close() = 0;
49 // add to the clipboard data
51 // NB: the clipboard owns the pointer and will delete it, so data must be
52 // allocated on the heap
53 virtual bool AddData( wxDataObject
*data
) = 0;
55 // set the clipboard data, this is the same as Clear() followed by
57 virtual bool SetData( wxDataObject
*data
) = 0;
59 // ask if data in correct format is available
60 virtual bool IsSupported( const wxDataFormat
& format
) = 0;
62 // fill data with data on the clipboard (if available)
63 virtual bool GetData( wxDataObject
& data
) = 0;
65 // clears wxTheClipboard and the system's clipboard if possible
66 virtual void Clear() = 0;
68 // flushes the clipboard: this means that the data which is currently on
69 // clipboard will stay available even after the application exits (possibly
70 // eating memory), otherwise the clipboard will be emptied on exit
71 virtual bool Flush() { return FALSE
; }
73 // X11 has two clipboards which get selected by this call. Empty on MSW.
74 virtual void UsePrimarySelection( bool WXUNUSED(primary
) = FALSE
) { }
76 #ifdef WXWIN_COMPATIBILITY_2
78 bool GetData(wxDataObject
*data
)
80 wxCHECK_MSG(data
, FALSE
, wxT("NULL pointer in wxClipboard"));
82 return GetData(*data
);
84 #endif // WXWIN_COMPATIBILITY_2
87 // ----------------------------------------------------------------------------
88 // include platform-specific class declaration
89 // ----------------------------------------------------------------------------
91 #if defined(__WXMSW__)
92 #include "wx/msw/clipbrd.h"
93 #elif defined(__WXMOTIF__)
94 #include "wx/motif/clipbrd.h"
95 #elif defined(__WXGTK__)
96 #include "wx/gtk/clipbrd.h"
97 #elif defined(__WXQT__)
98 #include "wx/gtk/clipbrd.h"
99 #elif defined(__WXMAC__)
100 #include "wx/mac/clipbrd.h"
101 #elif defined(__WXPM__)
102 #include "wx/os2/clipbrd.h"
103 #elif defined(__WXSTUBS__)
104 #include "wx/stubs/clipbrd.h"
107 // ----------------------------------------------------------------------------
109 // ----------------------------------------------------------------------------
111 // The global clipboard object
112 WXDLLEXPORT_DATA(extern wxClipboard
*) wxTheClipboard
;
114 #endif // wxUSE_CLIPBOARD
116 #endif // _WX_CLIPBRD_H_BASE_