93 lines
20 KiB
HTML
93 lines
20 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 - Special Topics - The Deskbar</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="TheDeskbar.html" title="The Deskbar" /><link rel="prev" href="TheDeskbar.html" title="The Deskbar" /><link rel="next" href="TheKeyboard.html" title="The Keyboard" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="TheDeskbar.html" title="The Deskbar"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheDeskbar.html" title="The Deskbar"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="TheKeyboard.html" title="The Keyboard"><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 - Special Topics - The Deskbar</div></div><div id="headerB">Prev: <a href="TheDeskbar.html">The Deskbar</a> Up: <a href="TheDeskbar.html">The Deskbar</a> Next: <a href="TheKeyboard.html">The Keyboard</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="BDeskbar"></a>BDeskbar</h2></div></div></div><a id="id923950" 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">be_apps/Deskbar/Deskbar.h</code></td></tr><tr><td>Library:</td><td><code class="filename">libbe.so</code></td></tr><tr><td>Allocation:</td><td>Constructor or on the stack</td></tr></tbody></table></td><td>
|
||
<div class="toc"><ul><li><span class="section"><a href="BDeskbar.html#BDeskbar_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BDeskbar.html#BDeskbar_MemberFunctions">Member Functions</a></span></li><li><span class="section"><a href="BDeskbar.html#BDeskbar_Types">Deskbar Types</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="BDeskbar_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="BDeskbar_Constructor"></a>BDeskbar()</h4></div></div></div><code class="constructorsynopsis cpp"><span class="methodname">BDeskbar</span>();</code><p>
|
||
The constructor creates and returns a new <code class="classname">BDeskbar</code> object.
|
||
</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="BDeskbar_Destructor"></a>~BDeskbar()</h4></div></div></div><code class="destructorsynopsis cpp"><span class="methodname">BDeskbar</span>();</code><p>
|
||
Deletes the <code class="classname">BDeskbar</code> object.
|
||
</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="BDeskbar_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="BDragger_AddItem"></a><a id="BDragger_RemoveItem"></a>
|
||
<a id="BDragger_CountItems"></a>
|
||
<a id="BDragger_HasItem"></a>
|
||
<a id="BDragger_GetItemInfo"></a>
|
||
AddItem(), RemoveItem(), CountItems(), HasItem(), GetItemInfo()</h4></div></div></div><div class="synopsisgroup">
|
||
<code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">AddItem</span>(<span class="methodparam"><span class="type"><a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>* </span><span class="parameter">view</span></span>,<br /> <span class="methodparam"><span class="type">int32* </span><span class="parameter">id</span><span class="initializer"> = <span class="constant">NULL</span></span></span>);</code>
|
||
|
||
<code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">AddItem</span>(<span class="methodparam"><span class="type">entry_ref* </span><span class="parameter">addon</span></span>,<br /> <span class="methodparam"><span class="type">int32* </span><span class="parameter">id</span><span class="initializer"> = <span class="constant">NULL</span></span></span>);</code>
|
||
</div><div class="synopsisgroup">
|
||
<code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">RemoveItem</span>(<span class="methodparam"><span class="type">int32 </span><span class="parameter">id</span></span>);</code>
|
||
|
||
<code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">RemoveItem</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">name</span></span>);</code>
|
||
</div><code class="methodsynopsis cpp"><span class="type">int32 </span><span class="methodname">CountItems</span>() <span class="modifier">const</span>;</code><div class="synopsisgroup">
|
||
<code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">HasItem</span>(<span class="methodparam"><span class="type">int32 </span><span class="parameter">id</span></span>) <span class="modifier">const</span>;</code>
|
||
|
||
<code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">HasItem</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">name</span></span>) <span class="modifier">const</span>;</code>
|
||
</div><div class="synopsisgroup">
|
||
<code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">GetItemInfo</span>(<span class="methodparam"><span class="type">int32 </span><span class="parameter">for_id</span></span>,<br /> <span class="methodparam"><span class="modifier">const </span><span class="type">char** </span><span class="parameter">found_name</span></span>);</code>
|
||
|
||
<code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">GetItemInfo</span>(<span class="methodparam"><span class="modifier">const </span><span class="type">char* </span><span class="parameter">for_name</span></span>,<br /> <span class="methodparam"><span class="modifier">const </span><span class="type">int32* </span><span class="parameter">found_id</span></span>);</code>
|
||
</div><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>A view that's sitting on the Deskbar's shelf may not call any of these
|
||
functions.</p></div></div></div><p>The Deskbar contains a shelf that contains replicants (archivable
|
||
<a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>s).
|
||
Typically, these replicants monitor or control some service. For
|
||
example, the BeOS provides shelf items that monitor and control the input
|
||
method mechanism, PPP, and the mail daemon (the date/time view is not a
|
||
shelf replicant):</p><div class="mediaobject"><img src="./images/TheDeskbar/Shelf.png" alt="The BDeskbar Shelf" /></div><p><code class="methodname">AddItem()</code> puts a new item on the Deskbar's shelf.
|
||
<code class="parameter">view</code>, the <a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a> that
|
||
will be displayed on the shelf, must be archivable (see
|
||
<a class="link" href="BArchivable.html" title="BArchivable"><code class="classname">BArchivable</code></a>). An
|
||
item on the shelf is identified by name and an integer id. The name is
|
||
that of the view itself (i.e., as assigned in the
|
||
<a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a> constructor); the
|
||
id is generated by the Deskbar and is guaranteed to be unique. <code class="parameter">id</code>, if
|
||
supplied, is set to the added item's unique id number.</p><p>You can also add an item to the Deskbar by passing an <span class="type">entry_ref</span>,
|
||
<code class="parameter">addon</code>,
|
||
to the Deskbar add-on to place there.</p><p><code class="methodname">RemoveItem()</code> removes the shelf item identified
|
||
by <code class="parameter">name</code> or <code class="parameter">id</code>.</p><p><code class="methodname">CountItems()</code> returns the number
|
||
of items currently on the shelf (keep in
|
||
mind that it doesn't count the date/time view).</p><p><code class="methodname">HasItem()</code> returns <code class="constant">true</code>
|
||
if the Deskbar shelf contains the item identified by
|
||
<code class="parameter">name</code> or <code class="parameter">id</code>.</p><p><code class="methodname">GetItemInfo()</code> points
|
||
*<code class="parameter">found_name</code> to the name of the item identified by
|
||
<code class="parameter">for_id</code>, or sets <code class="parameter">found_id</code> of
|
||
the item identified by <code class="parameter">for_nam</code>e.</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>The caller is responsible for freeing found_name.</p></div></div></div><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>The request to add, remove, or get info on the item was
|
||
successfully communicated to the Deskbar. Note that this doesn't mean
|
||
that the function actually did what it was supposed to do.</p></td></tr><tr><td><p><span class="term"><code class="constant">B_BAD_VALUE</code>.</span></p></td><td><p>(<code class="methodname">GetItemInfo()</code>) *<code class="parameter">found_name</code>
|
||
is <code class="constant">NULL</code>.</p></td></tr><tr><td><p><span class="term">Negative values.</span></p></td><td><p>A message-sending error occurred.</p></td></tr></tbody></table></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="BDeskbar_Frame"></a>Frame()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type"><a class="link" href="BRect.html" title="BRect"><code class="classname">BRect</code></a> </span><span class="methodname">Frame</span>() <span class="modifier">const</span>;</code><p>Returns the Deskbar's frame in screen coordinates.</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="BDeskbar_Location"></a><a id="BDeskbar_IsExpanded"></a>
|
||
<a id="BDeskbar_SetLocation"></a>
|
||
<a id="BDeskbar_Expand"></a>
|
||
Location(), IsExpanded(), SetLocation(), Expand()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">deskbar_location </span><span class="methodname">Location</span>(<span class="methodparam"><span class="type">bool* </span><span class="parameter">isExpanded</span><span class="initializer"> = NULL</span></span>) <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">IsExpanded</span>() <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">SetLocation</span>(<span class="methodparam"><span class="type">deskbar_location </span><span class="parameter">location</span></span>,<br /> <span class="methodparam"><span class="type">bool </span><span class="parameter">isExpanded</span><span class="initializer"> = false</span></span>);</code><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">Expand</span>(<span class="methodparam"><span class="type">bool </span><span class="parameter">expand</span></span>);</code><p><code class="methodname">Location()</code> returns a symbolic description of
|
||
the Deskbar's current location; see <a class="link" href="BDeskbar.html#Types_deskbar_location" title="Deskbar Location"><span class="type">deskbar_location</span></a> for
|
||
the list of pre-defined locations. <code class="parameter">isExpanded</code> (if
|
||
supplied) is set to <code class="constant">true</code> if the Deskbar is expanded,
|
||
and <code class="constant">false</code> if it's contracted;
|
||
<code class="methodname">IsExpanded()</code> returns the expansion value directly.
|
||
Expansion and contraction is variable only if the Deskbar's location is
|
||
left-top or right-top; for all other locations, the expansion state is
|
||
hard-wired. See <a class="link" href="BDeskbar.html#Types_deskbar_location" title="Deskbar Location"><span class="type">deskbar_location</span></a> for
|
||
illustrations.</p><p><code class="methodname">SetLocation()</code> sets the Deskbar's location
|
||
and expands/contracts the Deskbar; for some locations, the
|
||
expansion/contraction is hard-wired. <code class="methodname">Expand()</code>
|
||
expands/contracts the Deskbar (if the setting isn't hard-wired) without
|
||
setting its location. You should very rarely need to call these functions.
|
||
Moving and expanding the Deskbar is in the user's domain.</p><p><code class="methodname">SetLocation()</code> and <code class="methodname">Expand()</code>
|
||
return…</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>The new location or expansion request was successfully
|
||
communicated to the Deskbar. Whether the parameters were actually
|
||
enforced isn't indicated.</p></td></tr><tr><td><p><span class="term">Negative values.</span></p></td><td><p>The Deskbar isn't running, or some other
|
||
message-sending error occurred.</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="BDeskbar_Types"></a>Deskbar Types</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="Types_deskbar_location"></a>Deskbar Location</h4></div></div></div><pre class="programlisting cpp">enum deskbar_location;</pre><div class="informaltable"><table border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Constant</th><th>Description</th></tr></thead><tbody><tr><td><code class="constant">B_DESKBAR_TOP</code></td><td>Expanded (only) along the top.</td></tr><tr><td><code class="constant">B_DESKBAR_BOTTOM</code></td><td>Expanded (only) along the bottom.</td></tr><tr><td><code class="constant">B_DESKBAR_LEFT_BOTTOM</code></td><td>Contracted (only) in bottom left corner.</td></tr><tr><td><code class="constant">B_DESKBAR_RIGHT_BOTTOM</code></td><td>Contracted (only) in bottom right corner.</td></tr><tr><td><code class="constant">B_DESKBAR_LEFT_TOP</code></td><td>In the top left corner (expanded or contracted).</td></tr><tr><td><code class="constant">B_DESKBAR_RIGHT_TOP</code></td><td>In the top right corner (expanded or contracted).</td></tr></tbody></table></div><p>The <span class="type">deskbar_location</span> constants are used to set and return the Deskbar's
|
||
location (see
|
||
<a class="link" href="BDeskbar.html#BDeskbar_Location" title="Location(), IsExpanded(), SetLocation(), Expand()"><code class="methodname">Location()</code></a>).
|
||
The six locations are shown in the two illustrations below:</p><div class="mediaobject"><img src="./images/TheDeskbar/TopBottom.png" alt="BDeskbar At Top And Bottom" /></div><div class="mediaobject"><img src="./images/TheDeskbar/Corners.png" alt="BDeskbar At Left And Right" /></div><p>The <span class="type">deskbar_location</span> value affects the Deskbar's expanded state: The
|
||
Deskbar can be expanded or contracted in <code class="constant">B_DESKBAR_LEFT_TOP</code> and
|
||
<code class="constant">B_DESKBAR_RIGHT_TOP</code> locations only. In the other locations, the
|
||
expansion/contraction is hard-wired. The illustration below shows a
|
||
left-top Deskbar in its expanded and contracted states:</p><div class="graphiclist"><table border="1"><colgroup><col /><col /></colgroup><thead><tr><th>Expanded</th><th>Contracted</th></tr></thead><tbody><tr><td>
|
||
<div class="mediaobject"><img src="./images/TheDeskbar/Expanded.png" alt="BDeskbar Expanded" /></div>
|
||
</td><td>
|
||
<div class="mediaobject"><img src="./images/TheDeskbar/Contracted.png" alt="BDeskbar Contracted" /></div>
|
||
</td></tr></tbody></table></div></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="TheDeskbar.html">The Deskbar</a> Up: <a href="TheDeskbar.html">The Deskbar</a> Next: <a href="TheKeyboard.html">The Keyboard</a> </div><div id="footerB"><div id="footerBL"><a href="TheDeskbar.html" title="The Deskbar"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheDeskbar.html" title="The Deskbar"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="TheKeyboard.html" title="The Keyboard"><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>
|