// Generated by gmmproc 2.45.3 -- DO NOT MODIFY! #include #include #include // -*- c++ -*- /* $Id: activatable.ccg,v 1.1 2003/01/21 13:38:48 murrayc Exp $ */ /* Copyright 2009 The gtkmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include namespace { } // anonymous namespace namespace Glib { Glib::RefPtr wrap(GtkActivatable* object, bool take_copy) { return Glib::RefPtr( dynamic_cast (Glib::wrap_auto_interface ((GObject*)(object), take_copy)) ); //We use dynamic_cast<> in case of multiple inheritance. } } // namespace Glib namespace Gtk { /* The *_Class implementation: */ const Glib::Interface_Class& Activatable_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_ = &Activatable_Class::iface_init_function; // We can not derive from another interface, and it is not necessary anyway. gtype_ = gtk_activatable_get_type(); } return *this; } void Activatable_Class::iface_init_function(void* g_iface, void*) { BaseClassType *const klass = static_cast(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->update = &update_vfunc_callback; klass->sync_action_properties = &sync_action_properties_vfunc_callback; } void Activatable_Class::update_vfunc_callback(GtkActivatable* self, GtkAction* action, const gchar* property_name) { Glib::ObjectBase *const obj_base = static_cast( 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_base && obj_base->is_derived_()) { CppObjectType *const obj = dynamic_cast(obj_base); if(obj) // This can be NULL during destruction. { 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->update_vfunc(Glib::wrap(action, true) , Glib::convert_const_gchar_ptr_to_ustring(property_name) ); return; } catch(...) { Glib::exception_handlers_invoke(); } } } BaseClassType *const base = static_cast( 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->update) { (*base->update)(self, action, property_name); } } void Activatable_Class::sync_action_properties_vfunc_callback(GtkActivatable* self, GtkAction* action) { Glib::ObjectBase *const obj_base = static_cast( 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_base && obj_base->is_derived_()) { CppObjectType *const obj = dynamic_cast(obj_base); if(obj) // This can be NULL during destruction. { 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->sync_action_properties_vfunc(Glib::wrap(action, true) ); return; } catch(...) { Glib::exception_handlers_invoke(); } } } BaseClassType *const base = static_cast( 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->sync_action_properties) { (*base->sync_action_properties)(self, action); } } Glib::ObjectBase* Activatable_Class::wrap_new(GObject* object) { return new Activatable((GtkActivatable*)(object)); } /* The implementation: */ Activatable::Activatable() : Glib::Interface(activatable_class_.init()) {} Activatable::Activatable(GtkActivatable* castitem) : Glib::Interface((GObject*)(castitem)) {} Activatable::Activatable(const Glib::Interface_Class& interface_class) : Glib::Interface(interface_class) { } Activatable::~Activatable() {} // static void Activatable::add_interface(GType gtype_implementer) { activatable_class_.init().add_interface(gtype_implementer); } Activatable::CppClassType Activatable::activatable_class_; // initialize static member GType Activatable::get_type() { return activatable_class_.init().get_type(); } GType Activatable::get_base_type() { return gtk_activatable_get_type(); } void Activatable::do_set_related_action(const Glib::RefPtr& action) { gtk_activatable_do_set_related_action(gobj(), Glib::unwrap(action)); } Glib::RefPtr Activatable::get_related_action() { Glib::RefPtr retvalue = Glib::wrap(gtk_activatable_get_related_action(gobj())); if(retvalue) retvalue->reference(); //The function does not do a ref for us. return retvalue; } Glib::RefPtr Activatable::get_related_action() const { return const_cast(this)->get_related_action(); } bool Activatable::get_use_action_appearance() const { return gtk_activatable_get_use_action_appearance(const_cast(gobj())); } void Activatable::sync_action_properties(const Glib::RefPtr& action) { gtk_activatable_sync_action_properties(gobj(), Glib::unwrap(action)); } void Activatable::set_related_action(const Glib::RefPtr& action) { gtk_activatable_set_related_action(gobj(), Glib::unwrap(action)); } void Activatable::set_use_action_appearance(bool use_appearance) { gtk_activatable_set_use_action_appearance(gobj(), static_cast(use_appearance)); } Glib::PropertyProxy< Glib::RefPtr > Activatable::property_related_action() { return Glib::PropertyProxy< Glib::RefPtr >(this, "related-action"); } Glib::PropertyProxy_ReadOnly< Glib::RefPtr > Activatable::property_related_action() const { return Glib::PropertyProxy_ReadOnly< Glib::RefPtr >(this, "related-action"); } Glib::PropertyProxy< bool > Activatable::property_use_action_appearance() { return Glib::PropertyProxy< bool >(this, "use-action-appearance"); } Glib::PropertyProxy_ReadOnly< bool > Activatable::property_use_action_appearance() const { return Glib::PropertyProxy_ReadOnly< bool >(this, "use-action-appearance"); } void Gtk::Activatable::update_vfunc(const Glib::RefPtr& action, const Glib::ustring& property_name) { BaseClassType *const base = static_cast( 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->update) { (*base->update)(gobj(),Glib::unwrap(action),property_name.c_str()); } } void Gtk::Activatable::sync_action_properties_vfunc(const Glib::RefPtr& action) { BaseClassType *const base = static_cast( 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->sync_action_properties) { (*base->sync_action_properties)(gobj(),Glib::unwrap(action)); } } } // namespace Gtk