2
/* $Id: treedragsource.ccg,v 1.4 2006/05/11 11:40:24 murrayc Exp $ */
4
/* Copyright 1998-2002 The gtkmm Development Team
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2.1 of the License, or (at your option) any later version.
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the Free
18
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
#include <gtkmm/treepath.h>
22
#include <gtkmm/selectiondata_private.h> //For SelectionData_WithoutOwnership
29
//This vfunc wrapper is manually written, so that we can use a temporary instance for the SelectionData& output parameter:
31
gboolean TreeDragSource_Class::drag_data_get_vfunc_callback(GtkTreeDragSource* self, GtkTreePath* path, GtkSelectionData* selection_data)
33
CppObjectType *const obj = dynamic_cast<CppObjectType*>(
34
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
36
// Non-gtkmmproc-generated custom classes implicitly call the default
37
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
38
// generated classes can use this optimisation, which avoids the unnecessary
39
// parameter conversions if there is no possibility of the virtual function
41
if(obj && obj->is_derived_())
43
try // Trap C++ exceptions which would normally be lost because this is a C callback.
45
// Call the virtual member method, which derived classes might override.
46
SelectionData_WithoutOwnership temp_instance(selection_data);
47
return static_cast<int>(obj->drag_data_get_vfunc(Gtk::TreePath(path, true), temp_instance));
51
Glib::exception_handlers_invoke();
56
BaseClassType *const base = static_cast<BaseClassType*>(
57
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
58
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
61
// Call the original underlying C function:
62
if(base && base->drag_data_get)
63
return (*base->drag_data_get)(self, path, selection_data);
66
typedef gboolean RType;
70
bool Gtk::TreeDragSource::drag_data_get_vfunc(const TreeModel::Path& path, SelectionData& selection_data) const
72
BaseClassType *const base = static_cast<BaseClassType*>(
73
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
74
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
77
if(base && base->drag_data_get)
78
return (*base->drag_data_get)(const_cast<GtkTreeDragSource*>(gobj()),const_cast<GtkTreePath*>((path).gobj()), selection_data.gobj());