<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Methods</title> <link rel="stylesheet" href="style.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.75.1"> <link rel="home" href="index.html" title="Programming with gtkmm"> <link rel="up" href="chapter-draganddrop.html" title="Chapter 16. Drag and Drop"> <link rel="prev" href="chapter-draganddrop.html" title="Chapter 16. Drag and Drop"> <link rel="next" href="sec-dnd-signals.html" title="Signals"> </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">Methods</th></tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="chapter-draganddrop.html"><img src="icons/prev.png" alt="Prev"></a> </td> <th width="60%" align="center">Chapter 16. Drag and Drop</th> <td width="20%" align="right"> <a accesskey="n" href="sec-dnd-signals.html"><img src="icons/next.png" alt="Next"></a> </td> </tr> </table> <hr> </div> <div class="sect1" title="Methods"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="sec-dnd-methods"></a>Methods</h2></div></div></div> <p> <code class="classname">Widgets</code> can be identified as sources or destinations using these <code class="classname">Gtk::Widget</code> methods: </p> <pre class="programlisting">void drag_source_set(const ArrayHandle_TargetEntry& targets, GdkModifierType start_button_mask, GdkDragAction actions);</pre> <div class="itemizedlist"><ul class="itemizedlist" type="disc"> <li class="listitem"><p> <code class="literal">targets</code> is a container of <code class="classname">Gtk::TargetEntry</code> (<code class="classname">std::list<Gtk::TargetEntry></code> or <code class="classname">std::vector<Gtk::TargetEntry></code>, for instance) elements. </p></li> <li class="listitem"><p> <code class="literal">start_button_mask</code> is an ORed combination of values, which specify which modifier key or mouse button must be pressed to start the drag. </p></li> <li class="listitem"><p> <code class="literal">actions</code> is an ORed combination of values, which specified which Drag and Drop operations will be possible from this source - for instance, copy, move, or link. The user can choose between the actions by using modifier keys, such as <span class="keycap"><strong>Shift</strong></span> to change from <code class="literal">copy</code> to <code class="literal">move</code>, and this will be shown by a different cursor. </p></li> </ul></div> <pre class="programlisting">void drag_dest_set(const ArrayHandle_TargetEntry& targets, GtkDestDefaults flags, GdkDragAction actions);</pre> <div class="itemizedlist"><ul class="itemizedlist" type="disc"> <li class="listitem"><p> <code class="literal">flags</code> is an ORed combination of values which indicates how the widget will respond visually to Drag and Drop items. </p></li> <li class="listitem"><p> <code class="literal">actions</code> indicates the Drag and Drop actions which this destination can receive - see the description above. </p></li> </ul></div> </div> <div class="navfooter"> <hr> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="chapter-draganddrop.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-dnd-signals.html"><img src="icons/next.png" alt="Next"></a> </td> </tr> <tr> <td width="40%" align="left" valign="top">Chapter 16. Drag and Drop </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"> Signals</td> </tr> </table> </div> </body> </html>