<?xml version='1.0' encoding='utf-8' /> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html><head> <title>GtkAda: Gtk.Tree_Dnd</title> <link rel='stylesheet' href='gtkada_rm.css' type='text/css'> <script src='gtkada_rm.js' type='text/javascript'></script> </head><body> <div id='objectName'> <span><a href='index.html'><img src='home.png' alt='Toc' title='Table of Contents'/></a> <a href='gallery.html'><img src='gallery.png' alt='Gallery' title='Widgets gallery'/></a> <a href='entities.html'><img src='entities.png' alt='Index' title='Global Index'/></a> <a href='tree.html'><img src='tree.png' alt='Tree' title='Widgets Inheritance Tree'/></a> </span> Gtk.Tree_Dnd </div> <!-- objectName --> <div id='leftSide'> <div id='interfaces'> <h2>Implemented by</h2> <ul> <li><a href='gtk-list_store.html'>Gtk_List_Store_Record</a></li> <li><a href='gtk-tree_model_filter.html'>Gtk_Tree_Model_Filter_Record</a></li> <li><a href='gtk-tree_model_sort.html'>Gtk_Tree_Model_Sort_Record</a></li> <li><a href='gtk-tree_store.html'>Gtk_Tree_Store_Record</a></li> </ul> </div> <!-- interfaces --> <div id='navigation'> <h2>Navigation</h2> <ul> <li><a href='#Description' onclick='return switchPage("page1")'>Description</a></li> <li><a href='#Types' onclick='return switchPage("page1")'>Types</a></li> <li><a href='#Subprograms' onclick='return switchPage("page1")'>Subprograms</a> <ul> <li><a href='#Subprograms__General' onclick='return switchPage("page1")'>General</a></li> </ul> </li> </ul> </div> <!-- navigation --> </div> <!-- leftSide --> <div id='documentation'> <ul id='notebook'> <li id='tab_page1' class='current'><a href='' onclick='return !switchPage("page1")'>Entities</a></li> </ul> <!-- notebook --> <div id='notebook_page1' class='notebookPage'> <a name='Description'></a> <div class='description'> <h2>Description</h2> GTK+ supports Drag-and-Drop in tree views with a high-level and a low-level API. <p> The low-level API consists of the GTK+ DND API, augmented by some treeview utility functions: <a href='gtk-tree_view.html#Set_Drag_Dest_Row_76_'>Gtk.Tree_View.Set_Drag_Dest_Row</a>, <a href='gtk-tree_view.html#Get_Drag_Dest_Row_77_'>Gtk.Tree_View.Get_Drag_Dest_Row</a>, <a href='gtk-tree_view.html#Get_Dest_Row_At_Pos_75_'>Gtk.Tree_View.Get_Dest_Row_At_Pos</a>, <a href='gtk-tree_view.html#Create_Row_Drag_Icon_74_'>Gtk.Tree_View.Create_Row_Drag_Icon</a>, <a href='gtk-tree_dnd.html#Set_Row_Drag_Data_9_'>Set_Row_Drag_Data</a> and <a href='gtk-tree_dnd.html#Get_Row_Drag_Data_8_'>Get_Row_Drag_Data</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> 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 href='gtk-tree_dnd.html'>Gtk_Tree_Drag_Source</a> and Gtk_Tree_Drag_Dest interfaces. </div> <!-- description --> <a name='Types'></a> <div id='types'> <h2>Types</h2> <ul> <li><a name='Gtk_Tree_Drag_Source_'></a> <div class='profile'><b>type</b> Gtk_Tree_Drag_Source <b>is</b> <b>new</b> <a href='glib-types.html'>Glib.Types.GType_Interface</a>;</div> <div class='comment'></div></li> </ul> </div> <!-- types --> <a name='Subprograms'> </a> <a name='Subprograms__General'> </a> <div id='subprograms'> <h2>Subprograms</h2> <ul> <li><a name='Drag_Dest_Get_Type_1_'></a> <div class='profile'><b>function</b> <span class='name'>Drag_Dest_Get_Type</span> <b>return</b> GType;</div> <a name='Drag_Source_Get_Type_2_'></a> <div class='profile'><b>function</b> <span class='name'>Drag_Source_Get_Type</span> <b>return</b> GType;</div> <div class='comment'>Return the low-level types associated with the interfaces </div></li> <li><a name='Drag_Dest_Drag_Data_Received_3_'></a> <div class='profile'><b>function</b> <span class='name'>Drag_Dest_Drag_Data_Received</span> (Drag_Dest : Gtk_Tree_Drag_Dest; Dest : <a href='gtk-tree_model.html'>Gtk.Tree_Model.Gtk_Tree_Path</a>; Selection_Data : <a href='gtk-selection.html'>Gtk.Selection.Selection_Data</a>) <b>return</b> Boolean;</div> <div class='comment'>Asks the <tt>Drag_Dest</tt> to insert a row before the path <tt>Dest</tt>, deriving the contents of the row from <tt>Selection_Data</tt>. If <tt>Dest</tt> is outside the tree so that inserting before it is impossible, False will be returned. Also, False may be returned if the new row is not created for some model-specific reason. Should robustly handle a <tt>Dest</tt> no longer found in the model! </div></li> <li><a name='Drag_Dest_Row_Drop_Possible_4_'></a> <div class='profile'><b>function</b> <span class='name'>Drag_Dest_Row_Drop_Possible</span> (Drag_Dest : Gtk_Tree_Drag_Dest; Dest_Path : <a href='gtk-tree_model.html'>Gtk.Tree_Model.Gtk_Tree_Path</a>; Selection_Data : <a href='gtk-selection.html'>Gtk.Selection.Selection_Data</a>) <b>return</b> Boolean;</div> <div class='comment'>Determines whether a drop is possible before the given <tt>Dest_Path</tt>, at the same depth as <tt>Dest_Path</tt>. i.e., can we drop the data in <tt>Selection_Data</tt> at that location. <tt>Dest_Path</tt> does not have to exist; the return value will almost certainly be False if the parent of <tt>Dest_Path</tt> doesn't exist, though. </div></li> <li><a name='Drag_Source_Drag_Data_Delete_5_'></a> <div class='profile'><b>function</b> <span class='name'>Drag_Source_Drag_Data_Delete</span> (Drag_Source : Gtk_Tree_Drag_Source; Path : <a href='gtk-tree_model.html'>Gtk.Tree_Model.Gtk_Tree_Path</a>) <b>return</b> Boolean;</div> <div class='comment'>Asks the <tt>Drag_Source</tt> to delete the row at <tt>Path</tt>, because it was moved somewhere else via drag-and-drop. Returns False if the deletion fails because <tt>Path</tt> no longer exists, or for some model-specific reason. Should robustly handle a <tt>Path</tt> no longer found in the model! </div></li> <li><a name='Drag_Source_Drag_Data_Get_6_'></a> <div class='profile'><b>function</b> <span class='name'>Drag_Source_Drag_Data_Get</span> (Drag_Source : Gtk_Tree_Drag_Source; Path : <a href='gtk-tree_model.html'>Gtk.Tree_Model.Gtk_Tree_Path</a>; Selection_Data : <a href='gtk-selection.html'>Gtk.Selection.Selection_Data</a>) <b>return</b> Boolean;</div> <div class='comment'>Asks the <tt>Drag_Source</tt> to fill in <tt>Selection_Data</tt> with a representation of the row at <tt>Path</tt>. Get_Target (<tt>Selection_Data</tt>) gives the required type of the data. Should robustly handle a <tt>Path</tt> no longer found in the model! </div></li> <li><a name='Drag_Source_Row_Draggable_7_'></a> <div class='profile'><b>function</b> <span class='name'>Drag_Source_Row_Draggable</span> (Drag_Source : Gtk_Tree_Drag_Source; Path : <a href='gtk-tree_model.html'>Gtk.Tree_Model.Gtk_Tree_Path</a>) <b>return</b> Boolean;</div> <div class='comment'>Asks the <tt>Drag_Source</tt> whether a particular row can be used as the source of a DND operation. If the source doesn't implement this interface, the row is assumed draggable. </div></li> <li><a name='Get_Row_Drag_Data_8_'></a> <div class='profile'><b>procedure</b> <span class='name'>Get_Row_Drag_Data</span> (Selection_Data : <a href='gtk-selection.html'>Gtk.Selection.Selection_Data</a>; Tree_Model : <b>out</b> <a href='gtk-tree_model.html'>Gtk.Tree_Model.Gtk_Tree_Model</a>; Path : <b>out</b> <a href='gtk-tree_model.html'>Gtk.Tree_Model.Gtk_Tree_Path</a>; Success : <b>out</b> Boolean);</div> <div class='comment'>Obtains a <tt>Tree_Model</tt> and <tt>Path</tt> from selection data of target type GTK_TREE_MODEL_ROW. Normally called from a drag_data_received handler. <p> This function can only be used if <tt>Selection_Data</tt> originates from the same process that's calling this function, because a pointer to the tree model is being passed around. If you aren't in the same process, then you'll get memory corruption. In the Gtk_Tree_Drag_Dest drag_data_received handler, you can assume that selection data of type GTK_TREE_MODEL_ROW is in from the current process. <p> The returned path must be freed with </div></li> <li><a name='Set_Row_Drag_Data_9_'></a> <div class='profile'><b>function</b> <span class='name'>Set_Row_Drag_Data</span> (Selection_Data : <a href='gtk-selection.html'>Gtk.Selection.Selection_Data</a>; Tree_Model : <b>access</b> <a href='gtk-tree_model.html'>Gtk.Tree_Model.Gtk_Tree_Model_Record</a>'Class; Path : <a href='gtk-tree_model.html'>Gtk.Tree_Model.Gtk_Tree_Path</a>) <b>return</b> Boolean;</div> <div class='comment'>Sets selection data of target type GTK_TREE_MODEL_ROW. Normally used in a drag_data_get handler. </div></li> </ul> </div> <!-- subprograms --> </div> <!-- notebook_page1 --> <div id='notebook_page3' class='notebookPage'> </div> <!-- notebook_page3 --> </div> <!-- documentation --> <div id='rightSide'> <div id='Index'> <h2>Alphabetical Index</h2> <ul> <li><a href='#Drag_Dest_Drag_Data_Received_3_' onclick='return switchPage("page1")'>Drag_Dest_Drag_Data_Received</a></li> <li><a href='#Drag_Dest_Get_Type_1_' onclick='return switchPage("page1")'>Drag_Dest_Get_Type</a></li> <li><a href='#Drag_Dest_Row_Drop_Possible_4_' onclick='return switchPage("page1")'>Drag_Dest_Row_Drop_Possible</a></li> <li><a href='#Drag_Source_Drag_Data_Delete_5_' onclick='return switchPage("page1")'>Drag_Source_Drag_Data_Delete</a></li> <li><a href='#Drag_Source_Drag_Data_Get_6_' onclick='return switchPage("page1")'>Drag_Source_Drag_Data_Get</a></li> <li><a href='#Drag_Source_Get_Type_2_' onclick='return switchPage("page1")'>Drag_Source_Get_Type</a></li> <li><a href='#Drag_Source_Row_Draggable_7_' onclick='return switchPage("page1")'>Drag_Source_Row_Draggable</a></li> <li><a href='#Get_Row_Drag_Data_8_' onclick='return switchPage("page1")'>Get_Row_Drag_Data</a></li> <li><a href='#Set_Row_Drag_Data_9_' onclick='return switchPage("page1")'>Set_Row_Drag_Data</a></li> </ul> </div> <!-- Index --> </div> <!-- rightSide --> <script language='javascript'>switchPage('page1'); adjust_height()</script> </body> </html>