haiku-website/static/legacy-docs/bebook/BDragger.html

144 lines
24 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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 Interface 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="TheInterfaceKit.html" title="The Interface Kit" /><link rel="prev" href="BControl.html" title="BControl" /><link rel="next" href="BFont.html" title="BFont" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BControl.html" title="BControl"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheInterfaceKit.html" title="The Interface Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BFont.html" title="BFont"><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 Interface Kit</div></div><div id="headerB">Prev: <a href="BControl.html">BControl</a>  Up: <a href="TheInterfaceKit.html">The Interface Kit</a>  Next: <a href="BFont.html">BFont</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="BDragger"></a>BDragger</h2></div></div></div><a id="id980174" 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><a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a></td></tr><tr><td>Mix-in Classes:</td><td></td></tr><tr><td>Declared In:</td><td><code class="filename">interface/Dragger.h</code></td></tr><tr><td>Library:</td><td><code class="filename">libbe.so</code></td></tr><tr><td>Allocation:</td><td></td></tr></tbody></table></td><td>
<a class="link overview" href="BDragger_Overview.html" title="BDragger">Class Overview</a>
<div class="toc"><ul><li><span class="section"><a href="BDragger.html#BDragger_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BDragger.html#BDragger_HookFunctions">Hook Functions</a></span></li><li><span class="section"><a href="BDragger.html#BDragger_MemberFunctions">Member Functions</a></span></li><li><span class="section"><a href="BDragger.html#BDragger_StaticFunctions">Static Functions</a></span></li><li><span class="section"><a href="BDragger.html#BDragger_ArchivedFields">Archived Fields</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="BDragger_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="BDragger_Constructor"></a>BDragger()</h4></div></div></div><div class="synopsisgroup">
<code class="constructorsynopsis cpp"><span class="methodname">BDragger</span>(<span class="methodparam"><span class="type"><a class="link" href="BRect.html" title="BRect"><code class="classname">BRect</code></a> </span><span class="parameter">frame</span></span>,<br />         <span class="methodparam"><span class="type"><a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a>* </span><span class="parameter">target</span></span>,<br />         <span class="methodparam"><span class="type">uint32 </span><span class="parameter">resizingMode</span><span class="initializer"> = <span class="constant">B_FOLLOW_NONE</span></span></span>,<br />         <span class="methodparam"><span class="type">uint32 </span><span class="parameter">flags</span><span class="initializer"> = <span class="constant">B_WILL_DRAW</span></span></span>);</code>
<code class="constructorsynopsis cpp"><span class="methodname">BDragger</span>(<span class="methodparam"><span class="type"><a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>* </span><span class="parameter">archive</span></span>);</code>
</div><p>
Creates a new <code class="classname">BDragger</code> and sets its target view.
The <code class="classname">BDragger</code> and the
target <a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a> must be
directly related in the view hierarchy (as
parent-child or as siblings); but, note well, the constructor doesn't
establish this relationship for you. After you construct you <code class="classname">BDragger</code>,
you have to do one of three things:
</p><div class="orderedlist"><ol><li><p>
add the target as a child of the dragger,
</p></li><li><p>
add the dragger as a child of the target,
</p></li><li><p>
or add the dragger as a sibling of the target.
</p></li></ol></div><p>
If you add the target as a child of <code class="classname">BDragger</code>, it should be the only child
that the <code class="classname">BDragger</code> has.
</p><p>
A <code class="classname">BDragger</code> draws in the right bottom corner of its frame rectangle. If
the <code class="parameter">target</code> view is a parent or a sibling of the <code class="classname">BDragger</code>, that rectangle
needs to be no larger than the image the <code class="classname">BDragger</code> draws (the handle).
However, if the target is the <code class="classname">BDragger</code>'s child, the dragger's frame
rectangle must enclose the target's frame (so that the dragger doesn't
clip the target).
</p><p>
A <code class="classname">BDragger</code> is fully functional once it has been constructed and attached
to the view hierarchy of its target. You don't need to call any other
functions. However, the whole endeavor fails if the target
<a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a> can't be
archived.
</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="BDragger_Destructor"></a>~BDragger()</h4></div></div></div><code class="destructorsynopsis cpp"><span class="modifier">virtual </span><span class="methodname">~BDragger</span>();</code><p>
Frees all memory the <code class="classname">BDragger</code> allocated (principally for the bitmap image
it draws).
</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="BDragger_HookFunctions"></a>Hook 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_AttachedToWindow"></a><a id="BDragger_DetachedFromWindow"></a>
AttachedToWindow(), DetachedFromWindow()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">AttachedToWindow</span>();</code><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">DetachedFromWindow</span>();</code><p>
<code class="methodname">AttachedToWindow()</code> makes sure that the
<code class="classname">BDragger</code> is under the control of
the <a class="link" href="BDragger.html#BDragger_HideAllDraggers" title="HideAllDraggers(), ShowAllDraggers(), AreDraggersDrawn()"><code class="methodname">HideAllDraggers()</code></a>
and <a class="link" href="BDragger.html#BDragger_ShowAllDraggers"><code class="methodname">ShowAllDraggers()</code></a>
functions, makes its low and
background view colors match the view color of its parent, and determines
the <code class="classname">BDragger</code>'s precise relationship to its target view. To make this
determination, the target must be in the view hierarchy; it can't be
added to the window after the <code class="classname">BDragger</code> is. For example, if the target is
the <code class="classname">BDragger</code>'s child, it should be added to the
<code class="classname">BDragger</code> and then the
<code class="classname">BDragger</code> added to the window.
</p><p>
<code class="methodname">DetachedFromWindow()</code> removes the <code class="classname">BDragger</code>
from the control of the
<a class="link" href="BDragger.html#BDragger_HideAllDraggers" title="HideAllDraggers(), ShowAllDraggers(), AreDraggersDrawn()"><code class="methodname">HideAllDraggers()</code></a>
and <a class="link" href="BDragger.html#BDragger_ShowAllDraggers"><code class="methodname">ShowAllDraggers()</code></a> functions.
</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="BDragger_Draw"></a>Draw()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">Draw</span>(<span class="methodparam"><span class="type"><a class="link" href="BRect.html" title="BRect"><code class="classname">BRect</code></a> </span><span class="parameter">updateRect</span></span>);</code><p>
Draws the handle—or fails to draw it and has the parent view draw
in that area instead, if all <code class="classname">BDragger</code>s are hidden.
</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="BDragger_MessageReceived"></a>MessageReceived()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">MessageReceived</span>(<span class="methodparam"><span class="type"><a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>* </span><span class="parameter">message</span></span>);</code><p>
Responds to messages that regulate the visibility of the <code class="classname">BDragger</code> handle.
</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="BDragger_MouseDown"></a>MouseDown()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="void">void </span><span class="methodname">MouseDown</span>(<span class="methodparam"><span class="type"><a class="link" href="BPoint.html" title="BPoint"><code class="classname">BPoint</code></a> </span><span class="parameter">where</span></span>);</code><p>
Responds to a <code class="constant">B_MOUSE_DOWN</code> message by archiving the target view (and the
<code class="classname">BDragger</code>) and initiating a drag-and-drop operation, or by taking other
appropriate action.
</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="BDragger_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_Archive"></a>Archive()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">virtual </span><span class="type">status_t </span><span class="methodname">Archive</span>(<span class="methodparam"><span class="type"><a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>* </span><span class="parameter">archive</span></span>,<br />                         <span class="methodparam"><span class="type">bool </span><span class="parameter">deep</span><span class="initializer"> = <span class="constant">true</span></span></span>) <span class="modifier">const</span>;</code><p>
Records the <code class="classname">BDragger</code>'s hierarchical relationship to the target view and
then calls
<a class="link" href="BView.html#BView_Archive" title="Archive()"><code class="methodname">BView::Archive()</code></a>
. The <code class="parameter">deep</code> flag has no significance for
<code class="classname">BDragger</code> itself, but note that the flag is passed on to the
<a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a> version.
</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="BDragger_IsVisibilityChanging"></a>IsVisibilityChanging()</h4></div><div xmlns:d="http://docbook.org/ns/docbook"><h5 xmlns="http://www.w3.org/1999/xhtml" class="subtitle">protected</h5></div></div></div><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">IsVisibilityChanging</span>() <span class="modifier">const</span>;</code><p>
Returns <code class="constant">true</code> if two things are true:
</p><div class="orderedlist"><ol><li><p>
The <code class="classname">BDragger</code> is the parent of its target.
</p></li><li><p>
The <code class="classname">BDragger</code> handle was visible but now should not be, or it wasn't
visible and now should be.
</p></li></ol></div><p>
Otherwise, this function returns <code class="constant">false</code>.
</p><p>
What's this function for? It's in the API so derived classes can
implement their own versions of
<a class="link" href="BDragger.html#BDragger_Draw" title="Draw()"><code class="methodname">Draw()</code></a>.
If the <code class="classname">BDragger</code> isn't the parent
of its target, the visibility of the <code class="classname">BDragger</code> view can be controlled by
the
<a class="link" href="BView.html#BView_Hide" title="Hide(), Show()"><code class="methodname">Hide()</code></a> and
<a class="link" href="BView.html#BView_Show"><code class="methodname">Show()</code></a>
functions rather than
<a class="link" href="BDragger.html#BDragger_Draw" title="Draw()"><code class="methodname">Draw()</code></a>.
</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="BDragger_PopUp"></a><a id="BDragger_SetPopUp"></a>
PopUp(), SetPopUp()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type"><a class="link" href="BPopUpMenu.html" title="BPopUpMenu"><code class="classname">BPopUpMenu</code></a>* </span><span class="methodname">PopUp</span>() <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="type">status_t </span><span class="methodname">SetPopUp</span>(<span class="methodparam"><span class="type"><a class="link" href="BPopUpMenu.html" title="BPopUpMenu"><code class="classname">BPopUpMenu</code></a>* </span><span class="parameter">context_menu</span></span>);</code><p>
Returns and sets the <a class="link" href="BPopUpMenu.html" title="BPopUpMenu"><code class="classname">BPopUpMenu</code></a>
displayed when the user right clicks on
the <code class="classname">BDragger</code> view after it has been attached to a
<a class="link" href="BShelf.html" title="BShelf"><code class="classname">BShelf</code></a>.
</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="BDragger_StaticFunctions"></a>Static 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_HideAllDraggers"></a><a id="BDragger_ShowAllDraggers"></a>
<a id="BDragger_AreDraggersDrawn"></a>
HideAllDraggers(), ShowAllDraggers(), AreDraggersDrawn()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">static </span><span class="type">status_t </span><span class="methodname">HideAllDraggers</span>();</code><code class="methodsynopsis cpp"><span class="modifier">static </span><span class="type">status_t </span><span class="methodname">ShowAllDraggers</span>();</code><code class="methodsynopsis cpp"><span class="modifier">static </span><span class="type">bool </span><span class="methodname">AreDraggersDrawn</span>();</code><p>
These functions communicate with all <code class="classname">BDragger</code> objects in all applications
(provided they're attached to windows). <code class="methodname">HideAllDraggers()</code> hides the
<code class="classname">BDragger</code> objects so that they're not visible on-screen. <code class="methodname">ShowAllDraggers()</code>
undoes the effect of <code class="methodname">HideAllDraggers()</code> and causes all <code class="classname">BDragger</code> objects to
draw their handles. The <span class="guimenuitem">Show Replicants</span> / <span class="guimenuitem">Hide Replicants</span> menu item does
its work through these functions.
</p><p>
<code class="methodname">HideAllDraggers()</code> may or may not hide the <code class="classname">BDragger</code> view in the way that
<a class="link" href="BView.html" title="BView"><code class="classname">BView</code>'s</a>
<a class="link" href="BView.html#BView_Hide" title="Hide(), Show()"><code class="methodname">Hide()</code></a>
function does. The <code class="classname">BDragger</code> may still be visible, although
it won't draw anything until <code class="methodname">ShowAllDraggers()</code> is called. Therefore, if
the target <a class="link" href="BView.html" title="BView"><code class="classname">BView</code></a> is the
<code class="classname">BDragger</code>'s child, it will not be hidden when
<code class="methodname">HideAllDraggers()</code> erases its parent.
</p><p>
<code class="methodname">AreDraggersDrawn()</code> returns <code class="constant">true</code>
when the <code class="classname">BDragger</code>s are shown and <code class="constant">false</code>
when they're hidden.
</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="BDragger_Instantiate"></a>Instantiate()</h4></div></div></div><code class="methodsynopsis cpp"><span class="modifier">static </span><span class="type"><a class="link" href="BArchivable.html" title="BArchivable"><code class="classname">BArchivable</code></a>* </span><span class="methodname">Instantiate</span>(<span class="methodparam"><span class="type"><a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>* </span><span class="parameter">archive</span></span>);</code><p>
Returns a new <code class="classname">BDragger</code> object, allocated by new and created with the
version of the constructor that takes a
<a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a> archive. If the archive
message doesn't contain an archived <code class="classname">BDragger</code>,
<code class="methodname">Instantiate()</code> returns <code class="constant">NULL</code>.
</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="BDragger_ArchivedFields"></a>Archived Fields</h3></div></div></div><p>
The <code class="methodname">Archive()</code> function adds the following fields to its
<a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a> argument:
</p><div class="informaltable"><table border="1"><colgroup><col /><col /><col /></colgroup><thead><tr><th>Field</th><th>Type code</th><th>Description</th></tr></thead><tbody><tr><td><code class="varname">_popup</code></td><td><code class="constant">B_MESSAGE_TYPE</code></td><td>Archive of the pop-up menu. Field present only if
this menu was set with
<a class="link" href="BDragger.html#BDragger_SetPopUp"><code class="methodname">SetPopUp()</code></a>.</td></tr><tr><td><code class="varname">_rel</code></td><td><code class="constant">B_INT32_TYPE</code></td><td>Relationship to the target view; one of:
<code class="constant">TARGET_IS_PARENT</code>, <code class="constant">TARGET_IS_CHILD</code>,
or <code class="constant">TARGET_IS_SIBLING</code>.</td></tr></tbody></table></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BControl.html">BControl</a>  Up: <a href="TheInterfaceKit.html">The Interface Kit</a>  Next: <a href="BFont.html">BFont</a> </div><div id="footerB"><div id="footerBL"><a href="BControl.html" title="BControl"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheInterfaceKit.html" title="The Interface Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BFont.html" title="BFont"><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>