// Generated by gtkmmproc -- DO NOT MODIFY!


#include <giomm/actiongroup.h>
#include <giomm/private/actiongroup_p.h>

// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-

/* Copyright (C) 2010 The giomm 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 <gio/gio.h>

namespace Gio
{

} // namespace Gio

namespace
{


static void ActionGroup_signal_action_added_callback(GActionGroup* self, const gchar* p0,void* data)
{
  using namespace Gio;
  typedef sigc::slot< void,const Glib::ustring& > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::convert_const_gchar_ptr_to_ustring(p0)
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo ActionGroup_signal_action_added_info =
{
  "action-added",
  (GCallback) &ActionGroup_signal_action_added_callback,
  (GCallback) &ActionGroup_signal_action_added_callback
};


static void ActionGroup_signal_action_enabled_changed_callback(GActionGroup* self, const gchar* p0,gboolean p1,void* data)
{
  using namespace Gio;
  typedef sigc::slot< void,const Glib::ustring&,bool > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::convert_const_gchar_ptr_to_ustring(p0)
, p1
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo ActionGroup_signal_action_enabled_changed_info =
{
  "action-enabled-changed",
  (GCallback) &ActionGroup_signal_action_enabled_changed_callback,
  (GCallback) &ActionGroup_signal_action_enabled_changed_callback
};


static void ActionGroup_signal_action_removed_callback(GActionGroup* self, const gchar* p0,void* data)
{
  using namespace Gio;
  typedef sigc::slot< void,const Glib::ustring& > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::convert_const_gchar_ptr_to_ustring(p0)
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo ActionGroup_signal_action_removed_info =
{
  "action-removed",
  (GCallback) &ActionGroup_signal_action_removed_callback,
  (GCallback) &ActionGroup_signal_action_removed_callback
};


static void ActionGroup_signal_action_state_changed_callback(GActionGroup* self, const gchar* p0,GVariant* p1,void* data)
{
  using namespace Gio;
  typedef sigc::slot< void,const Glib::ustring&,const Glib::VariantBase& > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::convert_const_gchar_ptr_to_ustring(p0)
, Glib::wrap(p1, true)
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo ActionGroup_signal_action_state_changed_info =
{
  "action-state-changed",
  (GCallback) &ActionGroup_signal_action_state_changed_callback,
  (GCallback) &ActionGroup_signal_action_state_changed_callback
};


} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Gio::ActionGroup> wrap(GActionGroup* object, bool take_copy)
{
  return Glib::RefPtr<Gio::ActionGroup>( dynamic_cast<Gio::ActionGroup*> (Glib::wrap_auto_interface<Gio::ActionGroup> ((GObject*)(object), take_copy)) );
  //We use dynamic_cast<> in case of multiple inheritance.
}

} // namespace Glib


namespace Gio
{


/* The *_Class implementation: */

const Glib::Interface_Class& ActionGroup_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_ = &ActionGroup_Class::iface_init_function;

    // We can not derive from another interface, and it is not necessary anyway.
    gtype_ = g_action_group_get_type();
  }

  return *this;
}

void ActionGroup_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->action_added = &action_added_callback;
  klass->action_enabled_changed = &action_enabled_changed_callback;
  klass->action_removed = &action_removed_callback;
  klass->action_state_changed = &action_state_changed_callback;
}


void ActionGroup_Class::action_added_callback(GActionGroup* self, const gchar* p0)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      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<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        obj->on_action_added(Glib::convert_const_gchar_ptr_to_ustring(p0)
);
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  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->action_added)
    (*base->action_added)(self, p0);
}
void ActionGroup_Class::action_enabled_changed_callback(GActionGroup* self, const gchar* p0, gboolean p1)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      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<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        obj->on_action_enabled_changed(Glib::convert_const_gchar_ptr_to_ustring(p0)
, p1
);
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  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->action_enabled_changed)
    (*base->action_enabled_changed)(self, p0, p1);
}
void ActionGroup_Class::action_removed_callback(GActionGroup* self, const gchar* p0)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      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<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        obj->on_action_removed(Glib::convert_const_gchar_ptr_to_ustring(p0)
);
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  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->action_removed)
    (*base->action_removed)(self, p0);
}
void ActionGroup_Class::action_state_changed_callback(GActionGroup* self, const gchar* p0, GVariant* p1)
{
  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
      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<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        obj->on_action_state_changed(Glib::convert_const_gchar_ptr_to_ustring(p0)
, Glib::wrap(p1, true)
);
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  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->action_state_changed)
    (*base->action_state_changed)(self, p0, p1);
}


Glib::ObjectBase* ActionGroup_Class::wrap_new(GObject* object)
{
  return new ActionGroup((GActionGroup*)(object));
}


/* The implementation: */

ActionGroup::ActionGroup()
:
  Glib::Interface(actiongroup_class_.init())
{}

ActionGroup::ActionGroup(GActionGroup* castitem)
:
  Glib::Interface((GObject*)(castitem))
{}

ActionGroup::ActionGroup(const Glib::Interface_Class& interface_class)
: Glib::Interface(interface_class)
{
}

ActionGroup::~ActionGroup()
{}

// static
void ActionGroup::add_interface(GType gtype_implementer)
{
  actiongroup_class_.init().add_interface(gtype_implementer);
}

ActionGroup::CppClassType ActionGroup::actiongroup_class_; // initialize static member

GType ActionGroup::get_type()
{
  return actiongroup_class_.init().get_type();
}


GType ActionGroup::get_base_type()
{
  return g_action_group_get_type();
}


bool ActionGroup::has_action(const Glib::ustring& action_name) const
{
  return g_action_group_has_action(const_cast<GActionGroup*>(gobj()), action_name.c_str());
}

Glib::StringArrayHandle ActionGroup::list_actions() const
{
  return Glib::StringArrayHandle(g_action_group_list_actions(const_cast<GActionGroup*>(gobj())), Glib::OWNERSHIP_DEEP);
}

bool ActionGroup::get_action_enabled(const Glib::ustring& action_name) const
{
  return g_action_group_get_action_enabled(const_cast<GActionGroup*>(gobj()), action_name.c_str());
}

void ActionGroup::change_action_state(const Glib::ustring& action_name, const Glib::VariantBase& value)
{
g_action_group_change_action_state(gobj(), action_name.c_str(), const_cast<GVariant*>((value).gobj())); 
}

void ActionGroup::activate_action(const Glib::ustring& action_name, const Glib::VariantBase& parameter)
{
g_action_group_activate_action(gobj(), action_name.c_str(), const_cast<GVariant*>((parameter).gobj())); 
}

void ActionGroup::action_added(const Glib::ustring& action_name)
{
g_action_group_action_added(gobj(), action_name.c_str()); 
}

void ActionGroup::action_removed(const Glib::ustring& action_name)
{
g_action_group_action_removed(gobj(), action_name.c_str()); 
}

void ActionGroup::action_enabled_changed(const Glib::ustring& action_name, bool enabled)
{
g_action_group_action_enabled_changed(gobj(), action_name.c_str(), static_cast<int>(enabled)); 
}

void ActionGroup::action_state_changed(const Glib::ustring& action_name, const Glib::VariantBase& state)
{
g_action_group_action_state_changed(gobj(), action_name.c_str(), const_cast<GVariant*>((state).gobj())); 
}


Glib::SignalProxy1< void,const Glib::ustring& > ActionGroup::signal_action_added()
{
  return Glib::SignalProxy1< void,const Glib::ustring& >(this, &ActionGroup_signal_action_added_info);
}


Glib::SignalProxy2< void,const Glib::ustring&,bool > ActionGroup::signal_action_enabled_changed()
{
  return Glib::SignalProxy2< void,const Glib::ustring&,bool >(this, &ActionGroup_signal_action_enabled_changed_info);
}


Glib::SignalProxy1< void,const Glib::ustring& > ActionGroup::signal_action_removed()
{
  return Glib::SignalProxy1< void,const Glib::ustring& >(this, &ActionGroup_signal_action_removed_info);
}


Glib::SignalProxy2< void,const Glib::ustring&,const Glib::VariantBase& > ActionGroup::signal_action_state_changed()
{
  return Glib::SignalProxy2< void,const Glib::ustring&,const Glib::VariantBase& >(this, &ActionGroup_signal_action_state_changed_info);
}


void Gio::ActionGroup::on_action_added(const Glib::ustring& action_name)
{
  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->action_added)
    (*base->action_added)(gobj(),action_name.c_str());
}
void Gio::ActionGroup::on_action_enabled_changed(const Glib::ustring& action_name, bool enabled)
{
  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->action_enabled_changed)
    (*base->action_enabled_changed)(gobj(),action_name.c_str(),static_cast<int>(enabled));
}
void Gio::ActionGroup::on_action_removed(const Glib::ustring& action_name)
{
  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->action_removed)
    (*base->action_removed)(gobj(),action_name.c_str());
}
void Gio::ActionGroup::on_action_state_changed(const Glib::ustring& action_name, const Glib::VariantBase& value)
{
  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->action_state_changed)
    (*base->action_state_changed)(gobj(),action_name.c_str(),const_cast<GVariant*>((value).gobj()));
}


} // namespace Gio


