<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Signals</title> <link rel="stylesheet" type="text/css" href="style.css"> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="index.html" title="Programming with gtkmm 3"> <link rel="up" href="chapter-draganddrop.html" title="Chapter 18. Drag and Drop"> <link rel="prev" href="sec-dnd-methods.html" title="Methods"> <link rel="next" href="sec-dragcontext.html" title="DragContext"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr><th colspan="3" align="center">Signals</th></tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="sec-dnd-methods.html"><img src="icons/prev.png" alt="Prev"></a> </td> <th width="60%" align="center">Chapter 18. Drag and Drop</th> <td width="20%" align="right"> <a accesskey="n" href="sec-dragcontext.html"><img src="icons/next.png" alt="Next"></a> </td> </tr> </table> <hr> </div> <div class="sect1"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="sec-dnd-signals"></a>Signals</h2></div></div></div> <p> When a drop destination has accepted a dragged item, certain signals will be emitted, depending on what action has been selected. For instance, the user might have held down the <span class="keycap"><strong>Shift</strong></span> key to specify a <code class="literal">move</code> rather than a <code class="literal">copy</code>. Remember that the user can only select the actions which you have specified in your calls to <code class="methodname">drag_dest_set()</code> and <code class="methodname">drag_source_set()</code>. </p> <div class="sect2"> <div class="titlepage"><div><div><h3 class="title"> <a name="sec-dnd-signals-copy"></a>Copy</h3></div></div></div> <p> The source widget will emit these signals, in this order: </p> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"><p><code class="literal">drag_begin</code>: Provides DragContext.</p></li> <li class="listitem"><p><code class="literal">drag_data_get</code>: Provides <code class="literal">info</code> about the dragged data format, and a <code class="literal">Gtk::SelectionData</code> structure, in which you should put the requested data.</p></li> <li class="listitem"><p><code class="literal">drag_end</code>: Provides DragContext.</p></li> </ul></div> <p> </p> <p> The destination widget will emit these signals, in this order: </p> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"><p><code class="literal">drag_motion</code>: Provides DragContext and coordinates. You can call the <code class="methodname">drag_status()</code> method of the DragContext to indicate which action will be accepted.</p></li> <li class="listitem"><p><code class="literal">drag_drop</code>: Provides DragContext and coordinates. You can call <code class="methodname">drag_get_data()</code>, which triggers the <code class="literal">drag_data_get</code> signal in the source widget, and then the <code class="literal">drag_data_received</code> signal in the destination widget.</p></li> <li class="listitem"><p> <code class="literal">drag_data_received</code>: Provides <code class="literal">info</code> about the dragged data format, and a <code class="literal">Gtk::SelectionData</code> structure which contains the dropped data. You should call the <code class="methodname">drag_finish()</code> method of the <code class="literal">DragContext</code> to indicate whether the operation was successful. </p></li> </ul></div> <p> </p> </div> <div class="sect2"> <div class="titlepage"><div><div><h3 class="title"> <a name="dnd-signal-move"></a>Move</h3></div></div></div> <p>During a <code class="literal">move</code>, the source widget will also emit this signal: </p> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><code class="literal">drag_data_delete</code>: Gives the source the opportunity to delete the original data if that's appropriate.</p></li></ul></div> <p> </p> </div> </div> <div class="navfooter"> <hr> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="sec-dnd-methods.html"><img src="icons/prev.png" alt="Prev"></a> </td> <td width="20%" align="center"><a accesskey="u" href="chapter-draganddrop.html"><img src="icons/up.png" alt="Up"></a></td> <td width="40%" align="right"> <a accesskey="n" href="sec-dragcontext.html"><img src="icons/next.png" alt="Next"></a> </td> </tr> <tr> <td width="40%" align="left" valign="top">Methods </td> <td width="20%" align="center"><a accesskey="h" href="index.html"><img src="icons/home.png" alt="Home"></a></td> <td width="40%" align="right" valign="top"> DragContext</td> </tr> </table> </div> </body> </html>