]> git.saurik.com Git - wxWidgets.git/blob - include/wx/clipbrd.h
7f79269aed56619cdf55cf6868f584482d148942
[wxWidgets.git] / include / wx / clipbrd.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/clipbrd.h
3 // Purpose: wxClipboad class and clipboard functions
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 19.10.99
7 // RCS-ID: $Id$
8 // Copyright: (c) wxWindows Team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_CLIPBRD_H_BASE_
13 #define _WX_CLIPBRD_H_BASE_
14
15 #ifdef __GNUG__
16 #pragma interface "clipboardbase.h"
17 #endif
18
19 #include "wx/defs.h"
20
21 #if wxUSE_CLIPBOARD
22
23
24 #include "wx/object.h"
25 #include "wx/wxchar.h"
26
27 class WXDLLEXPORT wxDataFormat;
28 class WXDLLEXPORT wxDataObject;
29
30 // ----------------------------------------------------------------------------
31 // wxClipboard represents the system clipboard. Normally, you should use
32 // wxTheClipboard which is a global pointer to the (unique) clipboard.
33 //
34 // Clipboard can be used to copy data to/paste data from. It works together
35 // with wxDataObject.
36 // ----------------------------------------------------------------------------
37
38 class WXDLLEXPORT wxClipboardBase : public wxObject
39 {
40 public:
41 wxClipboardBase();
42
43 // open the clipboard before Add/SetData() and GetData()
44 virtual bool Open() = 0;
45
46 // close the clipboard after Add/SetData() and GetData()
47 virtual void Close() = 0;
48
49 // add to the clipboard data
50 //
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;
54
55 // set the clipboard data, this is the same as Clear() followed by
56 // AddData()
57 virtual bool SetData( wxDataObject *data ) = 0;
58
59 // ask if data in correct format is available
60 virtual bool IsSupported( const wxDataFormat& format ) = 0;
61
62 // fill data with data on the clipboard (if available)
63 virtual bool GetData( wxDataObject& data ) = 0;
64
65 // clears wxTheClipboard and the system's clipboard if possible
66 virtual void Clear() = 0;
67
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; }
72
73 // X11 has two clipboards which get selected by this call. Empty on MSW.
74 virtual void UsePrimarySelection( bool WXUNUSED(primary) = FALSE ) { }
75
76 #ifdef WXWIN_COMPATIBILITY_2
77 // deprecated version
78 bool GetData(wxDataObject *data)
79 {
80 wxCHECK_MSG(data, FALSE, wxT("NULL pointer in wxClipboard"));
81
82 return GetData(*data);
83 }
84 #endif // WXWIN_COMPATIBILITY_2
85 };
86
87 // ----------------------------------------------------------------------------
88 // include platform-specific class declaration
89 // ----------------------------------------------------------------------------
90
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"
105 #endif
106
107 // ----------------------------------------------------------------------------
108 // globals
109 // ----------------------------------------------------------------------------
110
111 // The global clipboard object
112 WXDLLEXPORT_DATA(extern wxClipboard *) wxTheClipboard;
113
114 #endif // wxUSE_CLIPBOARD
115
116 #endif // _WX_CLIPBRD_H_BASE_