vectozavr-shooter/SFML-VS32/doc/html/classsf_1_1Clipboard.html

153 lines
12 KiB
HTML
Raw Normal View History

2021-10-09 13:41:12 +03:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SFML - Simple and Fast Multimedia Library</title>
<meta http-equiv="Content-Type" content="text/html;"/>
<meta charset="utf-8"/>
<!--<link rel='stylesheet' type='text/css' href="https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>-->
<link rel="stylesheet" type="text/css" href="doxygen.css" title="default" media="screen,print" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
</head>
<body>
<div id="banner-container">
<div id="banner">
<span id="sfml">SFML 2.5.1</span>
</div>
</div>
<div id="content">
<!-- Generated by Doxygen 1.8.14 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>sf</b></li><li class="navelem"><a class="el" href="classsf_1_1Clipboard.html">Clipboard</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="classsf_1_1Clipboard-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">sf::Clipboard Class Reference<div class="ingroups"><a class="el" href="group__window.html">Window module</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p>Give access to the system clipboard.
<a href="classsf_1_1Clipboard.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="Clipboard_8hpp_source.html">Clipboard.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a3c385cc2b6d78a3d0cfa29928a7d6eb8"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classsf_1_1String.html">String</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Clipboard.html#a3c385cc2b6d78a3d0cfa29928a7d6eb8">getString</a> ()</td></tr>
<tr class="memdesc:a3c385cc2b6d78a3d0cfa29928a7d6eb8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the content of the clipboard as string data. <a href="#a3c385cc2b6d78a3d0cfa29928a7d6eb8">More...</a><br /></td></tr>
<tr class="separator:a3c385cc2b6d78a3d0cfa29928a7d6eb8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a29c597c2165d3ca3a89c17f31ff7413d"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Clipboard.html#a29c597c2165d3ca3a89c17f31ff7413d">setString</a> (const <a class="el" href="classsf_1_1String.html">String</a> &amp;text)</td></tr>
<tr class="memdesc:a29c597c2165d3ca3a89c17f31ff7413d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the content of the clipboard as string data. <a href="#a29c597c2165d3ca3a89c17f31ff7413d">More...</a><br /></td></tr>
<tr class="separator:a29c597c2165d3ca3a89c17f31ff7413d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Give access to the system clipboard. </p>
<p><a class="el" href="classsf_1_1Clipboard.html" title="Give access to the system clipboard. ">sf::Clipboard</a> provides an interface for getting and setting the contents of the system clipboard.</p>
<p>It is important to note that due to limitations on some operating systems, setting the clipboard contents is only guaranteed to work if there is currently an open window for which events are being handled.</p>
<p>Usage example: </p><div class="fragment"><div class="line"><span class="comment">// get the clipboard content as a string</span></div><div class="line"><a class="code" href="classsf_1_1String.html">sf::String</a> <span class="keywordtype">string</span> = <a class="code" href="classsf_1_1Clipboard.html#a3c385cc2b6d78a3d0cfa29928a7d6eb8">sf::Clipboard::getString</a>();</div><div class="line"></div><div class="line"><span class="comment">// or use it in the event loop</span></div><div class="line"><a class="code" href="classsf_1_1Event.html">sf::Event</a> event;</div><div class="line"><span class="keywordflow">while</span>(window.pollEvent(event))</div><div class="line">{</div><div class="line"> <span class="keywordflow">if</span>(event.<a class="code" href="classsf_1_1Event.html#adf2f8044f713fd9d6019077b0d1ffe0a">type</a> == <a class="code" href="classsf_1_1Event.html#af41fa9ed45c02449030699f671331d4aa316e4212e083f1dce79efd8d9e9c0a95">sf::Event::Closed</a>)</div><div class="line"> window.close();</div><div class="line"> <span class="keywordflow">if</span>(event.<a class="code" href="classsf_1_1Event.html#adf2f8044f713fd9d6019077b0d1ffe0a">type</a> == <a class="code" href="classsf_1_1Event.html#af41fa9ed45c02449030699f671331d4aac3c7abfaa98c73bfe6be0b57df09c71b">sf::Event::KeyPressed</a>)</div><div class="line"> {</div><div class="line"> <span class="comment">// Using Ctrl + V to paste a string into SFML</span></div><div class="line"> <span class="keywordflow">if</span>(event.<a class="code" href="classsf_1_1Event.html#a45b92fc6757ca7c193f06b302e424ab0">key</a>.<a class="code" href="structsf_1_1Event_1_1KeyEvent.html#a9255861c2f88501d80ad6b44a310b62f">control</a> &amp;&amp; event.<a class="code" href="classsf_1_1Event.html#a45b92fc6757ca7c193f06b302e424ab0">key</a>.<a class="code" href="structsf_1_1Event_1_1KeyEvent.html#a2879fdab8a68cb1c6ecc45730a2d0e61">code</a> == <a class="code" href="classsf_1_1Keyboard.html#acb4cacd7cc5802dec45724cf3314a142aec9074abd2d41628d1ecdc14e1b2cd96">sf::Keyboard::V</a>)</div><div class="line"> <span class="keywordtype">string</span> = <a class="code" href="classsf_1_1Clipboard.html#a3c385cc2b6d78a3d0cfa29928a7d6eb8">sf::Clipboard::getString</a>();</div><div class="line"></div><div class="line"> <span class="comment">// Using Ctrl + C to copy a string out of SFML</span></div><div class="line"> <span class="keywordflow">if</span>(event.<a class="code" href="classsf_1_1Event.html#a45b92fc6757ca7c193f06b302e424ab0">key</a>.<a class="code" href="structsf_1_1Event_1_1KeyEvent.html#a9255861c2f88501d80ad6b44a310b62f">control</a> &amp;&amp; event.<a class="code" href="classsf_1_1Event.html#a45b92fc6757ca7c193f06b302e424ab0">key</a>.<a class="code" href="structsf_1_1Event_1_1KeyEvent.html#a2879fdab8a68cb1c6ecc45730a2d0e61">code</a> == <a class="code" href="classsf_1_1Keyboard.html#acb4cacd7cc5802dec45724cf3314a142a0d586c4ec0cd6b537cb6f49180fedecc">sf::Keyboard::C</a>)</div><div class="line"> <a class="code" href="classsf_1_1Clipboard.html#a29c597c2165d3ca3a89c17f31ff7413d">sf::Clipboard::setString</a>(<span class="stringliteral">&quot;Hello World!&quot;</span>);</div><div class="line"> }</div><div class="line">}</div></div><!-- fragment --><dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1String.html" title="Utility string class that automatically handles conversions between types and encodings. ">sf::String</a>, <a class="el" href="classsf_1_1Event.html" title="Defines a system event and its parameters. ">sf::Event</a> </dd></dl>
<p class="definition">Definition at line <a class="el" href="Clipboard_8hpp_source.html#l00041">41</a> of file <a class="el" href="Clipboard_8hpp_source.html">Clipboard.hpp</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a3c385cc2b6d78a3d0cfa29928a7d6eb8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3c385cc2b6d78a3d0cfa29928a7d6eb8">&#9670;&nbsp;</a></span>getString()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static <a class="el" href="classsf_1_1String.html">String</a> sf::Clipboard::getString </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the content of the clipboard as string data. </p>
<p>This function returns the content of the clipboard as a string. If the clipboard does not contain string it returns an empty <a class="el" href="classsf_1_1String.html" title="Utility string class that automatically handles conversions between types and encodings. ">sf::String</a> object.</p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="classsf_1_1Clipboard.html" title="Give access to the system clipboard. ">Clipboard</a> contents as <a class="el" href="classsf_1_1String.html" title="Utility string class that automatically handles conversions between types and encodings. ">sf::String</a> object </dd></dl>
</div>
</div>
<a id="a29c597c2165d3ca3a89c17f31ff7413d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a29c597c2165d3ca3a89c17f31ff7413d">&#9670;&nbsp;</a></span>setString()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static void sf::Clipboard::setString </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classsf_1_1String.html">String</a> &amp;&#160;</td>
<td class="paramname"><em>text</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the content of the clipboard as string data. </p>
<p>This function sets the content of the clipboard as a string.</p>
<dl class="section warning"><dt>Warning</dt><dd>Due to limitations on some operating systems, setting the clipboard contents is only guaranteed to work if there is currently an open window for which events are being handled.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">text</td><td><a class="el" href="classsf_1_1String.html" title="Utility string class that automatically handles conversions between types and encodings. ">sf::String</a> containing the data to be sent to the clipboard </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="Clipboard_8hpp_source.html">Clipboard.hpp</a></li>
</ul>
</div><!-- contents -->
</div>
<div id="footer-container">
<div id="footer">
SFML is licensed under the terms and conditions of the <a href="https://www.sfml-dev.org/license.php">zlib/png license</a>.<br>
Copyright &copy; Laurent Gomila &nbsp;::&nbsp;
Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen</a> &nbsp;::&nbsp;
</div>
</div>
</body>
</html>