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

« back to all changes in this revision

Viewing changes to libs/gtkmm2/gtk/gtkmm/socket.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/socket.h>
 
4
#include <gtkmm/private/socket_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 <gtk/gtksocket.h>
 
27
 
 
28
 
 
29
namespace
 
30
{
 
31
 
 
32
const Glib::SignalProxyInfo Socket_signal_plug_added_info =
 
33
{
 
34
  "plug_added",
 
35
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
 
36
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
 
37
};
 
38
 
 
39
 
 
40
gboolean Socket_signal_plug_removed_callback(GtkSocket* self, void* data)
 
41
{
 
42
  using namespace Gtk;
 
43
  typedef sigc::slot< bool > SlotType;
 
44
 
 
45
  // Do not try to call a signal on a disassociated wrapper.
 
46
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
 
47
  {
 
48
    try
 
49
    {
 
50
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
 
51
        return static_cast<int>((*static_cast<SlotType*>(slot))());
 
52
    }
 
53
    catch(...)
 
54
    {
 
55
      Glib::exception_handlers_invoke();
 
56
    }
 
57
  }
 
58
 
 
59
  typedef gboolean RType;
 
60
  return RType();
 
61
}
 
62
 
 
63
gboolean Socket_signal_plug_removed_notify_callback(GtkSocket* self,  void* data)
 
64
{
 
65
  using namespace Gtk;
 
66
  typedef sigc::slot< void > SlotType;
 
67
 
 
68
  // Do not try to call a signal on a disassociated wrapper.
 
69
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
 
70
  {
 
71
    try
 
72
    {
 
73
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
 
74
        (*static_cast<SlotType*>(slot))();
 
75
    }
 
76
    catch(...)
 
77
    {
 
78
      Glib::exception_handlers_invoke();
 
79
    }
 
80
  }
 
81
 
 
82
  typedef gboolean RType;
 
83
  return RType();
 
84
}
 
85
 
 
86
const Glib::SignalProxyInfo Socket_signal_plug_removed_info =
 
87
{
 
88
  "plug_removed",
 
89
  (GCallback) &Socket_signal_plug_removed_callback,
 
90
  (GCallback) &Socket_signal_plug_removed_notify_callback
 
91
};
 
92
 
 
93
} // anonymous namespace
 
94
 
 
95
 
 
96
namespace Glib
 
97
{
 
98
 
 
99
Gtk::Socket* wrap(GtkSocket* object, bool take_copy)
 
100
{
 
101
  return dynamic_cast<Gtk::Socket *> (Glib::wrap_auto ((GObject*)(object), take_copy));
 
102
}
 
103
 
 
104
} /* namespace Glib */
 
105
 
 
106
namespace Gtk
 
107
{
 
108
 
 
109
 
 
110
/* The *_Class implementation: */
 
111
 
 
112
const Glib::Class& Socket_Class::init()
 
113
{
 
114
  if(!gtype_) // create the GType if necessary
 
115
  {
 
116
    // Glib::Class has to know the class init function to clone custom types.
 
117
    class_init_func_ = &Socket_Class::class_init_function;
 
118
 
 
119
    // This is actually just optimized away, apparently with no harm.
 
120
    // Make sure that the parent type has been created.
 
121
    //CppClassParent::CppObjectType::get_type();
 
122
 
 
123
    // Create the wrapper type, with the same class/instance size as the base type.
 
124
    register_derived_type(gtk_socket_get_type());
 
125
 
 
126
    // Add derived versions of interfaces, if the C type implements any interfaces:
 
127
  }
 
128
 
 
129
  return *this;
 
130
}
 
131
 
 
132
void Socket_Class::class_init_function(void* g_class, void* class_data)
 
133
{
 
134
  BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
 
135
  CppClassParent::class_init_function(klass, class_data);
 
136
 
 
137
  klass->plug_added = &plug_added_callback;
 
138
  klass->plug_removed = &plug_removed_callback;
 
139
}
 
140
 
 
141
 
 
142
void Socket_Class::plug_added_callback(GtkSocket* self)
 
143
{
 
144
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
 
145
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));
 
146
 
 
147
  // Non-gtkmmproc-generated custom classes implicitly call the default
 
148
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
 
149
  // generated classes can use this optimisation, which avoids the unnecessary
 
150
  // parameter conversions if there is no possibility of the virtual function
 
151
  // being overridden:
 
152
  if(obj && obj->is_derived_())
 
153
  {
 
154
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
 
155
    {
 
156
      // Call the virtual member method, which derived classes might override.
 
157
      obj->on_plug_added();
 
158
    }
 
159
    catch(...)
 
160
    {
 
161
      Glib::exception_handlers_invoke();
 
162
    }
 
163
  }
 
164
  else
 
165
  {
 
166
    BaseClassType *const base = static_cast<BaseClassType*>(
 
167
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
 
168
    );
 
169
 
 
170
    // Call the original underlying C function:
 
171
    if(base && base->plug_added)
 
172
      (*base->plug_added)(self);
 
173
  }
 
174
}
 
175
 
 
176
gboolean Socket_Class::plug_removed_callback(GtkSocket* self)
 
177
{
 
178
  CppObjectType *const obj = dynamic_cast<CppObjectType*>(
 
179
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));
 
180
 
 
181
  // Non-gtkmmproc-generated custom classes implicitly call the default
 
182
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
 
183
  // generated classes can use this optimisation, which avoids the unnecessary
 
184
  // parameter conversions if there is no possibility of the virtual function
 
185
  // being overridden:
 
186
  if(obj && obj->is_derived_())
 
187
  {
 
188
    try // Trap C++ exceptions which would normally be lost because this is a C callback.
 
189
    {
 
190
      // Call the virtual member method, which derived classes might override.
 
191
      return static_cast<int>(obj->on_plug_removed());
 
192
    }
 
193
    catch(...)
 
194
    {
 
195
      Glib::exception_handlers_invoke();
 
196
    }
 
197
  }
 
198
  else
 
199
  {
 
200
    BaseClassType *const base = static_cast<BaseClassType*>(
 
201
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
 
202
    );
 
203
 
 
204
    // Call the original underlying C function:
 
205
    if(base && base->plug_removed)
 
206
      return (*base->plug_removed)(self);
 
207
  }
 
208
 
 
209
  typedef gboolean RType;
 
210
  return RType();
 
211
}
 
212
 
 
213
 
 
214
Glib::ObjectBase* Socket_Class::wrap_new(GObject* o)
 
215
{
 
216
  return manage(new Socket((GtkSocket*)(o)));
 
217
 
 
218
}
 
219
 
 
220
 
 
221
/* The implementation: */
 
222
 
 
223
Socket::Socket(const Glib::ConstructParams& construct_params)
 
224
:
 
225
  Gtk::Container(construct_params)
 
226
{
 
227
  }
 
228
 
 
229
Socket::Socket(GtkSocket* castitem)
 
230
:
 
231
  Gtk::Container((GtkContainer*)(castitem))
 
232
{
 
233
  }
 
234
 
 
235
Socket::~Socket()
 
236
{
 
237
  destroy_();
 
238
}
 
239
 
 
240
Socket::CppClassType Socket::socket_class_; // initialize static member
 
241
 
 
242
GType Socket::get_type()
 
243
{
 
244
  return socket_class_.init().get_type();
 
245
}
 
246
 
 
247
GType Socket::get_base_type()
 
248
{
 
249
  return gtk_socket_get_type();
 
250
}
 
251
 
 
252
 
 
253
Socket::Socket()
 
254
:
 
255
  Glib::ObjectBase(0), //Mark this class as gtkmmproc-generated, rather than a custom class, to allow vfunc optimisations.
 
256
  Gtk::Container(Glib::ConstructParams(socket_class_.init()))
 
257
{
 
258
  }
 
259
 
 
260
void Socket::add_id(Gdk::NativeWindow window_id)
 
261
{
 
262
  gtk_socket_add_id(gobj(), (GdkNativeWindow)(window_id));
 
263
}
 
264
 
 
265
Gdk::NativeWindow Socket::get_id() const
 
266
{
 
267
  return (Gdk::NativeWindow)(gtk_socket_get_id(const_cast<GtkSocket*>(gobj())));
 
268
}
 
269
 
 
270
 
 
271
Glib::SignalProxy0< void > Socket::signal_plug_added()
 
272
{
 
273
  return Glib::SignalProxy0< void >(this, &Socket_signal_plug_added_info);
 
274
}
 
275
 
 
276
Glib::SignalProxy0< bool > Socket::signal_plug_removed()
 
277
{
 
278
  return Glib::SignalProxy0< bool >(this, &Socket_signal_plug_removed_info);
 
279
}
 
280
 
 
281
 
 
282
void Gtk::Socket::on_plug_added()
 
283
{
 
284
  BaseClassType *const base = static_cast<BaseClassType*>(
 
285
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
 
286
  );
 
287
 
 
288
  if(base && base->plug_added)
 
289
    (*base->plug_added)(gobj());
 
290
}
 
291
 
 
292
bool Gtk::Socket::on_plug_removed()
 
293
{
 
294
  BaseClassType *const base = static_cast<BaseClassType*>(
 
295
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
 
296
  );
 
297
 
 
298
  if(base && base->plug_removed)
 
299
    return (*base->plug_removed)(gobj());
 
300
 
 
301
  typedef bool RType;
 
302
  return RType();
 
303
}
 
304
 
 
305
 
 
306
} // namespace Gtk
 
307
 
 
308