1 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #include <gtkmm/editable.h>
4 #include <gtkmm/private/editable_p.h>
9 /* Copyright 1998-2002 The gtkmm Development Team
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.
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.
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.
26 #include <gtk/gtkeditable.h>
32 void Editable_signal_insert_text_callback(GtkEditable* self, const gchar* text,gint length,gint* position,void* data)
35 typedef sigc::slot< void,const Glib::ustring&,int* > SlotType;
37 // Do not try to call a signal on a disassociated wrapper.
38 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
42 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
43 (*static_cast<SlotType*>(slot))( Glib::ustring(text, text + length), position);
47 Glib::exception_handlers_invoke();
52 const Glib::SignalProxyInfo Editable_signal_insert_text_info =
55 (GCallback) &Editable_signal_insert_text_callback,
56 (GCallback) &Editable_signal_insert_text_callback
60 void Editable_signal_delete_text_callback(GtkEditable* self, gint start_pos,gint end_pos,void* data)
63 typedef sigc::slot< void,int,int > SlotType;
65 // Do not try to call a signal on a disassociated wrapper.
66 if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
70 if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
71 (*static_cast<SlotType*>(slot))(start_pos
77 Glib::exception_handlers_invoke();
82 const Glib::SignalProxyInfo Editable_signal_delete_text_info =
85 (GCallback) &Editable_signal_delete_text_callback,
86 (GCallback) &Editable_signal_delete_text_callback
90 const Glib::SignalProxyInfo Editable_signal_changed_info =
93 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
94 (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
97 } // anonymous namespace
103 Glib::RefPtr<Gtk::Editable> wrap(GtkEditable* object, bool take_copy)
105 return Glib::RefPtr<Gtk::Editable>( dynamic_cast<Gtk::Editable*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
106 //We use dynamic_cast<> in case of multiple inheritance.
116 /* The *_Class implementation: */
118 const Glib::Interface_Class& Editable_Class::init()
120 if(!gtype_) // create the GType if necessary
122 // Glib::Interface_Class has to know the interface init function
123 // in order to add interfaces to implementing types.
124 class_init_func_ = &Editable_Class::iface_init_function;
126 // We can not derive from another interface, and it is not necessary anyway.
127 gtype_ = gtk_editable_get_type();
133 void Editable_Class::iface_init_function(void* g_iface, void*)
135 BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
137 //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
138 //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
139 g_assert(klass != 0);
141 klass->do_insert_text = &do_insert_text_vfunc_callback;
142 klass->do_delete_text = &do_delete_text_vfunc_callback;
143 klass->get_chars = &get_chars_vfunc_callback;
144 klass->set_selection_bounds = &set_selection_bounds_vfunc_callback;
145 klass->get_selection_bounds = &get_selection_bounds_vfunc_callback;
146 klass->set_position = &set_position_vfunc_callback;
147 klass->get_position = &get_position_vfunc_callback;
148 klass->insert_text = &insert_text_callback;
149 klass->delete_text = &delete_text_callback;
150 klass->changed = &changed_callback;
153 void Editable_Class::do_insert_text_vfunc_callback(GtkEditable* self, const gchar* text, gint length, gint* position)
155 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
156 Glib::ObjectBase::_get_current_wrapper((GObject*) self));
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
163 if(obj && obj->is_derived_())
165 try // Trap C++ exceptions which would normally be lost because this is a C callback.
167 // Call the virtual member method, which derived classes might override.
168 obj->insert_text_vfunc( Glib::ustring(text, text + length), *position);
172 Glib::exception_handlers_invoke();
177 BaseClassType *const base = static_cast<BaseClassType*>(
178 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
179 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
182 // Call the original underlying C function:
183 if(base && base->do_insert_text)
184 (*base->do_insert_text)( self, text, length, position);
188 void Editable_Class::do_delete_text_vfunc_callback(GtkEditable* self, gint start_pos, gint end_pos)
190 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
191 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
193 // Non-gtkmmproc-generated custom classes implicitly call the default
194 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
195 // generated classes can use this optimisation, which avoids the unnecessary
196 // parameter conversions if there is no possibility of the virtual function
198 if(obj && obj->is_derived_())
200 try // Trap C++ exceptions which would normally be lost because this is a C callback.
202 // Call the virtual member method, which derived classes might override.
203 obj->delete_text_vfunc(start_pos
209 Glib::exception_handlers_invoke();
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.
219 // Call the original underlying C function:
220 if(base && base->do_delete_text)
221 (*base->do_delete_text)(self, start_pos, end_pos);
225 gchar* Editable_Class::get_chars_vfunc_callback(GtkEditable* self, gint start_pos, gint end_pos)
227 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
228 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
230 // Non-gtkmmproc-generated custom classes implicitly call the default
231 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
232 // generated classes can use this optimisation, which avoids the unnecessary
233 // parameter conversions if there is no possibility of the virtual function
235 if(obj && obj->is_derived_())
237 try // Trap C++ exceptions which would normally be lost because this is a C callback.
239 // Call the virtual member method, which derived classes might override.
240 return g_strdup((obj->get_chars_vfunc(start_pos
246 Glib::exception_handlers_invoke();
251 BaseClassType *const base = static_cast<BaseClassType*>(
252 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
253 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
256 // Call the original underlying C function:
257 if(base && base->get_chars)
258 return (*base->get_chars)(self, start_pos, end_pos);
261 typedef gchar* RType;
265 void Editable_Class::set_selection_bounds_vfunc_callback(GtkEditable* self, gint start_pos, gint end_pos)
267 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
268 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
270 // Non-gtkmmproc-generated custom classes implicitly call the default
271 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
272 // generated classes can use this optimisation, which avoids the unnecessary
273 // parameter conversions if there is no possibility of the virtual function
275 if(obj && obj->is_derived_())
277 try // Trap C++ exceptions which would normally be lost because this is a C callback.
279 // Call the virtual member method, which derived classes might override.
280 obj->select_region_vfunc(start_pos
286 Glib::exception_handlers_invoke();
291 BaseClassType *const base = static_cast<BaseClassType*>(
292 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
293 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
296 // Call the original underlying C function:
297 if(base && base->set_selection_bounds)
298 (*base->set_selection_bounds)(self, start_pos, end_pos);
302 gboolean Editable_Class::get_selection_bounds_vfunc_callback(GtkEditable* self, gint* start_pos, gint* end_pos)
304 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
305 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
307 // Non-gtkmmproc-generated custom classes implicitly call the default
308 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
309 // generated classes can use this optimisation, which avoids the unnecessary
310 // parameter conversions if there is no possibility of the virtual function
312 if(obj && obj->is_derived_())
314 try // Trap C++ exceptions which would normally be lost because this is a C callback.
316 // Call the virtual member method, which derived classes might override.
317 return static_cast<int>(obj->get_selection_bounds_vfunc(*(start_pos)
323 Glib::exception_handlers_invoke();
328 BaseClassType *const base = static_cast<BaseClassType*>(
329 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
330 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
333 // Call the original underlying C function:
334 if(base && base->get_selection_bounds)
335 return (*base->get_selection_bounds)(self, start_pos, end_pos);
338 typedef gboolean RType;
342 void Editable_Class::set_position_vfunc_callback(GtkEditable* self, gint position)
344 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
345 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
347 // Non-gtkmmproc-generated custom classes implicitly call the default
348 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
349 // generated classes can use this optimisation, which avoids the unnecessary
350 // parameter conversions if there is no possibility of the virtual function
352 if(obj && obj->is_derived_())
354 try // Trap C++ exceptions which would normally be lost because this is a C callback.
356 // Call the virtual member method, which derived classes might override.
357 obj->set_position_vfunc(position
362 Glib::exception_handlers_invoke();
367 BaseClassType *const base = static_cast<BaseClassType*>(
368 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
369 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
372 // Call the original underlying C function:
373 if(base && base->set_position)
374 (*base->set_position)(self, position);
378 gint Editable_Class::get_position_vfunc_callback(GtkEditable* self)
380 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
381 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
383 // Non-gtkmmproc-generated custom classes implicitly call the default
384 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
385 // generated classes can use this optimisation, which avoids the unnecessary
386 // parameter conversions if there is no possibility of the virtual function
388 if(obj && obj->is_derived_())
390 try // Trap C++ exceptions which would normally be lost because this is a C callback.
392 // Call the virtual member method, which derived classes might override.
393 return obj->get_position_vfunc();
397 Glib::exception_handlers_invoke();
402 BaseClassType *const base = static_cast<BaseClassType*>(
403 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
404 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
407 // Call the original underlying C function:
408 if(base && base->get_position)
409 return (*base->get_position)(self);
417 void Editable_Class::insert_text_callback(GtkEditable* self, const gchar* text, gint length, gint* position)
419 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
420 Glib::ObjectBase::_get_current_wrapper((GObject*) self));
422 // Non-gtkmmproc-generated custom classes implicitly call the default
423 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
424 // generated classes can use this optimisation, which avoids the unnecessary
425 // parameter conversions if there is no possibility of the virtual function
427 if(obj && obj->is_derived_())
429 try // Trap C++ exceptions which would normally be lost because this is a C callback.
431 // Call the virtual member method, which derived classes might override.
432 obj->on_insert_text( Glib::ustring(text, text + length), position);
436 Glib::exception_handlers_invoke();
441 BaseClassType *const base = static_cast<BaseClassType*>(
442 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
443 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
446 // Call the original underlying C function:
447 if(base && base->insert_text)
448 (*base->insert_text)( self, text, length, position);
452 void Editable_Class::delete_text_callback(GtkEditable* self, gint start_pos, gint end_pos)
454 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
455 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
457 // Non-gtkmmproc-generated custom classes implicitly call the default
458 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
459 // generated classes can use this optimisation, which avoids the unnecessary
460 // parameter conversions if there is no possibility of the virtual function
462 if(obj && obj->is_derived_())
464 try // Trap C++ exceptions which would normally be lost because this is a C callback.
466 // Call the virtual member method, which derived classes might override.
467 obj->on_delete_text(start_pos
473 Glib::exception_handlers_invoke();
478 BaseClassType *const base = static_cast<BaseClassType*>(
479 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
480 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
483 // Call the original underlying C function:
484 if(base && base->delete_text)
485 (*base->delete_text)(self, start_pos, end_pos);
489 void Editable_Class::changed_callback(GtkEditable* self)
491 CppObjectType *const obj = dynamic_cast<CppObjectType*>(
492 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
494 // Non-gtkmmproc-generated custom classes implicitly call the default
495 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
496 // generated classes can use this optimisation, which avoids the unnecessary
497 // parameter conversions if there is no possibility of the virtual function
499 if(obj && obj->is_derived_())
501 try // Trap C++ exceptions which would normally be lost because this is a C callback.
503 // Call the virtual member method, which derived classes might override.
508 Glib::exception_handlers_invoke();
513 BaseClassType *const base = static_cast<BaseClassType*>(
514 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
515 g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
518 // Call the original underlying C function:
519 if(base && base->changed)
520 (*base->changed)(self);
525 Glib::ObjectBase* Editable_Class::wrap_new(GObject* object)
527 return new Editable((GtkEditable*)(object));
531 /* The implementation: */
535 Glib::Interface(editable_class_.init())
538 Editable::Editable(GtkEditable* castitem)
540 Glib::Interface((GObject*)(castitem))
543 Editable::~Editable()
547 void Editable::add_interface(GType gtype_implementer)
549 editable_class_.init().add_interface(gtype_implementer);
552 Editable::CppClassType Editable::editable_class_; // initialize static member
554 GType Editable::get_type()
556 return editable_class_.init().get_type();
559 GType Editable::get_base_type()
561 return gtk_editable_get_type();
565 void Editable::cut_clipboard()
567 gtk_editable_cut_clipboard(gobj());
570 void Editable::copy_clipboard()
572 gtk_editable_copy_clipboard(gobj());
575 void Editable::paste_clipboard()
577 gtk_editable_paste_clipboard(gobj());
580 void Editable::delete_selection()
582 gtk_editable_delete_selection(gobj());
585 void Editable::set_editable(bool is_editable)
587 gtk_editable_set_editable(gobj(), static_cast<int>(is_editable));
590 bool Editable::get_editable() const
592 return gtk_editable_get_editable(const_cast<GtkEditable*>(gobj()));
595 void Editable::insert_text(const Glib::ustring& text, int length, int& position)
597 gtk_editable_insert_text(gobj(), text.c_str(), length, &position);
600 void Editable::delete_text(int start_pos, int end_pos)
602 gtk_editable_delete_text(gobj(), start_pos, end_pos);
605 Glib::ustring Editable::get_chars(int start_pos, int end_pos) const
607 return Glib::convert_return_gchar_ptr_to_ustring(gtk_editable_get_chars(const_cast<GtkEditable*>(gobj()), start_pos, end_pos));
610 void Editable::select_region(int start_pos, int end_pos)
612 gtk_editable_select_region(gobj(), start_pos, end_pos);
615 bool Editable::get_selection_bounds(int& start_pos, int& end_pos) const
617 return gtk_editable_get_selection_bounds(const_cast<GtkEditable*>(gobj()), &start_pos, &end_pos);
620 void Editable::set_position(int position)
622 gtk_editable_set_position(gobj(), position);
625 int Editable::get_position() const
627 return gtk_editable_get_position(const_cast<GtkEditable*>(gobj()));
631 Glib::SignalProxy2< void,const Glib::ustring&,int* > Editable::signal_insert_text()
633 return Glib::SignalProxy2< void,const Glib::ustring&,int* >(this, &Editable_signal_insert_text_info);
636 Glib::SignalProxy2< void,int,int > Editable::signal_delete_text()
638 return Glib::SignalProxy2< void,int,int >(this, &Editable_signal_delete_text_info);
641 Glib::SignalProxy0< void > Editable::signal_changed()
643 return Glib::SignalProxy0< void >(this, &Editable_signal_changed_info);
647 void Gtk::Editable::on_insert_text(const Glib::ustring& text, int* position)
649 BaseClassType *const base = static_cast<BaseClassType*>(
650 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
651 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
654 if(base && base->insert_text)
655 (*base->insert_text)(gobj(),text.data(),text.bytes(),position);
658 void Gtk::Editable::on_delete_text(int start_pos, int end_pos)
660 BaseClassType *const base = static_cast<BaseClassType*>(
661 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
662 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
665 if(base && base->delete_text)
666 (*base->delete_text)(gobj(),start_pos,end_pos);
669 void Gtk::Editable::on_changed()
671 BaseClassType *const base = static_cast<BaseClassType*>(
672 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
673 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
676 if(base && base->changed)
677 (*base->changed)(gobj());
681 void Gtk::Editable::insert_text_vfunc(const Glib::ustring& text, int& position)
683 BaseClassType *const base = static_cast<BaseClassType*>(
684 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
685 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
688 if(base && base->do_insert_text)
689 (*base->do_insert_text)(gobj(),text.data(),text.bytes(),&position);
692 void Gtk::Editable::delete_text_vfunc(int start_pos, int end_pos)
694 BaseClassType *const base = static_cast<BaseClassType*>(
695 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
696 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
699 if(base && base->do_delete_text)
700 (*base->do_delete_text)(gobj(),start_pos,end_pos);
703 Glib::ustring Gtk::Editable::get_chars_vfunc(int start_pos, int end_pos) const
705 BaseClassType *const base = static_cast<BaseClassType*>(
706 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
707 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
710 if(base && base->get_chars)
711 return Glib::convert_const_gchar_ptr_to_ustring((*base->get_chars)(const_cast<GtkEditable*>(gobj()),start_pos,end_pos));
713 typedef Glib::ustring RType;
717 void Gtk::Editable::select_region_vfunc(int start_pos, int end_pos)
719 BaseClassType *const base = static_cast<BaseClassType*>(
720 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
721 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
724 if(base && base->set_selection_bounds)
725 (*base->set_selection_bounds)(gobj(),start_pos,end_pos);
728 bool Gtk::Editable::get_selection_bounds_vfunc(int& start_pos, int& end_pos) const
730 BaseClassType *const base = static_cast<BaseClassType*>(
731 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
732 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
735 if(base && base->get_selection_bounds)
736 return (*base->get_selection_bounds)(const_cast<GtkEditable*>(gobj()),&start_pos,&end_pos);
742 void Gtk::Editable::set_position_vfunc(int position)
744 BaseClassType *const base = static_cast<BaseClassType*>(
745 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
746 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
749 if(base && base->set_position)
750 (*base->set_position)(gobj(),position);
753 int Gtk::Editable::get_position_vfunc() const
755 BaseClassType *const base = static_cast<BaseClassType*>(
756 g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
757 g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
760 if(base && base->get_position)
761 return (*base->get_position)(const_cast<GtkEditable*>(gobj()));