|
|
|||
File indexing completed on 2026-06-02 08:58:14
0001 //////////////////////////////////////////////////////////// 0002 // 0003 // SFML - Simple and Fast Multimedia Library 0004 // Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org) 0005 // 0006 // This software is provided 'as-is', without any express or implied warranty. 0007 // In no event will the authors be held liable for any damages arising from the use of this software. 0008 // 0009 // Permission is granted to anyone to use this software for any purpose, 0010 // including commercial applications, and to alter it and redistribute it freely, 0011 // subject to the following restrictions: 0012 // 0013 // 1. The origin of this software must not be misrepresented; 0014 // you must not claim that you wrote the original software. 0015 // If you use this software in a product, an acknowledgment 0016 // in the product documentation would be appreciated but is not required. 0017 // 0018 // 2. Altered source versions must be plainly marked as such, 0019 // and must not be misrepresented as being the original software. 0020 // 0021 // 3. This notice may not be removed or altered from any source distribution. 0022 // 0023 //////////////////////////////////////////////////////////// 0024 0025 #ifndef SFML_CLIPBOARD_HPP 0026 #define SFML_CLIPBOARD_HPP 0027 0028 //////////////////////////////////////////////////////////// 0029 // Headers 0030 //////////////////////////////////////////////////////////// 0031 #include <SFML/Window/Export.hpp> 0032 #include <SFML/System/String.hpp> 0033 0034 0035 namespace sf 0036 { 0037 //////////////////////////////////////////////////////////// 0038 /// \brief Give access to the system clipboard 0039 /// 0040 //////////////////////////////////////////////////////////// 0041 class SFML_WINDOW_API Clipboard 0042 { 0043 public: 0044 0045 //////////////////////////////////////////////////////////// 0046 /// \brief Get the content of the clipboard as string data 0047 /// 0048 /// This function returns the content of the clipboard 0049 /// as a string. If the clipboard does not contain string 0050 /// it returns an empty sf::String object. 0051 /// 0052 /// \return Clipboard contents as sf::String object 0053 /// 0054 //////////////////////////////////////////////////////////// 0055 static String getString(); 0056 0057 //////////////////////////////////////////////////////////// 0058 /// \brief Set the content of the clipboard as string data 0059 /// 0060 /// This function sets the content of the clipboard as a 0061 /// string. 0062 /// 0063 /// \warning Due to limitations on some operating systems, 0064 /// setting the clipboard contents is only 0065 /// guaranteed to work if there is currently an 0066 /// open window for which events are being handled. 0067 /// 0068 /// \param text sf::String containing the data to be sent 0069 /// to the clipboard 0070 /// 0071 //////////////////////////////////////////////////////////// 0072 static void setString(const String& text); 0073 }; 0074 0075 } // namespace sf 0076 0077 0078 #endif // SFML_CLIPBOARD_HPP 0079 0080 0081 //////////////////////////////////////////////////////////// 0082 /// \class sf::Clipboard 0083 /// \ingroup window 0084 /// 0085 /// sf::Clipboard provides an interface for getting and 0086 /// setting the contents of the system clipboard. 0087 /// 0088 /// It is important to note that due to limitations on some 0089 /// operating systems, setting the clipboard contents is 0090 /// only guaranteed to work if there is currently an open 0091 /// window for which events are being handled. 0092 /// 0093 /// Usage example: 0094 /// \code 0095 /// // get the clipboard content as a string 0096 /// sf::String string = sf::Clipboard::getString(); 0097 /// 0098 /// // or use it in the event loop 0099 /// sf::Event event; 0100 /// while(window.pollEvent(event)) 0101 /// { 0102 /// if(event.type == sf::Event::Closed) 0103 /// window.close(); 0104 /// if(event.type == sf::Event::KeyPressed) 0105 /// { 0106 /// // Using Ctrl + V to paste a string into SFML 0107 /// if(event.key.control && event.key.code == sf::Keyboard::V) 0108 /// string = sf::Clipboard::getString(); 0109 /// 0110 /// // Using Ctrl + C to copy a string out of SFML 0111 /// if(event.key.control && event.key.code == sf::Keyboard::C) 0112 /// sf::Clipboard::setString("Hello World!"); 0113 /// } 0114 /// } 0115 /// \endcode 0116 /// 0117 /// \see sf::String, sf::Event 0118 /// 0119 ////////////////////////////////////////////////////////////
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|