63 lines
17 KiB
HTML
63 lines
17 KiB
HTML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - Classes And Methods - The Application Kit</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
|
||
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
|
||
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheApplicationKit.html" title="The Application Kit" /><link rel="prev" href="BApplication.html" title="BApplication" /><link rel="next" href="BCursor.html" title="BCursor" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BApplication.html" title="BApplication"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheApplicationKit.html" title="The Application Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BCursor.html" title="BCursor"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - Classes And Methods - The Application Kit</div></div><div id="headerB">Prev: <a href="BApplication.html">BApplication</a> Up: <a href="TheApplicationKit.html">The Application Kit</a> Next: <a href="BCursor.html">BCursor</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BClipboard"></a>BClipboard</h2></div></div></div><a id="id670841" class="indexterm"></a><div class="classheader"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td><table width="100%" border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Derived From:</td><td>–</td></tr><tr><td>Mix-in Classes:</td><td>–</td></tr><tr><td>Declared In:</td><td><code class="filename">app/Clipboard.h</code></td></tr><tr><td>Library:</td><td><code class="filename">libbe.so</code></td></tr><tr><td>Allocation:</td><td>Constructor, on the stack, or use the
|
||
<a class="link" href="BClipboard.html#BClipboard_be_clipboard" title="be_clipboard"><code class="varname">be_clipboard</code></a>
|
||
global object.</td></tr></tbody></table></td><td>
|
||
<a class="link overview" href="BClipboard_Overview.html" title="BClipboard">Class Overview</a>
|
||
<div class="toc"><ul><li><span class="section"><a href="BClipboard.html#BClipboard_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BClipboard.html#BClipboard_MemberFunctions">Member Functions</a></span></li><li><span class="section"><a href="BClipboard.html#BClipboard_GlobalVariables">Global Variables</a></span></li></ul></div>
|
||
</td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BClipboard_ConstructorDestructor"></a>Constructor and Destructor</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BClipboard_Constructor"></a>BClipboard()</h4></div></div></div><code class="constructorsynopsis cpp"><span class="methodname">BClipboard</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">name</span></span>,<br /> <span class="methodparam"><span class="type">bool </span><span class="parameter">discard</span><span class="initializer"> = <span class="constant">false</span></span></span>);</code><p>Creates a new <code class="classname">BClipboard</code> object that refers to the
|
||
<code class="parameter">name</code> clipboard. The clipboard itself is created if a
|
||
clipboard of that name doesn't already exist.</p><p>The <code class="parameter">discard</code> flag is currently unused.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BClipboard_Destructor"></a>~BClipboard()</h4></div></div></div><code class="destructorsynopsis cpp"><span class="modifier">virtual </span><span class="methodname">~BClipboard</span>();</code><p>Destroys the <code class="classname">BClipboard</code> object. The clipboard
|
||
itself and the data it contains are not affected by the object's destruction.</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BClipboard_MemberFunctions"></a>Member Functions</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BClipboard_Clear"></a><a id="BClipboard_Commit"></a>
|
||
<a id="BClipboard_Revert"></a>
|
||
Clear(), Commit(), Revert()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">Clear</span>();</code><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">Commit</span>();</code><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">Revert</span>();</code><p>These functions are used when you're writing data to the clipboard.
|
||
<code class="methodname">Clear()</code> prepares your <code class="classname">BClipboard</code>
|
||
for writing. You call <code class="methodname">Clear()</code> just before you add
|
||
new data to your clipboard message. <code class="methodname">Commit()</code> copies your
|
||
<code class="classname">BClipboard</code> data back to the clipboard. See
|
||
"<a class="link" href="BClipboard_Overview.html#BClipboard_Overview_Writing_To_The_Clipboard" title="Writing to the Clipboard">Writing to the Clipboard</a>"
|
||
for an example of these functions.</p><p><code class="methodname">Revert()</code> refreshes the <code class="classname">BClipboard</code>'s
|
||
data message by uploading it from the clipboard. The function is provided for
|
||
the (rare) case where you alter your <code class="classname">BClipboard</code>'s data message,
|
||
and then decide to back out of the change. In this case, you should call
|
||
<code class="methodname">Revert()</code> (rather than <code class="methodname">Commit()</code>).
|
||
If you don't revert, your <code class="classname">BClipboard</code>'s message will still
|
||
contain your unwanted change, even if you unlock and then re-lock the object.</p><p>All three functions return <code class="constant">B_ERROR</code> if the
|
||
<code class="classname">BClipboard</code> isn't locked, and <code class="constant">B_OK</code> otherwise.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BClipboard_Data"></a>Data()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type"><a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>* </span><span class="methodname">Data</span>() <span class="modifier">const</span>;</code><p>Returns the <a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>
|
||
object that holds the <code class="classname">BClipboard</code>'s data, or
|
||
<code class="constant">NULL</code> if the <code class="classname">BClipboard</code> isn't
|
||
locked. You're expected to read and write the <a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a> directly;
|
||
however, you may not free it or dispatch it like a normal <a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>. If you change
|
||
the <a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a> and
|
||
want to write it back to the clipboard, you have to call
|
||
<code class="methodname">Commit()</code> after you make the change.</p><p>See
|
||
"<a class="link" href="BClipboard_Overview.html#BClipboard_Overview_The_Clipboard_Message" title="The Clipboard Message">The Clipboard Message</a>"
|
||
for more information.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BClipboard_DataSource"></a>DataSource()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type"><a class="link" href="BMessenger.html" title="BMessenger"><code class="classname">BMessenger</code></a> </span><span class="methodname">DataSource</span>() <span class="modifier">const</span>;</code><p>Returns a <a class="link" href="BMessenger.html" title="BMessenger"><code class="classname">BMessenger</code></a> that targets
|
||
the <a class="link" href="BApplication.html" title="BApplication"><code class="classname">BApplication</code></a>
|
||
object of the application that last committed data to the clipboard. The
|
||
<code class="classname">BClipboard</code> needn't be locked.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BClipboard_LocalCount"></a><a id="BClipboard_SystemCount"></a>
|
||
LocalCount(), SystemCount()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">uint32 </span><span class="methodname">LocalCount</span>() <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="type">uint32 </span><span class="methodname">SystemCount</span>() <span class="modifier">const</span>;</code><p>These functions return the clipboard count. <code class="methodname">LocalCount()</code>
|
||
uses a cached count, while <code class="methodname">SystemCount()</code> asks the
|
||
<span class="application">Application Server</span> for the more accurate system counter.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BClipboard_Lock"></a><a id="BClipboard_Unlock"></a>
|
||
<a id="BClipboard_IsLocked"></a>
|
||
Lock(), Unlock(), IsLocked()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">Lock</span>();</code><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">Unlock</span>();</code><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">IsLocked</span>();</code><p><code class="methodname">Lock()</code> uploads data from the clipboard into your
|
||
<code class="classname">BClipboard</code> object, and locks the object so no other
|
||
thread in your application can use it. You must call
|
||
<code class="methodname">Lock()</code> before reading or writing the
|
||
<code class="classname">BClipboard</code>. <code class="methodname">Lock()</code> blocks
|
||
if the object is already locked. It returns <code class="constant">true</code> if
|
||
the lock was acquired, and <code class="constant">false</code> if the
|
||
<code class="classname">BClipboard</code> object was deleted while
|
||
<code class="methodname">Lock()</code> was blocked.</p><div class="admonition warning"><div class="title">Warning</div><div class="graphic"><img class="icon" alt="Warning" width="32" src="./images/admonitions/Stop_32.png" /><div class="text"><p>There's no way to tell <code class="methodname">Lock()</code> to time out.</p></div></div></div><p><code class="methodname">Unlock()</code> unlocks the object so other threads in your application can use it.</p><p><code class="methodname">IsLocked()</code> hardly needs to be documented.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BClipboard_Name"></a>Name()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">const </span><span class="type">char* </span><span class="methodname">Name</span>() <span class="modifier">const</span>;</code><p>Returns the name of the clipboard. The object needn't be locked.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BClipboard_StartWatching"></a><a id="BClipboard_StopWatching"></a>
|
||
StartWatching(), StopWatching()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">StartWatching</span>(<span class="methodparam"><span class="type">BMessenger </span><span class="parameter">target</span></span>);</code><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">StopWatching</span>(<span class="methodparam"><span class="type">BMessenger </span><span class="parameter">target</span></span>);</code><p>If you want to be alerted when the clipboard changes, call
|
||
<code class="methodname">StartWatching()</code>, passing a <a class="link" href="BMessenger.html" title="BMessenger"><code class="classname">BMessenger</code></a> to be the
|
||
target for the notification. When the clipboard changes, a
|
||
<code class="constant">B_CLIPBOARD_CHANGED</code> message will be sent to the
|
||
target.</p><p><code class="methodname">StopWatching()</code> stops monitoring the clipboard for changes.</p><table class="variablelist returncodes"><thead><tr><th>Return Code</th><th>Description</th></tr></thead><tbody><tr><td><p><span class="term"><code class="constant">B_OK</code>.</span></p></td><td><p>No error.</p></td></tr><tr><td><p><span class="term">Other errors.</span></p></td><td><p>You get the idea.</p></td></tr></tbody></table></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BClipboard_GlobalVariables"></a>Global Variables</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BClipboard_be_clipboard"></a>be_clipboard</h4></div></div></div><pre class="programlisting definition cpp"><span class="type">BClipboard*</span> <code class="varname">be_clipboard</code></pre><p>This variable gives applications access to the system clipboard—the
|
||
shared repository of data for cut, copy, and paste operations. It's
|
||
initialized at startup.</p></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BApplication.html">BApplication</a> Up: <a href="TheApplicationKit.html">The Application Kit</a> Next: <a href="BCursor.html">BCursor</a> </div><div id="footerB"><div id="footerBL"><a href="BApplication.html" title="BApplication"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheApplicationKit.html" title="The Application Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BCursor.html" title="BCursor"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
|
||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
|
||
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>
|