fix for type error on 64 bit systems
[ardour.git] / libs / gtkmm2 / atk / atkmm / value.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <atkmm/value.h>
4 #include <atkmm/private/value_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 <atk/atkvalue.h>
27
28
29 namespace
30 {
31 } // anonymous namespace
32
33
34 namespace Glib
35 {
36
37 Glib::RefPtr<Atk::Value> wrap(AtkValue* object, bool take_copy)
38 {
39   return Glib::RefPtr<Atk::Value>( dynamic_cast<Atk::Value*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
40   //We use dynamic_cast<> in case of multiple inheritance.
41 }
42
43 } // namespace Glib
44
45
46 namespace Atk
47 {
48
49
50 /* The *_Class implementation: */
51
52 const Glib::Interface_Class& Value_Class::init()
53 {
54   if(!gtype_) // create the GType if necessary
55   {
56     // Glib::Interface_Class has to know the interface init function
57     // in order to add interfaces to implementing types.
58     class_init_func_ = &Value_Class::iface_init_function;
59
60     // We can not derive from another interface, and it is not necessary anyway.
61     gtype_ = atk_value_get_type();
62   }
63
64   return *this;
65 }
66
67 void Value_Class::iface_init_function(void* g_iface, void*)
68 {
69   BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
70
71   //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
72   //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
73   g_assert(klass != 0); 
74
75   klass->get_current_value = &get_current_value_vfunc_callback;
76   klass->get_maximum_value = &get_maximum_value_vfunc_callback;
77   klass->get_minimum_value = &get_minimum_value_vfunc_callback;
78   klass->set_current_value = &set_current_value_vfunc_callback;
79 }
80
81 void Value_Class::get_current_value_vfunc_callback(AtkValue* self, GValue* value)
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       obj->get_current_value_vfunc(*reinterpret_cast<Glib::ValueBase*>(value)
97 );
98     }
99     catch(...)
100     {
101       Glib::exception_handlers_invoke();
102     }
103   }
104   else
105   {
106     BaseClassType *const base = static_cast<BaseClassType*>(
107         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
108 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
109 )    );
110
111     // Call the original underlying C function:
112     if(base && base->get_current_value)
113       (*base->get_current_value)(self, value);
114   }
115 }
116
117 void Value_Class::get_maximum_value_vfunc_callback(AtkValue* self, GValue* value)
118 {
119   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
120       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
121
122   // Non-gtkmmproc-generated custom classes implicitly call the default
123   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
124   // generated classes can use this optimisation, which avoids the unnecessary
125   // parameter conversions if there is no possibility of the virtual function
126   // being overridden:
127   if(obj && obj->is_derived_())
128   {
129     try // Trap C++ exceptions which would normally be lost because this is a C callback.
130     {
131       // Call the virtual member method, which derived classes might override.
132       obj->get_maximum_value_vfunc(*reinterpret_cast<Glib::ValueBase*>(value)
133 );
134     }
135     catch(...)
136     {
137       Glib::exception_handlers_invoke();
138     }
139   }
140   else
141   {
142     BaseClassType *const base = static_cast<BaseClassType*>(
143         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
144 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
145 )    );
146
147     // Call the original underlying C function:
148     if(base && base->get_maximum_value)
149       (*base->get_maximum_value)(self, value);
150   }
151 }
152
153 void Value_Class::get_minimum_value_vfunc_callback(AtkValue* self, GValue* value)
154 {
155   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
156       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
157
158   // Non-gtkmmproc-generated custom classes implicitly call the default
159   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
160   // generated classes can use this optimisation, which avoids the unnecessary
161   // parameter conversions if there is no possibility of the virtual function
162   // being overridden:
163   if(obj && obj->is_derived_())
164   {
165     try // Trap C++ exceptions which would normally be lost because this is a C callback.
166     {
167       // Call the virtual member method, which derived classes might override.
168       obj->get_minimum_value_vfunc(*reinterpret_cast<Glib::ValueBase*>(value)
169 );
170     }
171     catch(...)
172     {
173       Glib::exception_handlers_invoke();
174     }
175   }
176   else
177   {
178     BaseClassType *const base = static_cast<BaseClassType*>(
179         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
180 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
181 )    );
182
183     // Call the original underlying C function:
184     if(base && base->get_minimum_value)
185       (*base->get_minimum_value)(self, value);
186   }
187 }
188
189 gboolean Value_Class::set_current_value_vfunc_callback(AtkValue* self, const GValue* value)
190 {
191   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
192       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
193
194   // Non-gtkmmproc-generated custom classes implicitly call the default
195   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
196   // generated classes can use this optimisation, which avoids the unnecessary
197   // parameter conversions if there is no possibility of the virtual function
198   // being overridden:
199   if(obj && obj->is_derived_())
200   {
201     try // Trap C++ exceptions which would normally be lost because this is a C callback.
202     {
203       // Call the virtual member method, which derived classes might override.
204       return static_cast<int>(obj->set_current_value_vfunc(*reinterpret_cast<const Glib::ValueBase*>(value)
205 ));
206     }
207     catch(...)
208     {
209       Glib::exception_handlers_invoke();
210     }
211   }
212   else
213   {
214     BaseClassType *const base = static_cast<BaseClassType*>(
215         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
216 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
217 )    );
218
219     // Call the original underlying C function:
220     if(base && base->set_current_value)
221       return (*base->set_current_value)(self, value);
222   }
223
224   typedef gboolean RType;
225   return RType();
226 }
227
228
229 Glib::ObjectBase* Value_Class::wrap_new(GObject* object)
230 {
231   return new Value((AtkValue*)(object));
232 }
233
234
235 /* The implementation: */
236
237 Value::Value()
238 :
239   Glib::Interface(value_class_.init())
240 {}
241
242 Value::Value(AtkValue* castitem)
243 :
244   Glib::Interface((GObject*)(castitem))
245 {}
246
247 Value::~Value()
248 {}
249
250 // static
251 void Value::add_interface(GType gtype_implementer)
252 {
253   value_class_.init().add_interface(gtype_implementer);
254 }
255
256 Value::CppClassType Value::value_class_; // initialize static member
257
258 GType Value::get_type()
259 {
260   return value_class_.init().get_type();
261 }
262
263 GType Value::get_base_type()
264 {
265   return atk_value_get_type();
266 }
267
268
269 void Value::get_current_value(Glib::ValueBase& value) const
270 {
271   atk_value_get_current_value(const_cast<AtkValue*>(gobj()), (value).gobj());
272 }
273
274 void Value::get_maximum_value(Glib::ValueBase& value) const
275 {
276   atk_value_get_maximum_value(const_cast<AtkValue*>(gobj()), (value).gobj());
277 }
278
279 void Value::get_minimum_value(Glib::ValueBase& value) const
280 {
281   atk_value_get_minimum_value(const_cast<AtkValue*>(gobj()), (value).gobj());
282 }
283
284 bool Value::set_current_value(const Glib::ValueBase& value)
285 {
286   return atk_value_set_current_value(gobj(), (value).gobj());
287 }
288
289
290 void Atk::Value::get_current_value_vfunc(Glib::ValueBase& value) const
291 {
292   BaseClassType *const base = static_cast<BaseClassType*>(
293       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
294 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
295 )  );
296
297   if(base && base->get_current_value)
298     (*base->get_current_value)(const_cast<AtkValue*>(gobj()),(value).gobj());
299 }
300
301 void Atk::Value::get_maximum_value_vfunc(Glib::ValueBase& value) const
302 {
303   BaseClassType *const base = static_cast<BaseClassType*>(
304       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
305 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
306 )  );
307
308   if(base && base->get_maximum_value)
309     (*base->get_maximum_value)(const_cast<AtkValue*>(gobj()),(value).gobj());
310 }
311
312 void Atk::Value::get_minimum_value_vfunc(Glib::ValueBase& value) const
313 {
314   BaseClassType *const base = static_cast<BaseClassType*>(
315       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
316 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
317 )  );
318
319   if(base && base->get_minimum_value)
320     (*base->get_minimum_value)(const_cast<AtkValue*>(gobj()),(value).gobj());
321 }
322
323 bool Atk::Value::set_current_value_vfunc(const Glib::ValueBase& value) 
324 {
325   BaseClassType *const base = static_cast<BaseClassType*>(
326       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
327 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
328 )  );
329
330   if(base && base->set_current_value)
331     return (*base->set_current_value)(gobj(),(value).gobj());
332
333   typedef bool RType;
334   return RType();
335 }
336
337
338 } // namespace Atk
339
340