1 /* 2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/ 3 * Distributed under the MIT License 4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT) 5 */ 6 7 #ifndef MYGUI_CLIPBOARD_MANAGER_H_ 8 #define MYGUI_CLIPBOARD_MANAGER_H_ 9 10 #include "MyGUI_Prerequest.h" 11 #include "MyGUI_Singleton.h" 12 #include "MyGUI_Types.h" 13 #include "MyGUI_UString.h" 14 15 namespace MyGUI 16 { 17 18 class WindowsClipboardHandler; 19 20 class MYGUI_EXPORT ClipboardManager : 21 public Singleton<ClipboardManager> 22 { 23 public: 24 ClipboardManager(); 25 26 void initialise(); 27 void shutdown(); 28 29 /** Set current data in clipboard and trigger eventClipboardChanged. To be used by widgets. 30 @param _type of data (for example "Text") 31 @param _data 32 */ 33 void setClipboardData(const std::string& _type, const std::string& _data); 34 35 /** Clear specific type data 36 @param _type of data to delete (for example "Text") 37 */ 38 void clearClipboardData(const std::string& _type); 39 40 /** Get specific type data 41 @param _type of data to get (for example "Text") 42 */ 43 std::string getClipboardData(const std::string& _type); 44 45 /*events:*/ 46 /** Event : Clipboard content was changed via setClipboardData.\n 47 signature : void method(const std::string& _type, const std::string& _data)\n 48 @param _type of data (for example "Text") 49 @param _data 50 */ 51 delegates::CMultiDelegate2<const std::string&, const std::string&> eventClipboardChanged; 52 53 /** Event : The content of the clipboard is being requested via getClipboardData.\n 54 Delegates of this event can modify the _data argument in-place to change the data returned by getClipboardData. 55 signature : void method(const std::string& _type, std::string& _data)\n 56 @param _type of data (for example "Text") 57 @param _data 58 */ 59 delegates::CMultiDelegate2<const std::string&, std::string&> eventClipboardRequested; 60 61 private: 62 MapString mClipboardData; 63 64 #if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32 65 WindowsClipboardHandler* mWindowsClipboardHandler; 66 #endif 67 68 bool mIsInitialise; 69 }; 70 71 } // namespace MyGUI 72 73 #endif // MYGUI_CLIPBOARD_MANAGER_H_ 74