fix for type error on 64 bit systems
[ardour.git] / libs / gtkmm2 / atk / atkmm / editabletext.cc
1 // Generated by gtkmmproc -- DO NOT MODIFY!
2
3 #include <atkmm/editabletext.h>
4 #include <atkmm/private/editabletext_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 <atkmm/object.h>
27 #include <atk/atkeditabletext.h>
28
29
30 namespace
31 {
32 } // anonymous namespace
33
34
35 namespace Glib
36 {
37
38 Glib::RefPtr<Atk::EditableText> wrap(AtkEditableText* object, bool take_copy)
39 {
40   return Glib::RefPtr<Atk::EditableText>( dynamic_cast<Atk::EditableText*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
41   //We use dynamic_cast<> in case of multiple inheritance.
42 }
43
44 } // namespace Glib
45
46
47 namespace Atk
48 {
49
50
51 /* The *_Class implementation: */
52
53 const Glib::Interface_Class& EditableText_Class::init()
54 {
55   if(!gtype_) // create the GType if necessary
56   {
57     // Glib::Interface_Class has to know the interface init function
58     // in order to add interfaces to implementing types.
59     class_init_func_ = &EditableText_Class::iface_init_function;
60
61     // We can not derive from another interface, and it is not necessary anyway.
62     gtype_ = atk_editable_text_get_type();
63   }
64
65   return *this;
66 }
67
68 void EditableText_Class::iface_init_function(void* g_iface, void*)
69 {
70   BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
71
72   //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
73   //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
74   g_assert(klass != 0); 
75
76   klass->set_run_attributes = &set_run_attributes_vfunc_callback;
77   klass->set_text_contents = &set_text_contents_vfunc_callback;
78   klass->insert_text = &insert_text_vfunc_callback;
79   klass->copy_text = &copy_text_vfunc_callback;
80   klass->cut_text = &cut_text_vfunc_callback;
81   klass->delete_text = &delete_text_vfunc_callback;
82   klass->paste_text = &paste_text_vfunc_callback;
83 }
84
85 gboolean EditableText_Class::set_run_attributes_vfunc_callback(AtkEditableText* self, AtkAttributeSet* attrib_set, gint start_offset, gint end_offset)
86 {
87   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
88       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
89
90   // Non-gtkmmproc-generated custom classes implicitly call the default
91   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
92   // generated classes can use this optimisation, which avoids the unnecessary
93   // parameter conversions if there is no possibility of the virtual function
94   // being overridden:
95   if(obj && obj->is_derived_())
96   {
97     try // Trap C++ exceptions which would normally be lost because this is a C callback.
98     {
99       // Call the virtual member method, which derived classes might override.
100       return static_cast<int>(obj->set_run_attributes_vfunc(attrib_set, start_offset
101 , end_offset
102 ));
103     }
104     catch(...)
105     {
106       Glib::exception_handlers_invoke();
107     }
108   }
109   else
110   {
111     BaseClassType *const base = static_cast<BaseClassType*>(
112         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
113 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
114 )    );
115
116     // Call the original underlying C function:
117     if(base && base->set_run_attributes)
118       return (*base->set_run_attributes)(self, attrib_set, start_offset, end_offset);
119   }
120
121   typedef gboolean RType;
122   return RType();
123 }
124
125 void EditableText_Class::set_text_contents_vfunc_callback(AtkEditableText* self, const gchar* string)
126 {
127   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
128       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
129
130   // Non-gtkmmproc-generated custom classes implicitly call the default
131   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
132   // generated classes can use this optimisation, which avoids the unnecessary
133   // parameter conversions if there is no possibility of the virtual function
134   // being overridden:
135   if(obj && obj->is_derived_())
136   {
137     try // Trap C++ exceptions which would normally be lost because this is a C callback.
138     {
139       // Call the virtual member method, which derived classes might override.
140       obj->set_text_contents_vfunc(Glib::convert_const_gchar_ptr_to_ustring(string)
141 );
142     }
143     catch(...)
144     {
145       Glib::exception_handlers_invoke();
146     }
147   }
148   else
149   {
150     BaseClassType *const base = static_cast<BaseClassType*>(
151         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
152 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
153 )    );
154
155     // Call the original underlying C function:
156     if(base && base->set_text_contents)
157       (*base->set_text_contents)(self, string);
158   }
159 }
160
161 void EditableText_Class::insert_text_vfunc_callback(AtkEditableText* self, const gchar* string, gint length, gint* position)
162 {
163   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
164       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
165
166   // Non-gtkmmproc-generated custom classes implicitly call the default
167   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
168   // generated classes can use this optimisation, which avoids the unnecessary
169   // parameter conversions if there is no possibility of the virtual function
170   // being overridden:
171   if(obj && obj->is_derived_())
172   {
173     try // Trap C++ exceptions which would normally be lost because this is a C callback.
174     {
175       // Call the virtual member method, which derived classes might override.
176       obj->insert_text_vfunc(Glib::convert_const_gchar_ptr_to_ustring(string)
177 , length
178 , *(position)
179 );
180     }
181     catch(...)
182     {
183       Glib::exception_handlers_invoke();
184     }
185   }
186   else
187   {
188     BaseClassType *const base = static_cast<BaseClassType*>(
189         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
190 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
191 )    );
192
193     // Call the original underlying C function:
194     if(base && base->insert_text)
195       (*base->insert_text)(self, string, length, position);
196   }
197 }
198
199 void EditableText_Class::copy_text_vfunc_callback(AtkEditableText* self, gint start_pos, gint end_pos)
200 {
201   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
202       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
203
204   // Non-gtkmmproc-generated custom classes implicitly call the default
205   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
206   // generated classes can use this optimisation, which avoids the unnecessary
207   // parameter conversions if there is no possibility of the virtual function
208   // being overridden:
209   if(obj && obj->is_derived_())
210   {
211     try // Trap C++ exceptions which would normally be lost because this is a C callback.
212     {
213       // Call the virtual member method, which derived classes might override.
214       obj->copy_text_vfunc(start_pos
215 , end_pos
216 );
217     }
218     catch(...)
219     {
220       Glib::exception_handlers_invoke();
221     }
222   }
223   else
224   {
225     BaseClassType *const base = static_cast<BaseClassType*>(
226         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
227 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
228 )    );
229
230     // Call the original underlying C function:
231     if(base && base->copy_text)
232       (*base->copy_text)(self, start_pos, end_pos);
233   }
234 }
235
236 void EditableText_Class::cut_text_vfunc_callback(AtkEditableText* self, gint start_pos, gint end_pos)
237 {
238   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
239       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
240
241   // Non-gtkmmproc-generated custom classes implicitly call the default
242   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
243   // generated classes can use this optimisation, which avoids the unnecessary
244   // parameter conversions if there is no possibility of the virtual function
245   // being overridden:
246   if(obj && obj->is_derived_())
247   {
248     try // Trap C++ exceptions which would normally be lost because this is a C callback.
249     {
250       // Call the virtual member method, which derived classes might override.
251       obj->cut_text_vfunc(start_pos
252 , end_pos
253 );
254     }
255     catch(...)
256     {
257       Glib::exception_handlers_invoke();
258     }
259   }
260   else
261   {
262     BaseClassType *const base = static_cast<BaseClassType*>(
263         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
264 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
265 )    );
266
267     // Call the original underlying C function:
268     if(base && base->cut_text)
269       (*base->cut_text)(self, start_pos, end_pos);
270   }
271 }
272
273 void EditableText_Class::delete_text_vfunc_callback(AtkEditableText* self, gint start_pos, gint end_pos)
274 {
275   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
276       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
277
278   // Non-gtkmmproc-generated custom classes implicitly call the default
279   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
280   // generated classes can use this optimisation, which avoids the unnecessary
281   // parameter conversions if there is no possibility of the virtual function
282   // being overridden:
283   if(obj && obj->is_derived_())
284   {
285     try // Trap C++ exceptions which would normally be lost because this is a C callback.
286     {
287       // Call the virtual member method, which derived classes might override.
288       obj->delete_text_vfunc(start_pos
289 , end_pos
290 );
291     }
292     catch(...)
293     {
294       Glib::exception_handlers_invoke();
295     }
296   }
297   else
298   {
299     BaseClassType *const base = static_cast<BaseClassType*>(
300         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
301 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
302 )    );
303
304     // Call the original underlying C function:
305     if(base && base->delete_text)
306       (*base->delete_text)(self, start_pos, end_pos);
307   }
308 }
309
310 void EditableText_Class::paste_text_vfunc_callback(AtkEditableText* self, gint position)
311 {
312   CppObjectType *const obj = dynamic_cast<CppObjectType*>(
313       Glib::ObjectBase::_get_current_wrapper((GObject*)self));
314
315   // Non-gtkmmproc-generated custom classes implicitly call the default
316   // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
317   // generated classes can use this optimisation, which avoids the unnecessary
318   // parameter conversions if there is no possibility of the virtual function
319   // being overridden:
320   if(obj && obj->is_derived_())
321   {
322     try // Trap C++ exceptions which would normally be lost because this is a C callback.
323     {
324       // Call the virtual member method, which derived classes might override.
325       obj->paste_text_vfunc(position
326 );
327     }
328     catch(...)
329     {
330       Glib::exception_handlers_invoke();
331     }
332   }
333   else
334   {
335     BaseClassType *const base = static_cast<BaseClassType*>(
336         g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
337 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
338 )    );
339
340     // Call the original underlying C function:
341     if(base && base->paste_text)
342       (*base->paste_text)(self, position);
343   }
344 }
345
346
347 Glib::ObjectBase* EditableText_Class::wrap_new(GObject* object)
348 {
349   return new EditableText((AtkEditableText*)(object));
350 }
351
352
353 /* The implementation: */
354
355 EditableText::EditableText()
356 :
357   Glib::Interface(editabletext_class_.init())
358 {}
359
360 EditableText::EditableText(AtkEditableText* castitem)
361 :
362   Glib::Interface((GObject*)(castitem))
363 {}
364
365 EditableText::~EditableText()
366 {}
367
368 // static
369 void EditableText::add_interface(GType gtype_implementer)
370 {
371   editabletext_class_.init().add_interface(gtype_implementer);
372 }
373
374 EditableText::CppClassType EditableText::editabletext_class_; // initialize static member
375
376 GType EditableText::get_type()
377 {
378   return editabletext_class_.init().get_type();
379 }
380
381 GType EditableText::get_base_type()
382 {
383   return atk_editable_text_get_type();
384 }
385
386
387 bool EditableText::set_run_attributes(const AttributeSet& attrib_set, int start_offset, int end_offset)
388 {
389   return atk_editable_text_set_run_attributes(gobj(), (attrib_set).data(), start_offset, end_offset);
390 }
391
392 void EditableText::set_text_contents(const Glib::ustring& string)
393 {
394   atk_editable_text_set_text_contents(gobj(), string.c_str());
395 }
396
397 void EditableText::insert_text(const Glib::ustring& string, int length, int& position)
398 {
399   atk_editable_text_insert_text(gobj(), string.c_str(), length, &position);
400 }
401
402 void EditableText::copy_text(int start_pos, int end_pos)
403 {
404   atk_editable_text_copy_text(gobj(), start_pos, end_pos);
405 }
406
407 void EditableText::cut_text(int start_pos, int end_pos)
408 {
409   atk_editable_text_cut_text(gobj(), start_pos, end_pos);
410 }
411
412 void EditableText::delete_text(int start_pos, int end_pos)
413 {
414   atk_editable_text_delete_text(gobj(), start_pos, end_pos);
415 }
416
417 void EditableText::paste_text(int position)
418 {
419   atk_editable_text_paste_text(gobj(), position);
420 }
421
422
423 bool Atk::EditableText::set_run_attributes_vfunc(AtkAttributeSet* attrib_set, int start_offset, int end_offset) 
424 {
425   BaseClassType *const base = static_cast<BaseClassType*>(
426       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
427 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
428 )  );
429
430   if(base && base->set_run_attributes)
431     return (*base->set_run_attributes)(gobj(),attrib_set,start_offset,end_offset);
432
433   typedef bool RType;
434   return RType();
435 }
436
437 void Atk::EditableText::set_text_contents_vfunc(const Glib::ustring& string) 
438 {
439   BaseClassType *const base = static_cast<BaseClassType*>(
440       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
441 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
442 )  );
443
444   if(base && base->set_text_contents)
445     (*base->set_text_contents)(gobj(),string.c_str());
446 }
447
448 void Atk::EditableText::insert_text_vfunc(const Glib::ustring& string, int length, int& position) 
449 {
450   BaseClassType *const base = static_cast<BaseClassType*>(
451       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
452 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
453 )  );
454
455   if(base && base->insert_text)
456     (*base->insert_text)(gobj(),string.c_str(),length,&position);
457 }
458
459 void Atk::EditableText::copy_text_vfunc(int start_pos, int end_pos) 
460 {
461   BaseClassType *const base = static_cast<BaseClassType*>(
462       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
463 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
464 )  );
465
466   if(base && base->copy_text)
467     (*base->copy_text)(gobj(),start_pos,end_pos);
468 }
469
470 void Atk::EditableText::cut_text_vfunc(int start_pos, int end_pos) 
471 {
472   BaseClassType *const base = static_cast<BaseClassType*>(
473       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
474 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
475 )  );
476
477   if(base && base->cut_text)
478     (*base->cut_text)(gobj(),start_pos,end_pos);
479 }
480
481 void Atk::EditableText::delete_text_vfunc(int start_pos, int end_pos) 
482 {
483   BaseClassType *const base = static_cast<BaseClassType*>(
484       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
485 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
486 )  );
487
488   if(base && base->delete_text)
489     (*base->delete_text)(gobj(),start_pos,end_pos);
490 }
491
492 void Atk::EditableText::paste_text_vfunc(int position) 
493 {
494   BaseClassType *const base = static_cast<BaseClassType*>(
495       g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
496 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
497 )  );
498
499   if(base && base->paste_text)
500     (*base->paste_text)(gobj(),position);
501 }
502
503
504 } // namespace Atk
505
506