diff options
Diffstat (limited to 'libs/gtkmm2/gtk/gtkmm/celleditable.cc')
-rw-r--r-- | libs/gtkmm2/gtk/gtkmm/celleditable.cc | 307 |
1 files changed, 307 insertions, 0 deletions
diff --git a/libs/gtkmm2/gtk/gtkmm/celleditable.cc b/libs/gtkmm2/gtk/gtkmm/celleditable.cc new file mode 100644 index 0000000000..2f0d2a5b1b --- /dev/null +++ b/libs/gtkmm2/gtk/gtkmm/celleditable.cc @@ -0,0 +1,307 @@ +// Generated by gtkmmproc -- DO NOT MODIFY! + +#include <gtkmm/celleditable.h> +#include <gtkmm/private/celleditable_p.h> + +// -*- c++ -*- +/* $Id$ */ + +/* Copyright 1998-2002 The gtkmm Development Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gtk/gtkcelleditable.h> + + +namespace +{ + +const Glib::SignalProxyInfo CellEditable_signal_editing_done_info = +{ + "editing_done", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + + +const Glib::SignalProxyInfo CellEditable_signal_remove_widget_info = +{ + "remove_widget", + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, + (GCallback) &Glib::SignalProxyNormal::slot0_void_callback +}; + +} // anonymous namespace + + +namespace Glib +{ + +Glib::RefPtr<Gtk::CellEditable> wrap(GtkCellEditable* object, bool take_copy) +{ + return Glib::RefPtr<Gtk::CellEditable>( dynamic_cast<Gtk::CellEditable*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); + //We use dynamic_cast<> in case of multiple inheritance. +} + +} // namespace Glib + + +namespace Gtk +{ + + +/* The *_Class implementation: */ + +const Glib::Interface_Class& CellEditable_Class::init() +{ + if(!gtype_) // create the GType if necessary + { + // Glib::Interface_Class has to know the interface init function + // in order to add interfaces to implementing types. + class_init_func_ = &CellEditable_Class::iface_init_function; + + // We can not derive from another interface, and it is not necessary anyway. + gtype_ = gtk_cell_editable_get_type(); + } + + return *this; +} + +void CellEditable_Class::iface_init_function(void* g_iface, void*) +{ + BaseClassType *const klass = static_cast<BaseClassType*>(g_iface); + + //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect. + //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc + g_assert(klass != 0); + + klass->start_editing = &start_editing_vfunc_callback; + klass->editing_done = &editing_done_callback; + klass->remove_widget = &remove_widget_callback; +} + +void CellEditable_Class::start_editing_vfunc_callback(GtkCellEditable* self, GdkEvent* event) +{ + CppObjectType *const obj = dynamic_cast<CppObjectType*>( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->start_editing_vfunc(event); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->start_editing) + (*base->start_editing)(self, event); + } +} + + +void CellEditable_Class::editing_done_callback(GtkCellEditable* self) +{ + CppObjectType *const obj = dynamic_cast<CppObjectType*>( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_editing_done(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->editing_done) + (*base->editing_done)(self); + } +} + +void CellEditable_Class::remove_widget_callback(GtkCellEditable* self) +{ + CppObjectType *const obj = dynamic_cast<CppObjectType*>( + Glib::ObjectBase::_get_current_wrapper((GObject*)self)); + + // Non-gtkmmproc-generated custom classes implicitly call the default + // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- + // generated classes can use this optimisation, which avoids the unnecessary + // parameter conversions if there is no possibility of the virtual function + // being overridden: + if(obj && obj->is_derived_()) + { + try // Trap C++ exceptions which would normally be lost because this is a C callback. + { + // Call the virtual member method, which derived classes might override. + obj->on_remove_widget(); + } + catch(...) + { + Glib::exception_handlers_invoke(); + } + } + else + { + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface. +) ); + + // Call the original underlying C function: + if(base && base->remove_widget) + (*base->remove_widget)(self); + } +} + + +Glib::ObjectBase* CellEditable_Class::wrap_new(GObject* object) +{ + return new CellEditable((GtkCellEditable*)(object)); +} + + +/* The implementation: */ + +CellEditable::CellEditable() +: + Glib::Interface(celleditable_class_.init()) +{} + +CellEditable::CellEditable(GtkCellEditable* castitem) +: + Glib::Interface((GObject*)(castitem)) +{} + +CellEditable::~CellEditable() +{} + +// static +void CellEditable::add_interface(GType gtype_implementer) +{ + celleditable_class_.init().add_interface(gtype_implementer); +} + +CellEditable::CppClassType CellEditable::celleditable_class_; // initialize static member + +GType CellEditable::get_type() +{ + return celleditable_class_.init().get_type(); +} + +GType CellEditable::get_base_type() +{ + return gtk_cell_editable_get_type(); +} + + +void CellEditable::start_editing(GdkEvent* event) +{ + gtk_cell_editable_start_editing(gobj(), event); +} + +void CellEditable::editing_done() +{ + gtk_cell_editable_editing_done(gobj()); +} + +void CellEditable::remove_widget() +{ + gtk_cell_editable_remove_widget(gobj()); +} + + +Glib::SignalProxy0< void > CellEditable::signal_editing_done() +{ + return Glib::SignalProxy0< void >(this, &CellEditable_signal_editing_done_info); +} + +Glib::SignalProxy0< void > CellEditable::signal_remove_widget() +{ + return Glib::SignalProxy0< void >(this, &CellEditable_signal_remove_widget_info); +} + + +void Gtk::CellEditable::on_editing_done() +{ + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->editing_done) + (*base->editing_done)(gobj()); +} + +void Gtk::CellEditable::on_remove_widget() +{ + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->remove_widget) + (*base->remove_widget)(gobj()); +} + + +void Gtk::CellEditable::start_editing_vfunc(GdkEvent* event) +{ + BaseClassType *const base = static_cast<BaseClassType*>( + g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface). +g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface. +) ); + + if(base && base->start_editing) + (*base->start_editing)(gobj(),event); +} + + +} // namespace Gtk + + |