Merged revisions 6293,6296-6306,6308 via svnmerge from
[ardour.git] / libs / gtkmm2 / gtk / src / treedragsource.hg
1 /* $Id: treedragsource.hg,v 1.8 2006/05/10 20:59:28 murrayc Exp $ */
2
3 /* Copyright (C) 1998-2002 The gtkmm Development Team
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the Free
17  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19
20 #include <glibmm/interface.h>
21 #include <gtkmm/treemodel.h>
22 #include <gtkmm/selectiondata.h>
23 _DEFS(gtkmm,gtk)
24 _PINCLUDE(glibmm/private/interface_p.h)
25
26 #ifndef DOXYGEN_SHOULD_SKIP_THIS
27 extern "C"
28 {
29 typedef struct _GtkTreeDragSourceIface GtkTreeDragSourceIface;
30 typedef struct _GtkSelectionData GtkSelectionData;
31 }
32 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
33
34
35 namespace Gtk
36 {
37
38 /**
39  * @ingroup TreeView
40 */
41 class TreeDragSource : public Glib::Interface
42 {
43   _CLASS_INTERFACE(TreeDragSource, GtkTreeDragSource, GTK_TREE_DRAG_SOURCE, GtkTreeDragSourceIface)
44
45 public:
46   _WRAP_METHOD(bool row_draggable(const TreeModel::Path& path) const, gtk_tree_drag_source_row_draggable)
47
48   _WRAP_METHOD(bool drag_data_get(const TreeModel::Path& path, SelectionData& selection_data), gtk_tree_drag_source_drag_data_get)
49                
50   _WRAP_METHOD(bool drag_data_delete(const TreeModel::Path& path), gtk_tree_drag_source_drag_data_delete)
51
52 protected:
53
54 #m4begin
55 dnl// We want to hand-code these C vfunc callbacks,
56   _PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
57     klass->drag_data_get = &drag_data_get_vfunc_callback;
58   _SECTION(SECTION_PH_VFUNCS)
59     static gboolean drag_data_get_vfunc_callback(GtkTreeDragSource* self, GtkTreePath* path, GtkSelectionData* selection_data);
60   _POP()
61 #m4end
62
63   _WRAP_VFUNC(bool row_draggable(const TreeModel::Path& path) const, row_draggable)
64
65   //We hand-code this so that we can use a temporary instance for the SelectionData& output parameter:
66   #ifdef GLIBMM_VFUNCS_ENABLED
67   virtual bool drag_data_get_vfunc(const TreeModel::Path& path, SelectionData& selection_data) const;
68   #endif //GLIBMM_VFUNCS_ENABLED
69    
70   _WRAP_VFUNC(bool drag_data_delete(const TreeModel::Path& path), drag_data_delete)
71 };
72
73 } // namespace Gtk
74