Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Clipboard.h
1 /***********************************************************************
2  created: 28/5/2011
3  author: Martin Preisler
4 
5  purpose: Defines the interface for the Clipboard static class
6 *************************************************************************/
7 /***************************************************************************
8  * Copyright (C) 2004 - 2011 Paul D Turner & The CEGUI Development Team
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  ***************************************************************************/
29 #ifndef _CEGUIClipboard_h_
30 #define _CEGUIClipboard_h_
31 
32 #include "CEGUI/String.h"
33 
34 #if defined(_MSC_VER)
35 # pragma warning(push)
36 # pragma warning(disable : 4251)
37 #endif
38 
39 // Start of CEGUI namespace section
40 namespace CEGUI
41 {
42 
47 class CEGUIEXPORT NativeClipboardProvider :
48  public AllocatedObject<NativeClipboardProvider>
49 {
50 public:
51  virtual ~NativeClipboardProvider();
52 
56  virtual void sendToClipboard(const String& mimeType, void* buffer, size_t size) = 0;
57 
61  virtual void retrieveFromClipboard(String& mimeType, void*& buffer, size_t& size) = 0;
62 };
63 
82 class CEGUIEXPORT Clipboard :
83  public AllocatedObject<NativeClipboardProvider>
84 {
85 public:
89  Clipboard();
90 
94  ~Clipboard();
95 
103  void setNativeProvider(NativeClipboardProvider* provider);
104 
109  NativeClipboardProvider* getNativeProvider() const;
110 
118  void setData(const String& mimeType, const void* buffer, size_t size);
119 
129  void getData(String& mimeType, const void*& buffer, size_t& size);
130 
134  void setText(const String& text);
135 
139  String getText();
140 
141 private:
143  String d_mimeType;
144  // just implementation specific
145  typedef char BufferElement;
147  BufferElement* d_buffer;
149  size_t d_bufferSize;
150 
152  NativeClipboardProvider* d_nativeProvider;
153 };
154 
155 } // End of CEGUI namespace section
156 
157 #if defined(_MSC_VER)
158 # pragma warning(pop)
159 #endif
160 
161 #endif // end of guard _CEGUIClipboard_h_
162