gtk3/docs/reference/gtk/html/gtk3-GtkTreeView-drag-and-drop.html
2021-04-15 09:52:10 +01:00

595 lines
32 KiB
HTML
Raw 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.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GtkTreeView drag-and-drop: GTK+ 3 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GTK+ 3 Reference Manual">
<link rel="up" href="TreeWidgetObjects.html" title="Tree, List and Icon Grid Widgets">
<link rel="prev" href="GtkTreeView.html" title="GtkTreeView">
<link rel="next" href="GtkCellView.html" title="GtkCellView">
<meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
<a href="#gtk3-GtkTreeView-drag-and-drop.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
<a href="#gtk3-GtkTreeView-drag-and-drop.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_implementations">  <span class="dim">|</span> 
<a href="#gtk3-GtkTreeView-drag-and-drop.implementations" class="shortcut">Known Implementations</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="TreeWidgetObjects.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="GtkTreeView.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="GtkCellView.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="gtk3-GtkTreeView-drag-and-drop"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gtk3-GtkTreeView-drag-and-drop.top_of_page"></a>GtkTreeView drag-and-drop</span></h2>
<p>GtkTreeView drag-and-drop — Interfaces for drag-and-drop support in GtkTreeView</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="gtk3-GtkTreeView-drag-and-drop.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_proto_type">
<col class="functions_proto_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#gtk-tree-drag-source-drag-data-delete" title="gtk_tree_drag_source_drag_data_delete ()">gtk_tree_drag_source_drag_data_delete</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#gtk-tree-drag-source-drag-data-get" title="gtk_tree_drag_source_drag_data_get ()">gtk_tree_drag_source_drag_data_get</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#gtk-tree-drag-source-row-draggable" title="gtk_tree_drag_source_row_draggable ()">gtk_tree_drag_source_row_draggable</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#gtk-tree-drag-dest-drag-data-received" title="gtk_tree_drag_dest_drag_data_received ()">gtk_tree_drag_dest_drag_data_received</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#gtk-tree-drag-dest-row-drop-possible" title="gtk_tree_drag_dest_row_drop_possible ()">gtk_tree_drag_dest_row_drop_possible</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#gtk-tree-set-row-drag-data" title="gtk_tree_set_row_drag_data ()">gtk_tree_set_row_drag_data</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#gtk-tree-get-row-drag-data" title="gtk_tree_get_row_drag_data ()">gtk_tree_get_row_drag_data</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<a name="GtkTreeDragSource"></a><a name="GtkTreeDragDest"></a><div class="refsect1">
<a name="gtk3-GtkTreeView-drag-and-drop.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="other_proto_type">
<col class="other_proto_name">
</colgroup>
<tbody>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragSource-struct" title="GtkTreeDragSource">GtkTreeDragSource</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragSourceIface" title="struct GtkTreeDragSourceIface">GtkTreeDragSourceIface</a></td>
</tr>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragDest-struct" title="GtkTreeDragDest">GtkTreeDragDest</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragDestIface" title="struct GtkTreeDragDestIface">GtkTreeDragDestIface</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="gtk3-GtkTreeView-drag-and-drop.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen"> <a href="/usr/share/gtk-doc/html/gobject/GTypeModule.html">GInterface</a>
<span class="lineart">├──</span> GtkTreeDragDest
<span class="lineart">╰──</span> GtkTreeDragSource
</pre>
</div>
<div class="refsect1">
<a name="gtk3-GtkTreeView-drag-and-drop.implementations"></a><h2>Known Implementations</h2>
<p>
GtkTreeDragSource is implemented by
<a class="link" href="GtkListStore.html" title="GtkListStore">GtkListStore</a>, <a class="link" href="GtkTreeModelFilter.html" title="GtkTreeModelFilter">GtkTreeModelFilter</a>, <a class="link" href="GtkTreeModelSort.html" title="GtkTreeModelSort">GtkTreeModelSort</a> and <a class="link" href="GtkTreeStore.html" title="GtkTreeStore">GtkTreeStore</a>.</p>
<p>
GtkTreeDragDest is implemented by
<a class="link" href="GtkListStore.html" title="GtkListStore">GtkListStore</a> and <a class="link" href="GtkTreeStore.html" title="GtkTreeStore">GtkTreeStore</a>.</p>
</div>
<div class="refsect1">
<a name="gtk3-GtkTreeView-drag-and-drop.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gtk/gtk.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="gtk3-GtkTreeView-drag-and-drop.description"></a><h2>Description</h2>
<p>GTK+ supports Drag-and-Drop in tree views with a high-level and a low-level
API.</p>
<p>The low-level API consists of the GTK+ DND API, augmented by some treeview
utility functions: <a class="link" href="GtkTreeView.html#gtk-tree-view-set-drag-dest-row" title="gtk_tree_view_set_drag_dest_row ()"><code class="function">gtk_tree_view_set_drag_dest_row()</code></a>,
<a class="link" href="GtkTreeView.html#gtk-tree-view-get-drag-dest-row" title="gtk_tree_view_get_drag_dest_row ()"><code class="function">gtk_tree_view_get_drag_dest_row()</code></a>, <a class="link" href="GtkTreeView.html#gtk-tree-view-get-dest-row-at-pos" title="gtk_tree_view_get_dest_row_at_pos ()"><code class="function">gtk_tree_view_get_dest_row_at_pos()</code></a>,
<a class="link" href="GtkTreeView.html#gtk-tree-view-create-row-drag-icon" title="gtk_tree_view_create_row_drag_icon ()"><code class="function">gtk_tree_view_create_row_drag_icon()</code></a>, <a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#gtk-tree-set-row-drag-data" title="gtk_tree_set_row_drag_data ()"><code class="function">gtk_tree_set_row_drag_data()</code></a> and
<a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#gtk-tree-get-row-drag-data" title="gtk_tree_get_row_drag_data ()"><code class="function">gtk_tree_get_row_drag_data()</code></a>. This API leaves a lot of flexibility, but
nothing is done automatically, and implementing advanced features like
hover-to-open-rows or autoscrolling on top of this API is a lot of work.</p>
<p>On the other hand, if you write to the high-level API, then all the
bookkeeping of rows is done for you, as well as things like hover-to-open
and auto-scroll, but your models have to implement the
<a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragSource"><span class="type">GtkTreeDragSource</span></a> and <a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragDest"><span class="type">GtkTreeDragDest</span></a> interfaces.</p>
</div>
<div class="refsect1">
<a name="gtk3-GtkTreeView-drag-and-drop.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="gtk-tree-drag-source-drag-data-delete"></a><h3>gtk_tree_drag_source_drag_data_delete ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
gtk_tree_drag_source_drag_data_delete (<em class="parameter"><code><a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragSource"><span class="type">GtkTreeDragSource</span></a> *drag_source</code></em>,
<em class="parameter"><code><a class="link" href="GtkTreeModel.html#GtkTreePath"><span class="type">GtkTreePath</span></a> *path</code></em>);</pre>
<p>Asks the <a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragSource"><span class="type">GtkTreeDragSource</span></a> to delete the row at <em class="parameter"><code>path</code></em>
, because
it was moved somewhere else via drag-and-drop. Returns <code class="literal">FALSE</code>
if the deletion fails because <em class="parameter"><code>path</code></em>
no longer exists, or for
some model-specific reason. Should robustly handle a <em class="parameter"><code>path</code></em>
no
longer found in the model!</p>
<div class="refsect3">
<a name="gtk-tree-drag-source-drag-data-delete.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>drag_source</p></td>
<td class="parameter_description"><p>a <a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragSource"><span class="type">GtkTreeDragSource</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description"><p>row that was being dragged</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-tree-drag-source-drag-data-delete.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if the row was successfully deleted</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-tree-drag-source-drag-data-get"></a><h3>gtk_tree_drag_source_drag_data_get ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
gtk_tree_drag_source_drag_data_get (<em class="parameter"><code><a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragSource"><span class="type">GtkTreeDragSource</span></a> *drag_source</code></em>,
<em class="parameter"><code><a class="link" href="GtkTreeModel.html#GtkTreePath"><span class="type">GtkTreePath</span></a> *path</code></em>,
<em class="parameter"><code><a class="link" href="gtk3-Selections.html#GtkSelectionData"><span class="type">GtkSelectionData</span></a> *selection_data</code></em>);</pre>
<p>Asks the <a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragSource"><span class="type">GtkTreeDragSource</span></a> to fill in <em class="parameter"><code>selection_data</code></em>
with a
representation of the row at <em class="parameter"><code>path</code></em>
. <em class="parameter"><code>selection_data-&gt;target</code></em>
gives
the required type of the data. Should robustly handle a <em class="parameter"><code>path</code></em>
no
longer found in the model!</p>
<div class="refsect3">
<a name="gtk-tree-drag-source-drag-data-get.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>drag_source</p></td>
<td class="parameter_description"><p>a <a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragSource"><span class="type">GtkTreeDragSource</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description"><p>row that was dragged</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>selection_data</p></td>
<td class="parameter_description"><p>a <a class="link" href="gtk3-Selections.html#GtkSelectionData"><span class="type">GtkSelectionData</span></a> to fill with data
from the dragged row</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-tree-drag-source-drag-data-get.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if data of the required type was provided </p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-tree-drag-source-row-draggable"></a><h3>gtk_tree_drag_source_row_draggable ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
gtk_tree_drag_source_row_draggable (<em class="parameter"><code><a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragSource"><span class="type">GtkTreeDragSource</span></a> *drag_source</code></em>,
<em class="parameter"><code><a class="link" href="GtkTreeModel.html#GtkTreePath"><span class="type">GtkTreePath</span></a> *path</code></em>);</pre>
<p>Asks the <a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragSource"><span class="type">GtkTreeDragSource</span></a> whether a particular row can be used as
the source of a DND operation. If the source doesnt implement
this interface, the row is assumed draggable.</p>
<div class="refsect3">
<a name="gtk-tree-drag-source-row-draggable.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>drag_source</p></td>
<td class="parameter_description"><p>a <a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragSource"><span class="type">GtkTreeDragSource</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description"><p>row on which user is initiating a drag</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-tree-drag-source-row-draggable.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if the row can be dragged</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-tree-drag-dest-drag-data-received"></a><h3>gtk_tree_drag_dest_drag_data_received ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
gtk_tree_drag_dest_drag_data_received (<em class="parameter"><code><a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragDest"><span class="type">GtkTreeDragDest</span></a> *drag_dest</code></em>,
<em class="parameter"><code><a class="link" href="GtkTreeModel.html#GtkTreePath"><span class="type">GtkTreePath</span></a> *dest</code></em>,
<em class="parameter"><code><a class="link" href="gtk3-Selections.html#GtkSelectionData"><span class="type">GtkSelectionData</span></a> *selection_data</code></em>);</pre>
<p>Asks the <a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragDest"><span class="type">GtkTreeDragDest</span></a> to insert a row before the path <em class="parameter"><code>dest</code></em>
,
deriving the contents of the row from <em class="parameter"><code>selection_data</code></em>
. If <em class="parameter"><code>dest</code></em>
is
outside the tree so that inserting before it is impossible, <code class="literal">FALSE</code>
will be returned. Also, <code class="literal">FALSE</code> may be returned if the new row is
not created for some model-specific reason. Should robustly handle
a <em class="parameter"><code>dest</code></em>
no longer found in the model!</p>
<div class="refsect3">
<a name="gtk-tree-drag-dest-drag-data-received.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>drag_dest</p></td>
<td class="parameter_description"><p>a <a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragDest"><span class="type">GtkTreeDragDest</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>dest</p></td>
<td class="parameter_description"><p>row to drop in front of</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>selection_data</p></td>
<td class="parameter_description"><p>data to drop</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-tree-drag-dest-drag-data-received.returns"></a><h4>Returns</h4>
<p> whether a new row was created before position <em class="parameter"><code>dest</code></em>
</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-tree-drag-dest-row-drop-possible"></a><h3>gtk_tree_drag_dest_row_drop_possible ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
gtk_tree_drag_dest_row_drop_possible (<em class="parameter"><code><a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragDest"><span class="type">GtkTreeDragDest</span></a> *drag_dest</code></em>,
<em class="parameter"><code><a class="link" href="GtkTreeModel.html#GtkTreePath"><span class="type">GtkTreePath</span></a> *dest_path</code></em>,
<em class="parameter"><code><a class="link" href="gtk3-Selections.html#GtkSelectionData"><span class="type">GtkSelectionData</span></a> *selection_data</code></em>);</pre>
<p>Determines whether a drop is possible before the given <em class="parameter"><code>dest_path</code></em>
,
at the same depth as <em class="parameter"><code>dest_path</code></em>
. i.e., can we drop the data in
<em class="parameter"><code>selection_data</code></em>
at that location. <em class="parameter"><code>dest_path</code></em>
does not have to
exist; the return value will almost certainly be <code class="literal">FALSE</code> if the
parent of <em class="parameter"><code>dest_path</code></em>
doesnt exist, though.</p>
<div class="refsect3">
<a name="gtk-tree-drag-dest-row-drop-possible.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>drag_dest</p></td>
<td class="parameter_description"><p>a <a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragDest"><span class="type">GtkTreeDragDest</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>dest_path</p></td>
<td class="parameter_description"><p>destination row</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>selection_data</p></td>
<td class="parameter_description"><p>the data being dragged</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-tree-drag-dest-row-drop-possible.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if a drop is possible before <em class="parameter"><code>dest_path</code></em>
</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-tree-set-row-drag-data"></a><h3>gtk_tree_set_row_drag_data ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
gtk_tree_set_row_drag_data (<em class="parameter"><code><a class="link" href="gtk3-Selections.html#GtkSelectionData"><span class="type">GtkSelectionData</span></a> *selection_data</code></em>,
<em class="parameter"><code><a class="link" href="GtkTreeModel.html" title="GtkTreeModel"><span class="type">GtkTreeModel</span></a> *tree_model</code></em>,
<em class="parameter"><code><a class="link" href="GtkTreeModel.html#GtkTreePath"><span class="type">GtkTreePath</span></a> *path</code></em>);</pre>
<p>Sets selection data of target type <code class="literal">GTK_TREE_MODEL_ROW</code>. Normally used
in a drag_data_get handler.</p>
<div class="refsect3">
<a name="gtk-tree-set-row-drag-data.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>selection_data</p></td>
<td class="parameter_description"><p>some <a class="link" href="gtk3-Selections.html#GtkSelectionData"><span class="type">GtkSelectionData</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>tree_model</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkTreeModel.html" title="GtkTreeModel"><span class="type">GtkTreeModel</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description"><p>a row in <em class="parameter"><code>tree_model</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-tree-set-row-drag-data.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if the <a class="link" href="gtk3-Selections.html#GtkSelectionData"><span class="type">GtkSelectionData</span></a> had the proper target type to allow us to set a tree row</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gtk-tree-get-row-drag-data"></a><h3>gtk_tree_get_row_drag_data ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
gtk_tree_get_row_drag_data (<em class="parameter"><code><a class="link" href="gtk3-Selections.html#GtkSelectionData"><span class="type">GtkSelectionData</span></a> *selection_data</code></em>,
<em class="parameter"><code><a class="link" href="GtkTreeModel.html" title="GtkTreeModel"><span class="type">GtkTreeModel</span></a> **tree_model</code></em>,
<em class="parameter"><code><a class="link" href="GtkTreeModel.html#GtkTreePath"><span class="type">GtkTreePath</span></a> **path</code></em>);</pre>
<p>Obtains a <em class="parameter"><code>tree_model</code></em>
and <em class="parameter"><code>path</code></em>
from selection data of target type
<code class="literal">GTK_TREE_MODEL_ROW</code>. Normally called from a drag_data_received handler.
This function can only be used if <em class="parameter"><code>selection_data</code></em>
originates from the same
process thats calling this function, because a pointer to the tree model
is being passed around. If you arent in the same process, then you'll
get memory corruption. In the <a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragDest"><span class="type">GtkTreeDragDest</span></a> drag_data_received handler,
you can assume that selection data of type <code class="literal">GTK_TREE_MODEL_ROW</code> is
in from the current process. The returned path must be freed with
<a class="link" href="GtkTreeModel.html#gtk-tree-path-free" title="gtk_tree_path_free ()"><code class="function">gtk_tree_path_free()</code></a>.</p>
<div class="refsect3">
<a name="gtk-tree-get-row-drag-data.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>selection_data</p></td>
<td class="parameter_description"><p>a <a class="link" href="gtk3-Selections.html#GtkSelectionData"><span class="type">GtkSelectionData</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>tree_model</p></td>
<td class="parameter_description"><p>a <a class="link" href="GtkTreeModel.html" title="GtkTreeModel"><span class="type">GtkTreeModel</span></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>][<acronym title="The data is owned by the callee, which is responsible of freeing it."><span class="acronym">transfer none</span></acronym>][<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description"><p>row in <em class="parameter"><code>tree_model</code></em>
. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL may be passed as the value in, out, in-out; or as a return value."><span class="acronym">nullable</span></acronym>][<acronym title="NULL may be passed instead of a pointer to a location."><span class="acronym">optional</span></acronym>][<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gtk-tree-get-row-drag-data.returns"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if <em class="parameter"><code>selection_data</code></em>
had target type <code class="literal">GTK_TREE_MODEL_ROW</code> and
is otherwise valid</p>
</div>
</div>
</div>
<div class="refsect1">
<a name="gtk3-GtkTreeView-drag-and-drop.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GtkTreeDragSource-struct"></a><h3>GtkTreeDragSource</h3>
<pre class="programlisting">typedef struct _GtkTreeDragSource GtkTreeDragSource;</pre>
</div>
<hr>
<div class="refsect2">
<a name="GtkTreeDragSourceIface"></a><h3>struct GtkTreeDragSourceIface</h3>
<pre class="programlisting">struct GtkTreeDragSourceIface {
/* VTable - not signals */
gboolean (* row_draggable) (GtkTreeDragSource *drag_source,
GtkTreePath *path);
gboolean (* drag_data_get) (GtkTreeDragSource *drag_source,
GtkTreePath *path,
GtkSelectionData *selection_data);
gboolean (* drag_data_delete) (GtkTreeDragSource *drag_source,
GtkTreePath *path);
};
</pre>
<div class="refsect3">
<a name="GtkTreeDragSourceIface.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="GtkTreeDragSourceIface.row-draggable"></a>row_draggable</code></em> ()</p></td>
<td class="struct_member_description"><p>Asks the <a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragSource"><span class="type">GtkTreeDragSource</span></a> whether a particular
row can be used as the source of a DND operation.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="GtkTreeDragSourceIface.drag-data-get"></a>drag_data_get</code></em> ()</p></td>
<td class="struct_member_description"><p>Asks the <a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragSource"><span class="type">GtkTreeDragSource</span></a> to fill in
selection_data with a representation of the row at path.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="GtkTreeDragSourceIface.drag-data-delete"></a>drag_data_delete</code></em> ()</p></td>
<td class="struct_member_description"><p>Asks the <a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragSource"><span class="type">GtkTreeDragSource</span></a> to delete the row at
path, because it was moved somewhere else via drag-and-drop.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="GtkTreeDragDest-struct"></a><h3>GtkTreeDragDest</h3>
<pre class="programlisting">typedef struct _GtkTreeDragDest GtkTreeDragDest;</pre>
</div>
<hr>
<div class="refsect2">
<a name="GtkTreeDragDestIface"></a><h3>struct GtkTreeDragDestIface</h3>
<pre class="programlisting">struct GtkTreeDragDestIface {
/* VTable - not signals */
gboolean (* drag_data_received) (GtkTreeDragDest *drag_dest,
GtkTreePath *dest,
GtkSelectionData *selection_data);
gboolean (* row_drop_possible) (GtkTreeDragDest *drag_dest,
GtkTreePath *dest_path,
GtkSelectionData *selection_data);
};
</pre>
<div class="refsect3">
<a name="GtkTreeDragDestIface.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="GtkTreeDragDestIface.drag-data-received"></a>drag_data_received</code></em> ()</p></td>
<td class="struct_member_description"><p>Asks the <a class="link" href="gtk3-GtkTreeView-drag-and-drop.html#GtkTreeDragDest"><span class="type">GtkTreeDragDest</span></a> to insert a row
before the path dest, deriving the contents of the row from
selection_data.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="GtkTreeDragDestIface.row-drop-possible"></a>row_drop_possible</code></em> ()</p></td>
<td class="struct_member_description"><p>Determines whether a drop is possible before
the given dest_path, at the same depth as dest_path.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>