~ubuntu-branches/ubuntu/vivid/ardour/vivid-proposed

« back to all changes in this revision

Viewing changes to libs/gtkmm2/gtk/gtkmm/treedragsource.cc

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler, Jaromír Mikeš, Felipe Sateler
  • Date: 2014-05-22 14:39:25 UTC
  • mfrom: (29 sid)
  • mto: This revision was merged to the branch mainline in revision 30.
  • Revision ID: package-import@ubuntu.com-20140522143925-vwqfo9287pmkrroe
Tags: 1:2.8.16+git20131003-3
* Team upload

[ Jaromír Mikeš ]
* Add -dbg package

[ Felipe Sateler ]
* Upload to experimental

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Generated by gtkmmproc -- DO NOT MODIFY!
 
2
 
 
3
#include <gtkmm/treedragsource.h>
 
4
#include <gtkmm/private/treedragsource_p.h>
 
5
 
 
6
// -*- c++ -*-
 
7
/* $Id$ */
 
8
 
 
9
/* Copyright 1998-2002 The gtkmm Development Team
 
10
 *
 
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.
 
15
 *
 
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.
 
20
 *
 
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.
 
24
 */
 
25
 
 
26
#include <gtkmm/treepath.h>
 
27
#include <gtkmm/selectiondata_private.h> //For SelectionData_WithoutOwnership
 
28
#include <gtk/gtktreednd.h>
 
29
 
 
30
 
 
31
namespace Gtk
 
32
{
 
33
 
 
34
//This vfunc wrapper is manually written, so that we can use a temporary instance for the SelectionData& output parameter:
 
35
 
 
36
gboolean TreeDragSource_Class::drag_data_get_vfunc_callback(GtkTreeDragSource* self, GtkTreePath* path, GtkSelectionData* selection_data)
 
37
{
 
38
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
 
39
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));
 
40
 
 
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
 
45
  // being overridden:
 
46
  if(obj && obj->is_derived_())
 
47
  {
 
48
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
 
49
    {
 
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));
 
53
    }
 
54
    catch(...)
 
55
    {
 
56
      Glib::exception_handlers_invoke();
 
57
    }
 
58
  }
 
59
  else
 
60
  {
 
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.
 
64
)    );
 
65
 
 
66
    // Call the original underlying C function:
 
67
    if(base && base->drag_data_get)
 
68
      return (*base->drag_data_get)(self, path, selection_data);
 
69
  }
 
70
 
 
71
  typedef gboolean RType;
 
72
  return RType();
 
73
}
 
74
 
 
75
bool Gtk::TreeDragSource::drag_data_get_vfunc(const TreeModel::Path& path, SelectionData& selection_data) const
 
76
{
 
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.
 
80
)  );
 
81
 
 
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());
 
84
 
 
85
  typedef bool RType;
 
86
  return RType();
 
87
}
 
88
 
 
89
} //namespace Gtk
 
90
 
 
91
 
 
92
namespace
 
93
{
 
94
} // anonymous namespace
 
95
 
 
96
 
 
97
namespace Glib
 
98
{
 
99
 
 
100
Glib::RefPtr<Gtk::TreeDragSource> wrap(GtkTreeDragSource* object, bool take_copy)
 
101
{
 
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.
 
104
}
 
105
 
 
106
} // namespace Glib
 
107
 
 
108
 
 
109
namespace Gtk
 
110
{
 
111
 
 
112
 
 
113
/* The *_Class implementation: */
 
114
 
 
115
const Glib::Interface_Class& TreeDragSource_Class::init()
 
116
{
 
117
  if(!gtype_) // create the GType if necessary
 
118
  {
 
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;
 
122
 
 
123
    // We can not derive from another interface, and it is not necessary anyway.
 
124
    gtype_ = gtk_tree_drag_source_get_type();
 
125
  }
 
126
 
 
127
  return *this;
 
128
}
 
129
 
 
130
void TreeDragSource_Class::iface_init_function(void* g_iface, void*)
 
131
{
 
132
  BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
 
133
 
 
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); 
 
137
 
 
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;
 
141
}
 
142
 
 
143
gboolean TreeDragSource_Class::row_draggable_vfunc_callback(GtkTreeDragSource* self, GtkTreePath* path)
 
144
{
 
145
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
 
146
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));
 
147
 
 
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
 
152
  // being overridden:
 
153
  if(obj && obj->is_derived_())
 
154
  {
 
155
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
 
156
    {
 
157
      // Call the virtual member method, which derived classes might override.
 
158
      return static_cast<int>(obj->row_draggable_vfunc(Gtk::TreePath(path, true)
 
159
));
 
160
    }
 
161
    catch(...)
 
162
    {
 
163
      Glib::exception_handlers_invoke();
 
164
    }
 
165
  }
 
166
  else
 
167
  {
 
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.
 
171
)    );
 
172
 
 
173
    // Call the original underlying C function:
 
174
    if(base && base->row_draggable)
 
175
      return (*base->row_draggable)(self, path);
 
176
  }
 
177
 
 
178
  typedef gboolean RType;
 
179
  return RType();
 
180
}
 
181
 
 
182
gboolean TreeDragSource_Class::drag_data_delete_vfunc_callback(GtkTreeDragSource* self, GtkTreePath* path)
 
183
{
 
184
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
 
185
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));
 
186
 
 
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
 
191
  // being overridden:
 
192
  if(obj && obj->is_derived_())
 
193
  {
 
194
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
 
195
    {
 
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)
 
198
));
 
199
    }
 
200
    catch(...)
 
201
    {
 
202
      Glib::exception_handlers_invoke();
 
203
    }
 
204
  }
 
205
  else
 
206
  {
 
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.
 
210
)    );
 
211
 
 
212
    // Call the original underlying C function:
 
213
    if(base && base->drag_data_delete)
 
214
      return (*base->drag_data_delete)(self, path);
 
215
  }
 
216
 
 
217
  typedef gboolean RType;
 
218
  return RType();
 
219
}
 
220
 
 
221
 
 
222
Glib::ObjectBase* TreeDragSource_Class::wrap_new(GObject* object)
 
223
{
 
224
  return new TreeDragSource((GtkTreeDragSource*)(object));
 
225
}
 
226
 
 
227
 
 
228
/* The implementation: */
 
229
 
 
230
TreeDragSource::TreeDragSource()
 
231
:
 
232
  Glib::Interface(treedragsource_class_.init())
 
233
{}
 
234
 
 
235
TreeDragSource::TreeDragSource(GtkTreeDragSource* castitem)
 
236
:
 
237
  Glib::Interface((GObject*)(castitem))
 
238
{}
 
239
 
 
240
TreeDragSource::~TreeDragSource()
 
241
{}
 
242
 
 
243
// static
 
244
void TreeDragSource::add_interface(GType gtype_implementer)
 
245
{
 
246
  treedragsource_class_.init().add_interface(gtype_implementer);
 
247
}
 
248
 
 
249
TreeDragSource::CppClassType TreeDragSource::treedragsource_class_; // initialize static member
 
250
 
 
251
GType TreeDragSource::get_type()
 
252
{
 
253
  return treedragsource_class_.init().get_type();
 
254
}
 
255
 
 
256
GType TreeDragSource::get_base_type()
 
257
{
 
258
  return gtk_tree_drag_source_get_type();
 
259
}
 
260
 
 
261
 
 
262
bool TreeDragSource::row_draggable(const TreeModel::Path& path) const
 
263
{
 
264
  return gtk_tree_drag_source_row_draggable(const_cast<GtkTreeDragSource*>(gobj()), const_cast<GtkTreePath*>((path).gobj()));
 
265
}
 
266
 
 
267
bool TreeDragSource::drag_data_get(const TreeModel::Path& path, SelectionData& selection_data)
 
268
{
 
269
  return gtk_tree_drag_source_drag_data_get(gobj(), const_cast<GtkTreePath*>((path).gobj()), (selection_data).gobj());
 
270
}
 
271
 
 
272
bool TreeDragSource::drag_data_delete(const TreeModel::Path& path)
 
273
{
 
274
  return gtk_tree_drag_source_drag_data_delete(gobj(), const_cast<GtkTreePath*>((path).gobj()));
 
275
}
 
276
 
 
277
 
 
278
bool Gtk::TreeDragSource::row_draggable_vfunc(const TreeModel::Path& path) const
 
279
{
 
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.
 
283
)  );
 
284
 
 
285
  if(base && base->row_draggable)
 
286
    return (*base->row_draggable)(const_cast<GtkTreeDragSource*>(gobj()),const_cast<GtkTreePath*>((path).gobj()));
 
287
 
 
288
  typedef bool RType;
 
289
  return RType();
 
290
}
 
291
 
 
292
bool Gtk::TreeDragSource::drag_data_delete_vfunc(const TreeModel::Path& path) 
 
293
{
 
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.
 
297
)  );
 
298
 
 
299
  if(base && base->drag_data_delete)
 
300
    return (*base->drag_data_delete)(gobj(),const_cast<GtkTreePath*>((path).gobj()));
 
301
 
 
302
  typedef bool RType;
 
303
  return RType();
 
304
}
 
305
 
 
306
 
 
307
} // namespace Gtk
 
308
 
 
309