// Generated by gmmproc 2.45.3 -- DO NOT MODIFY! #undef GTK_DISABLE_DEPRECATED #include #include #include // -*- c++ -*- /* $Id: action.ccg,v 1.11 2006/05/10 20:59:27 murrayc Exp $ */ /* Copyright 2003 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 #include #include #include #include #include typedef Gtk::Action Action; namespace Gtk { Action::Action(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const Glib::ustring& tooltip) : // Mark this class as non-derived to allow C++ vfuncs to be skipped. Glib::ObjectBase(0), Glib::Object(Glib::ConstructParams(action_class_.init(), "name",name.c_str(),"stock_id",stock_id.get_c_str(),"label",(label.empty() ? 0 : label.c_str()),"tooltip",(tooltip.empty() ? 0 : tooltip.c_str()), static_cast(0))) {} Action::Action(const Glib::ustring& name, const Glib::ustring& icon_name, const Glib::ustring& label, const Glib::ustring& tooltip) : // Mark this class as non-derived to allow C++ vfuncs to be skipped. Glib::ObjectBase(0), Glib::Object(Glib::ConstructParams(action_class_.init(), "name",name.c_str(),"icon_name",icon_name.c_str(),"label",(label.empty() ? 0 : label.c_str()),"tooltip",(tooltip.empty() ? 0 : tooltip.c_str()), static_cast(0))) {} Glib::RefPtr Action::create(const Glib::ustring& name, const Glib::ustring& label, const Glib::ustring& tooltip) { return Glib::RefPtr( new Action(name, Gtk::StockID(), label, tooltip) ); } Glib::RefPtr Action::create(const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const Glib::ustring& tooltip) { return Glib::RefPtr( new Action(name, stock_id, label, tooltip) ); } Glib::RefPtr Action::create_with_icon_name(const Glib::ustring& name, const Glib::ustring& icon_name, const Glib::ustring& label, const Glib::ustring& tooltip) { return Glib::RefPtr( new Action(name, icon_name, label, tooltip) ); } } // namespace Gtk namespace { static const Glib::SignalProxyInfo Action_signal_activate_info = { "activate", (GCallback) &Glib::SignalProxyNormal::slot0_void_callback, (GCallback) &Glib::SignalProxyNormal::slot0_void_callback }; } // anonymous namespace namespace Glib { Glib::RefPtr wrap(GtkAction* object, bool take_copy) { return Glib::RefPtr( dynamic_cast (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::Class& Action_Class::init() { if(!gtype_) // create the GType if necessary { // Glib::Class has to know the class init function to clone custom types. class_init_func_ = &Action_Class::class_init_function; // This is actually just optimized away, apparently with no harm. // Make sure that the parent type has been created. //CppClassParent::CppObjectType::get_type(); // Create the wrapper type, with the same class/instance size as the base type. register_derived_type(gtk_action_get_type()); // Add derived versions of interfaces, if the C type implements any interfaces: } return *this; } void Action_Class::class_init_function(void* g_class, void* class_data) { BaseClassType *const klass = static_cast(g_class); CppClassParent::class_init_function(klass, class_data); klass->create_menu_item = &create_menu_item_vfunc_callback; klass->create_tool_item = &create_tool_item_vfunc_callback; klass->connect_proxy = &connect_proxy_vfunc_callback; klass->disconnect_proxy = &disconnect_proxy_vfunc_callback; klass->activate = &activate_callback; } GtkWidget* Action_Class::create_menu_item_vfunc_callback(GtkAction* self) { 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. return (GtkWidget*)Glib::unwrap(obj->create_menu_item_vfunc()); } catch(...) { Glib::exception_handlers_invoke(); } } } BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). ); // Call the original underlying C function: if(base && base->create_menu_item) { GtkWidget* retval = (*base->create_menu_item)(self); return retval; } typedef GtkWidget* RType; return RType(); } GtkWidget* Action_Class::create_tool_item_vfunc_callback(GtkAction* self) { 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. return (GtkWidget*)Glib::unwrap(obj->create_tool_item_vfunc()); } catch(...) { Glib::exception_handlers_invoke(); } } } BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). ); // Call the original underlying C function: if(base && base->create_tool_item) { GtkWidget* retval = (*base->create_tool_item)(self); return retval; } typedef GtkWidget* RType; return RType(); } void Action_Class::connect_proxy_vfunc_callback(GtkAction* self, GtkWidget* proxy) { 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->connect_proxy_vfunc(Glib::wrap(proxy) ); return; } catch(...) { Glib::exception_handlers_invoke(); } } } BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). ); // Call the original underlying C function: if(base && base->connect_proxy) { (*base->connect_proxy)(self, proxy); } } void Action_Class::disconnect_proxy_vfunc_callback(GtkAction* self, GtkWidget* proxy) { 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->disconnect_proxy_vfunc(Glib::wrap(proxy) ); return; } catch(...) { Glib::exception_handlers_invoke(); } } } BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). ); // Call the original underlying C function: if(base && base->disconnect_proxy) { (*base->disconnect_proxy)(self, proxy); } } void Action_Class::activate_callback(GtkAction* self) { 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->on_activate(); return; } catch(...) { Glib::exception_handlers_invoke(); } } } BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). ); // Call the original underlying C function: if(base && base->activate) (*base->activate)(self); } Glib::ObjectBase* Action_Class::wrap_new(GObject* object) { return new Action((GtkAction*)object); } /* The implementation: */ GtkAction* Action::gobj_copy() { reference(); return gobj(); } Action::Action(const Glib::ConstructParams& construct_params) : Glib::Object(construct_params) { } Action::Action(GtkAction* castitem) : Glib::Object((GObject*)(castitem)) {} Action::~Action() {} Action::CppClassType Action::action_class_; // initialize static member GType Action::get_type() { return action_class_.init().get_type(); } GType Action::get_base_type() { return gtk_action_get_type(); } Action::Action() : // Mark this class as non-derived to allow C++ vfuncs to be skipped. Glib::ObjectBase(0), Glib::Object(Glib::ConstructParams(action_class_.init())) { } Glib::RefPtr Action::create() { return Glib::RefPtr( new Action() ); } Glib::ustring Action::get_name() const { return Glib::convert_const_gchar_ptr_to_ustring(gtk_action_get_name(const_cast(gobj()))); } bool Action::is_sensitive() const { return gtk_action_is_sensitive(const_cast(gobj())); } bool Action::get_sensitive() const { return gtk_action_get_sensitive(const_cast(gobj())); } void Action::set_sensitive(bool sensitive) { gtk_action_set_sensitive(gobj(), static_cast(sensitive)); } bool Action::is_visible() const { return gtk_action_is_visible(const_cast(gobj())); } bool Action::get_visible() const { return gtk_action_get_visible(const_cast(gobj())); } void Action::set_visible(bool visible) { gtk_action_set_visible(gobj(), static_cast(visible)); } void Action::activate() { gtk_action_activate(gobj()); } Image* Action::create_icon(IconSize icon_size) { return Glib::wrap((GtkImage*)(gtk_action_create_icon(gobj(), static_cast(int(icon_size))))); } MenuItem* Action::create_menu_item() { return Glib::wrap((GtkMenuItem*)(gtk_action_create_menu_item(gobj()))); } ToolItem* Action::create_tool_item() { return Glib::wrap((GtkToolItem*)(gtk_action_create_tool_item(gobj()))); } Menu* Action::create_menu() { return Glib::wrap((GtkMenu*)(gtk_action_create_menu(gobj()))); } void Action::connect_proxy(Widget& proxy) { gtk_action_connect_proxy(gobj(), (proxy).gobj()); } void Action::disconnect_proxy(Widget& proxy) { gtk_action_disconnect_proxy(gobj(), (proxy).gobj()); } Glib::SListHandle Action::get_proxies() { return Glib::SListHandle(gtk_action_get_proxies(gobj()), Glib::OWNERSHIP_NONE); } Glib::SListHandle Action::get_proxies() const { return Glib::SListHandle(gtk_action_get_proxies(const_cast(gobj())), Glib::OWNERSHIP_NONE); } void Action::connect_accelerator() { gtk_action_connect_accelerator(gobj()); } void Action::disconnect_accelerator() { gtk_action_disconnect_accelerator(gobj()); } Glib::ustring Action::get_accel_path() const { return Glib::convert_const_gchar_ptr_to_ustring(gtk_action_get_accel_path(const_cast(gobj()))); } void Action::set_accel_path(const Glib::ustring& accel_path) { gtk_action_set_accel_path(gobj(), accel_path.c_str()); } void Action::set_accel_group(const Glib::RefPtr& accel_group) { gtk_action_set_accel_group(gobj(), Glib::unwrap(accel_group)); } void Action::set_label(const Glib::ustring& label) { gtk_action_set_label(gobj(), label.c_str()); } Glib::ustring Action::get_label() const { return Glib::convert_const_gchar_ptr_to_ustring(gtk_action_get_label(const_cast(gobj()))); } void Action::set_short_label(const Glib::ustring& short_label) { gtk_action_set_short_label(gobj(), short_label.c_str()); } Glib::ustring Action::get_short_label() const { return Glib::convert_const_gchar_ptr_to_ustring(gtk_action_get_short_label(const_cast(gobj()))); } void Action::set_tooltip(const Glib::ustring& tooltip) { gtk_action_set_tooltip(gobj(), tooltip.c_str()); } Glib::ustring Action::get_tooltip() const { return Glib::convert_const_gchar_ptr_to_ustring(gtk_action_get_tooltip(const_cast(gobj()))); } void Action::set_stock_id(const StockID& stock_id) { gtk_action_set_stock_id(gobj(), (stock_id).get_c_str()); } StockID Action::get_stock_id() const { return StockID(gtk_action_get_stock_id(const_cast(gobj()))); } void Action::set_gicon(const Glib::RefPtr& icon) { gtk_action_set_gicon(gobj(), const_cast(Glib::unwrap(icon))); } Glib::RefPtr Action::get_gicon() { Glib::RefPtr retvalue = Glib::wrap(gtk_action_get_gicon(gobj())); if(retvalue) retvalue->reference(); //The function does not do a ref for us. return retvalue; } Glib::RefPtr Action::get_gicon() const { return const_cast(this)->get_gicon(); } void Action::set_icon_name(const Glib::ustring& icon_name) { gtk_action_set_icon_name(gobj(), icon_name.c_str()); } Glib::ustring Action::get_icon_name() const { return Glib::convert_const_gchar_ptr_to_ustring(gtk_action_get_icon_name(const_cast(gobj()))); } void Action::set_visible_horizontal(bool visible_horizontal) { gtk_action_set_visible_horizontal(gobj(), static_cast(visible_horizontal)); } bool Action::get_visible_horizontal() const { return gtk_action_get_visible_horizontal(const_cast(gobj())); } void Action::set_visible_vertical(bool visible_vertical) { gtk_action_set_visible_vertical(gobj(), static_cast(visible_vertical)); } bool Action::get_visible_vertical() const { return gtk_action_get_visible_vertical(const_cast(gobj())); } void Action::set_is_important(bool is_important) { gtk_action_set_is_important(gobj(), static_cast(is_important)); } bool Action::get_is_important() const { return gtk_action_get_is_important(const_cast(gobj())); } void Action::set_always_show_image(bool always_show) { gtk_action_set_always_show_image(gobj(), static_cast(always_show)); } bool Action::get_always_show_image() const { return gtk_action_get_always_show_image(const_cast(gobj())); } void Action::block_activate() { gtk_action_block_activate(gobj()); } void Action::unblock_activate() { gtk_action_unblock_activate(gobj()); } void Action::block_activate_from(Widget& proxy) { gtk_action_block_activate_from(gobj(), (proxy).gobj()); } void Action::unblock_activate_from(Widget& proxy) { gtk_action_unblock_activate_from(gobj(), (proxy).gobj()); } Glib::SignalProxy0< void > Action::signal_activate() { return Glib::SignalProxy0< void >(this, &Action_signal_activate_info); } Glib::PropertyProxy_ReadOnly< Glib::ustring > Action::property_name() const { return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "name"); } Glib::PropertyProxy< Glib::ustring > Action::property_label() { return Glib::PropertyProxy< Glib::ustring >(this, "label"); } Glib::PropertyProxy_ReadOnly< Glib::ustring > Action::property_label() const { return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "label"); } Glib::PropertyProxy< Glib::ustring > Action::property_short_label() { return Glib::PropertyProxy< Glib::ustring >(this, "short-label"); } Glib::PropertyProxy_ReadOnly< Glib::ustring > Action::property_short_label() const { return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "short-label"); } Glib::PropertyProxy< Glib::ustring > Action::property_tooltip() { return Glib::PropertyProxy< Glib::ustring >(this, "tooltip"); } Glib::PropertyProxy_ReadOnly< Glib::ustring > Action::property_tooltip() const { return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "tooltip"); } Glib::PropertyProxy< StockID > Action::property_stock_id() { return Glib::PropertyProxy< StockID >(this, "stock-id"); } Glib::PropertyProxy_ReadOnly< StockID > Action::property_stock_id() const { return Glib::PropertyProxy_ReadOnly< StockID >(this, "stock-id"); } Glib::PropertyProxy< Glib::RefPtr > Action::property_gicon() { return Glib::PropertyProxy< Glib::RefPtr >(this, "gicon"); } Glib::PropertyProxy_ReadOnly< Glib::RefPtr > Action::property_gicon() const { return Glib::PropertyProxy_ReadOnly< Glib::RefPtr >(this, "gicon"); } Glib::PropertyProxy< Glib::ustring > Action::property_icon_name() { return Glib::PropertyProxy< Glib::ustring >(this, "icon-name"); } Glib::PropertyProxy_ReadOnly< Glib::ustring > Action::property_icon_name() const { return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "icon-name"); } Glib::PropertyProxy< bool > Action::property_visible_horizontal() { return Glib::PropertyProxy< bool >(this, "visible-horizontal"); } Glib::PropertyProxy_ReadOnly< bool > Action::property_visible_horizontal() const { return Glib::PropertyProxy_ReadOnly< bool >(this, "visible-horizontal"); } Glib::PropertyProxy< bool > Action::property_visible_vertical() { return Glib::PropertyProxy< bool >(this, "visible-vertical"); } Glib::PropertyProxy_ReadOnly< bool > Action::property_visible_vertical() const { return Glib::PropertyProxy_ReadOnly< bool >(this, "visible-vertical"); } Glib::PropertyProxy< bool > Action::property_visible_overflown() { return Glib::PropertyProxy< bool >(this, "visible-overflown"); } Glib::PropertyProxy_ReadOnly< bool > Action::property_visible_overflown() const { return Glib::PropertyProxy_ReadOnly< bool >(this, "visible-overflown"); } Glib::PropertyProxy< bool > Action::property_is_important() { return Glib::PropertyProxy< bool >(this, "is-important"); } Glib::PropertyProxy_ReadOnly< bool > Action::property_is_important() const { return Glib::PropertyProxy_ReadOnly< bool >(this, "is-important"); } Glib::PropertyProxy< bool > Action::property_hide_if_empty() { return Glib::PropertyProxy< bool >(this, "hide-if-empty"); } Glib::PropertyProxy_ReadOnly< bool > Action::property_hide_if_empty() const { return Glib::PropertyProxy_ReadOnly< bool >(this, "hide-if-empty"); } Glib::PropertyProxy< bool > Action::property_sensitive() { return Glib::PropertyProxy< bool >(this, "sensitive"); } Glib::PropertyProxy_ReadOnly< bool > Action::property_sensitive() const { return Glib::PropertyProxy_ReadOnly< bool >(this, "sensitive"); } Glib::PropertyProxy< bool > Action::property_visible() { return Glib::PropertyProxy< bool >(this, "visible"); } Glib::PropertyProxy_ReadOnly< bool > Action::property_visible() const { return Glib::PropertyProxy_ReadOnly< bool >(this, "visible"); } Glib::PropertyProxy< Glib::RefPtr > Action::property_action_group() { return Glib::PropertyProxy< Glib::RefPtr >(this, "action-group"); } Glib::PropertyProxy_ReadOnly< Glib::RefPtr > Action::property_action_group() const { return Glib::PropertyProxy_ReadOnly< Glib::RefPtr >(this, "action-group"); } Glib::PropertyProxy< bool > Action::property_always_show_image() { return Glib::PropertyProxy< bool >(this, "always-show-image"); } Glib::PropertyProxy_ReadOnly< bool > Action::property_always_show_image() const { return Glib::PropertyProxy_ReadOnly< bool >(this, "always-show-image"); } void Gtk::Action::on_activate() { BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). ); if(base && base->activate) (*base->activate)(gobj()); } Widget* Gtk::Action::create_menu_item_vfunc() { BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). ); if(base && base->create_menu_item) { Widget* retval(Glib::wrap((*base->create_menu_item)(gobj()))); return retval; } typedef Widget* RType; return RType(); } Widget* Gtk::Action::create_tool_item_vfunc() { BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). ); if(base && base->create_tool_item) { Widget* retval(Glib::wrap((*base->create_tool_item)(gobj()))); return retval; } typedef Widget* RType; return RType(); } void Gtk::Action::connect_proxy_vfunc(Widget* proxy) { BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). ); if(base && base->connect_proxy) { (*base->connect_proxy)(gobj(),(GtkWidget*)Glib::unwrap(proxy)); } } void Gtk::Action::disconnect_proxy_vfunc(Widget* proxy) { BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). ); if(base && base->disconnect_proxy) { (*base->disconnect_proxy)(gobj(),(GtkWidget*)Glib::unwrap(proxy)); } } } // namespace Gtk