1
// Generated by gtkmmproc -- DO NOT MODIFY!
3
#include <gtkmm/treedragsource.h>
4
#include <gtkmm/private/treedragsource_p.h>
9
/* Copyright 1998-2002 The gtkmm Development Team
11
* This library is free software; you can redistribute it and/or
12
* modify it under the terms of the GNU Library General Public
13
* License as published by the Free Software Foundation; either
14
* version 2 of the License, or (at your option) any later version.
16
* This library is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
* Library General Public License for more details.
21
* You should have received a copy of the GNU Library General Public
22
* License along with this library; if not, write to the Free
23
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26
#include <gtkmm/treepath.h>
27
#include <gtkmm/selectiondata_private.h> //For SelectionData_WithoutOwnership
28
#include <gtk/gtktreednd.h>
34
//This vfunc wrapper is manually written, so that we can use a temporary instance for the SelectionData& output parameter:
36
gboolean TreeDragSource_Class::drag_data_get_vfunc_callback(GtkTreeDragSource* self, GtkTreePath* path, GtkSelectionData* selection_data)
38
CppObjectType *const obj = dynamic_cast<CppObjectType*>(
39
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
41
// Non-gtkmmproc-generated custom classes implicitly call the default
42
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
43
// generated classes can use this optimisation, which avoids the unnecessary
44
// parameter conversions if there is no possibility of the virtual function
46
if(obj && obj->is_derived_())
48
try // Trap C++ exceptions which would normally be lost because this is a C callback.
50
// Call the virtual member method, which derived classes might override.
51
SelectionData_WithoutOwnership temp_instance(selection_data);
52
return static_cast<int>(obj->drag_data_get_vfunc(Gtk::TreePath(path, true), temp_instance));
56
Glib::exception_handlers_invoke();
61
BaseClassType *const base = static_cast<BaseClassType*>(
62
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
63
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
66
// Call the original underlying C function:
67
if(base && base->drag_data_get)
68
return (*base->drag_data_get)(self, path, selection_data);
71
typedef gboolean RType;
75
bool Gtk::TreeDragSource::drag_data_get_vfunc(const TreeModel::Path& path, SelectionData& selection_data) const
77
BaseClassType *const base = static_cast<BaseClassType*>(
78
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
79
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
82
if(base && base->drag_data_get)
83
return (*base->drag_data_get)(const_cast<GtkTreeDragSource*>(gobj()),const_cast<GtkTreePath*>((path).gobj()), selection_data.gobj());
94
} // anonymous namespace
100
Glib::RefPtr<Gtk::TreeDragSource> wrap(GtkTreeDragSource* object, bool take_copy)
102
return Glib::RefPtr<Gtk::TreeDragSource>( dynamic_cast<Gtk::TreeDragSource*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
103
//We use dynamic_cast<> in case of multiple inheritance.
113
/* The *_Class implementation: */
115
const Glib::Interface_Class& TreeDragSource_Class::init()
117
if(!gtype_) // create the GType if necessary
119
// Glib::Interface_Class has to know the interface init function
120
// in order to add interfaces to implementing types.
121
class_init_func_ = &TreeDragSource_Class::iface_init_function;
123
// We can not derive from another interface, and it is not necessary anyway.
124
gtype_ = gtk_tree_drag_source_get_type();
130
void TreeDragSource_Class::iface_init_function(void* g_iface, void*)
132
BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
134
//This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
135
//This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
136
g_assert(klass != 0);
138
klass->drag_data_get = &drag_data_get_vfunc_callback;
139
klass->row_draggable = &row_draggable_vfunc_callback;
140
klass->drag_data_delete = &drag_data_delete_vfunc_callback;
143
gboolean TreeDragSource_Class::row_draggable_vfunc_callback(GtkTreeDragSource* self, GtkTreePath* path)
145
CppObjectType *const obj = dynamic_cast<CppObjectType*>(
146
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
148
// Non-gtkmmproc-generated custom classes implicitly call the default
149
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
150
// generated classes can use this optimisation, which avoids the unnecessary
151
// parameter conversions if there is no possibility of the virtual function
153
if(obj && obj->is_derived_())
155
try // Trap C++ exceptions which would normally be lost because this is a C callback.
157
// Call the virtual member method, which derived classes might override.
158
return static_cast<int>(obj->row_draggable_vfunc(Gtk::TreePath(path, true)
163
Glib::exception_handlers_invoke();
168
BaseClassType *const base = static_cast<BaseClassType*>(
169
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
170
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
173
// Call the original underlying C function:
174
if(base && base->row_draggable)
175
return (*base->row_draggable)(self, path);
178
typedef gboolean RType;
182
gboolean TreeDragSource_Class::drag_data_delete_vfunc_callback(GtkTreeDragSource* self, GtkTreePath* path)
184
CppObjectType *const obj = dynamic_cast<CppObjectType*>(
185
Glib::ObjectBase::_get_current_wrapper((GObject*)self));
187
// Non-gtkmmproc-generated custom classes implicitly call the default
188
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
189
// generated classes can use this optimisation, which avoids the unnecessary
190
// parameter conversions if there is no possibility of the virtual function
192
if(obj && obj->is_derived_())
194
try // Trap C++ exceptions which would normally be lost because this is a C callback.
196
// Call the virtual member method, which derived classes might override.
197
return static_cast<int>(obj->drag_data_delete_vfunc(Gtk::TreePath(path, true)
202
Glib::exception_handlers_invoke();
207
BaseClassType *const base = static_cast<BaseClassType*>(
208
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
209
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
212
// Call the original underlying C function:
213
if(base && base->drag_data_delete)
214
return (*base->drag_data_delete)(self, path);
217
typedef gboolean RType;
222
Glib::ObjectBase* TreeDragSource_Class::wrap_new(GObject* object)
224
return new TreeDragSource((GtkTreeDragSource*)(object));
228
/* The implementation: */
230
TreeDragSource::TreeDragSource()
232
Glib::Interface(treedragsource_class_.init())
235
TreeDragSource::TreeDragSource(GtkTreeDragSource* castitem)
237
Glib::Interface((GObject*)(castitem))
240
TreeDragSource::~TreeDragSource()
244
void TreeDragSource::add_interface(GType gtype_implementer)
246
treedragsource_class_.init().add_interface(gtype_implementer);
249
TreeDragSource::CppClassType TreeDragSource::treedragsource_class_; // initialize static member
251
GType TreeDragSource::get_type()
253
return treedragsource_class_.init().get_type();
256
GType TreeDragSource::get_base_type()
258
return gtk_tree_drag_source_get_type();
262
bool TreeDragSource::row_draggable(const TreeModel::Path& path) const
264
return gtk_tree_drag_source_row_draggable(const_cast<GtkTreeDragSource*>(gobj()), const_cast<GtkTreePath*>((path).gobj()));
267
bool TreeDragSource::drag_data_get(const TreeModel::Path& path, SelectionData& selection_data)
269
return gtk_tree_drag_source_drag_data_get(gobj(), const_cast<GtkTreePath*>((path).gobj()), (selection_data).gobj());
272
bool TreeDragSource::drag_data_delete(const TreeModel::Path& path)
274
return gtk_tree_drag_source_drag_data_delete(gobj(), const_cast<GtkTreePath*>((path).gobj()));
278
bool Gtk::TreeDragSource::row_draggable_vfunc(const TreeModel::Path& path) const
280
BaseClassType *const base = static_cast<BaseClassType*>(
281
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
282
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
285
if(base && base->row_draggable)
286
return (*base->row_draggable)(const_cast<GtkTreeDragSource*>(gobj()),const_cast<GtkTreePath*>((path).gobj()));
292
bool Gtk::TreeDragSource::drag_data_delete_vfunc(const TreeModel::Path& path)
294
BaseClassType *const base = static_cast<BaseClassType*>(
295
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
296
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
299
if(base && base->drag_data_delete)
300
return (*base->drag_data_delete)(gobj(),const_cast<GtkTreePath*>((path).gobj()));