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
) { }
78 // ----------------------------------------------------------------------------
79 // include platform-specific class declaration
80 // ----------------------------------------------------------------------------
82 #if defined(__WXMSW__)
83 #include "wx/msw/clipbrd.h"
84 #elif defined(__WXMOTIF__)
85 #include "wx/motif/clipbrd.h"
86 #elif defined(__WXGTK__)
87 #include "wx/gtk/clipbrd.h"
88 #elif defined(__WXQT__)
89 #include "wx/gtk/clipbrd.h"
90 #elif defined(__WXMAC__)
91 #include "wx/mac/clipbrd.h"
92 #elif defined(__WXPM__)
93 #include "wx/os2/clipbrd.h"
94 #elif defined(__WXSTUBS__)
95 #include "wx/stubs/clipbrd.h"
98 // ----------------------------------------------------------------------------
100 // ----------------------------------------------------------------------------
102 // The global clipboard object
103 WXDLLEXPORT_DATA(extern wxClipboard
*) wxTheClipboard
;
105 #endif // wxUSE_CLIPBOARD
107 #endif // _WX_CLIPBRD_H_BASE_