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

« back to all changes in this revision

Viewing changes to libs/gtkmm2/gtk/gtkmm/treedragdest.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/treedragdest.h>
 
4
#include <gtkmm/private/treedragdest_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>
 
28
#include <gtk/gtktreednd.h>
 
29
 
 
30
 
 
31
namespace
 
32
{
 
33
} // anonymous namespace
 
34
 
 
35
 
 
36
namespace Glib
 
37
{
 
38
 
 
39
Glib::RefPtr<Gtk::TreeDragDest> wrap(GtkTreeDragDest* object, bool take_copy)
 
40
{
 
41
  return Glib::RefPtr<Gtk::TreeDragDest>( dynamic_cast<Gtk::TreeDragDest*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
 
42
  //We use dynamic_cast<> in case of multiple inheritance.
 
43
}
 
44
 
 
45
} // namespace Glib
 
46
 
 
47
 
 
48
namespace Gtk
 
49
{
 
50
 
 
51
 
 
52
/* The *_Class implementation: */
 
53
 
 
54
const Glib::Interface_Class& TreeDragDest_Class::init()
 
55
{
 
56
  if(!gtype_) // create the GType if necessary
 
57
  {
 
58
    // Glib::Interface_Class has to know the interface init function
 
59
    // in order to add interfaces to implementing types.
 
60
    class_init_func_ = &TreeDragDest_Class::iface_init_function;
 
61
 
 
62
    // We can not derive from another interface, and it is not necessary anyway.
 
63
    gtype_ = gtk_tree_drag_dest_get_type();
 
64
  }
 
65
 
 
66
  return *this;
 
67
}
 
68
 
 
69
void TreeDragDest_Class::iface_init_function(void* g_iface, void*)
 
70
{
 
71
  BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
 
72
 
 
73
  //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
 
74
  //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
 
75
  g_assert(klass != 0); 
 
76
 
 
77
  klass->drag_data_received = &drag_data_received_vfunc_callback;
 
78
  klass->row_drop_possible = &row_drop_possible_vfunc_callback;
 
79
}
 
80
 
 
81
gboolean TreeDragDest_Class::drag_data_received_vfunc_callback(GtkTreeDragDest* self, GtkTreePath* dest, GtkSelectionData* selection_data)
 
82
{
 
83
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
 
84
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));
 
85
 
 
86
  // Non-gtkmmproc-generated custom classes implicitly call the default
 
87
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
 
88
  // generated classes can use this optimisation, which avoids the unnecessary
 
89
  // parameter conversions if there is no possibility of the virtual function
 
90
  // being overridden:
 
91
  if(obj && obj->is_derived_())
 
92
  {
 
93
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
 
94
    {
 
95
      // Call the virtual member method, which derived classes might override.
 
96
      return static_cast<int>(obj->drag_data_received_vfunc(Gtk::TreePath(dest, true)
 
97
, SelectionData_WithoutOwnership(selection_data)
 
98
));
 
99
    }
 
100
    catch(...)
 
101
    {
 
102
      Glib::exception_handlers_invoke();
 
103
    }
 
104
  }
 
105
  else
 
106
  {
 
107
    BaseClassType *const base = static_cast<BaseClassType*>(
 
108
        g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
 
109
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
 
110
)    );
 
111
 
 
112
    // Call the original underlying C function:
 
113
    if(base && base->drag_data_received)
 
114
      return (*base->drag_data_received)(self, dest, selection_data);
 
115
  }
 
116
 
 
117
  typedef gboolean RType;
 
118
  return RType();
 
119
}
 
120
 
 
121
gboolean TreeDragDest_Class::row_drop_possible_vfunc_callback(GtkTreeDragDest* self, GtkTreePath* dest_path, GtkSelectionData* selection_data)
 
122
{
 
123
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
 
124
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));
 
125
 
 
126
  // Non-gtkmmproc-generated custom classes implicitly call the default
 
127
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
 
128
  // generated classes can use this optimisation, which avoids the unnecessary
 
129
  // parameter conversions if there is no possibility of the virtual function
 
130
  // being overridden:
 
131
  if(obj && obj->is_derived_())
 
132
  {
 
133
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
 
134
    {
 
135
      // Call the virtual member method, which derived classes might override.
 
136
      return static_cast<int>(obj->row_drop_possible_vfunc(Gtk::TreePath(dest_path, true)
 
137
, SelectionData_WithoutOwnership(selection_data)
 
138
));
 
139
    }
 
140
    catch(...)
 
141
    {
 
142
      Glib::exception_handlers_invoke();
 
143
    }
 
144
  }
 
145
  else
 
146
  {
 
147
    BaseClassType *const base = static_cast<BaseClassType*>(
 
148
        g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
 
149
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
 
150
)    );
 
151
 
 
152
    // Call the original underlying C function:
 
153
    if(base && base->row_drop_possible)
 
154
      return (*base->row_drop_possible)(self, dest_path, selection_data);
 
155
  }
 
156
 
 
157
  typedef gboolean RType;
 
158
  return RType();
 
159
}
 
160
 
 
161
 
 
162
Glib::ObjectBase* TreeDragDest_Class::wrap_new(GObject* object)
 
163
{
 
164
  return new TreeDragDest((GtkTreeDragDest*)(object));
 
165
}
 
166
 
 
167
 
 
168
/* The implementation: */
 
169
 
 
170
TreeDragDest::TreeDragDest()
 
171
:
 
172
  Glib::Interface(treedragdest_class_.init())
 
173
{}
 
174
 
 
175
TreeDragDest::TreeDragDest(GtkTreeDragDest* castitem)
 
176
:
 
177
  Glib::Interface((GObject*)(castitem))
 
178
{}
 
179
 
 
180
TreeDragDest::~TreeDragDest()
 
181
{}
 
182
 
 
183
// static
 
184
void TreeDragDest::add_interface(GType gtype_implementer)
 
185
{
 
186
  treedragdest_class_.init().add_interface(gtype_implementer);
 
187
}
 
188
 
 
189
TreeDragDest::CppClassType TreeDragDest::treedragdest_class_; // initialize static member
 
190
 
 
191
GType TreeDragDest::get_type()
 
192
{
 
193
  return treedragdest_class_.init().get_type();
 
194
}
 
195
 
 
196
GType TreeDragDest::get_base_type()
 
197
{
 
198
  return gtk_tree_drag_dest_get_type();
 
199
}
 
200
 
 
201
 
 
202
bool TreeDragDest::drag_data_received(const TreeModel::Path& dest, const SelectionData& selection_data)
 
203
{
 
204
  return gtk_tree_drag_dest_drag_data_received(gobj(), const_cast<GtkTreePath*>((dest).gobj()), const_cast<GtkSelectionData*>((selection_data).gobj()));
 
205
}
 
206
 
 
207
bool TreeDragDest::row_drop_possible(const TreeModel::Path& dest_path, const SelectionData& selection_data) const
 
208
{
 
209
  return gtk_tree_drag_dest_row_drop_possible(const_cast<GtkTreeDragDest*>(gobj()), const_cast<GtkTreePath*>((dest_path).gobj()), const_cast<GtkSelectionData*>((selection_data).gobj()));
 
210
}
 
211
 
 
212
 
 
213
bool Gtk::TreeDragDest::drag_data_received_vfunc(const TreeModel::Path& dest, const SelectionData& selection_data) 
 
214
{
 
215
  BaseClassType *const base = static_cast<BaseClassType*>(
 
216
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
 
217
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
 
218
)  );
 
219
 
 
220
  if(base && base->drag_data_received)
 
221
    return (*base->drag_data_received)(gobj(),const_cast<GtkTreePath*>((dest).gobj()),const_cast<GtkSelectionData*>((selection_data).gobj()));
 
222
 
 
223
  typedef bool RType;
 
224
  return RType();
 
225
}
 
226
 
 
227
bool Gtk::TreeDragDest::row_drop_possible_vfunc(const TreeModel::Path& dest, const SelectionData& selection_data) const
 
228
{
 
229
  BaseClassType *const base = static_cast<BaseClassType*>(
 
230
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
 
231
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
 
232
)  );
 
233
 
 
234
  if(base && base->row_drop_possible)
 
235
    return (*base->row_drop_possible)(const_cast<GtkTreeDragDest*>(gobj()),const_cast<GtkTreePath*>((dest).gobj()),const_cast<GtkSelectionData*>((selection_data).gobj()));
 
236
 
 
237
  typedef bool RType;
 
238
  return RType();
 
239
}
 
240
 
 
241
 
 
242
} // namespace Gtk
 
243
 
 
244