// Generated by gtkmmproc -- DO NOT MODIFY!


#include <glibmm.h>

#include <atkmm/action.h>
#include <atkmm/private/action_p.h>


// -*- c++ -*-
/* $Id: action.ccg,v 1.1 2003/01/21 13:36:56 murrayc Exp $ */

/* 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 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 <atk/atkaction.h>


namespace
{
} // anonymous namespace


namespace Glib
{

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

} // namespace Glib


namespace Atk
{


/* The *_Class implementation: */

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

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

  return *this;
}

void Action_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->do_action = &do_action_vfunc_callback;
  klass->get_n_actions = &get_n_actions_vfunc_callback;
  klass->get_description = &get_description_vfunc_callback;
  klass->get_name = &get_name_vfunc_callback;
  klass->get_keybinding = &get_keybinding_vfunc_callback;
  klass->set_description = &set_description_vfunc_callback;

}

gboolean Action_Class::do_action_vfunc_callback(AtkAction* self, gint i)
{
  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.
        return static_cast<int>(obj->do_action_vfunc(i
));
      #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->do_action)
  {
    gboolean retval = (*base->do_action)(self, i);
    return retval;
  }


  typedef gboolean RType;
  return RType();
}
gint Action_Class::get_n_actions_vfunc_callback(AtkAction* self)
{
  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.
        return obj->get_n_actions_vfunc();
      #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->get_n_actions)
  {
    gint retval = (*base->get_n_actions)(self);
    return retval;
  }


  typedef gint RType;
  return RType();
}
const gchar* Action_Class::get_description_vfunc_callback(AtkAction* self, gint i)
{
  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.
        return obj->get_description_vfunc(i
);
      #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->get_description)
  {
    const gchar* retval = (*base->get_description)(self, i);
    return retval;
  }


  typedef const gchar* RType;
  return RType();
}
const gchar* Action_Class::get_name_vfunc_callback(AtkAction* self, gint i)
{
  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.
        return obj->get_name_vfunc(i
);
      #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->get_name)
  {
    const gchar* retval = (*base->get_name)(self, i);
    return retval;
  }


  typedef const gchar* RType;
  return RType();
}
const gchar* Action_Class::get_keybinding_vfunc_callback(AtkAction* self, gint i)
{
  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.
        return obj->get_keybinding_vfunc(i
);
      #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->get_keybinding)
  {
    const gchar* retval = (*base->get_keybinding)(self, i);
    return retval;
  }


  typedef const gchar* RType;
  return RType();
}
gboolean Action_Class::set_description_vfunc_callback(AtkAction* self, gint i, const gchar* desc)
{
  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.
        return static_cast<int>(obj->set_description_vfunc(i
, Glib::convert_const_gchar_ptr_to_ustring(desc)
));
      #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->set_description)
  {
    gboolean retval = (*base->set_description)(self, i, desc);
    return retval;
  }


  typedef gboolean RType;
  return RType();
}


Glib::ObjectBase* Action_Class::wrap_new(GObject* object)
{
  return new Action((AtkAction*)(object));
}


/* The implementation: */

Action::Action()
:
  Glib::Interface(action_class_.init())
{}

Action::Action(AtkAction* castitem)
:
  Glib::Interface((GObject*)(castitem))
{}

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

Action::~Action()
{}

// static
void Action::add_interface(GType gtype_implementer)
{
  action_class_.init().add_interface(gtype_implementer);
}

Action::CppClassType Action::action_class_; // initialize static member

GType Action::get_type()
{
  return action_class_.init().get_type();
}


GType Action::get_base_type()
{
  return atk_action_get_type();
}


bool Action::do_action(int i)
{
  return atk_action_do_action(gobj(), i);
}

int Action::get_n_actions() const
{
  return atk_action_get_n_actions(const_cast<AtkAction*>(gobj()));
}

Glib::ustring Action::get_description(int i) const
{
  return Glib::convert_const_gchar_ptr_to_ustring(atk_action_get_description(const_cast<AtkAction*>(gobj()), i));
}

Glib::ustring Action::get_name(int i) const
{
  return Glib::convert_const_gchar_ptr_to_ustring(atk_action_get_name(const_cast<AtkAction*>(gobj()), i));
}

Glib::ustring Action::get_keybinding(int i)
{
  return Glib::convert_const_gchar_ptr_to_ustring(atk_action_get_keybinding(gobj(), i));
}

bool Action::set_description(int i, const Glib::ustring& desc)
{
  return atk_action_set_description(gobj(), i, desc.c_str());
}

Glib::ustring Action::get_localized_name(int i)
{
  return Glib::convert_const_gchar_ptr_to_ustring(atk_action_get_localized_name(gobj(), i));
}


bool Atk::Action::do_action_vfunc(int i) 
{
  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->do_action)
  {
    bool retval((*base->do_action)(gobj(),i));
    return retval;
  }

  typedef bool RType;
  return RType();
}
int Atk::Action::get_n_actions_vfunc() const
{
  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->get_n_actions)
  {
    int retval((*base->get_n_actions)(const_cast<AtkAction*>(gobj())));
    return retval;
  }

  typedef int RType;
  return RType();
}
const char* Atk::Action::get_description_vfunc(int i) const
{
  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->get_description)
  {
    const char* retval((*base->get_description)(const_cast<AtkAction*>(gobj()),i));
    return retval;
  }

  typedef const char* RType;
  return RType();
}
const char* Atk::Action::get_name_vfunc(int i) const
{
  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->get_name)
  {
    const char* retval((*base->get_name)(const_cast<AtkAction*>(gobj()),i));
    return retval;
  }

  typedef const char* RType;
  return RType();
}
const char* Atk::Action::get_keybinding_vfunc(int i) const
{
  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->get_keybinding)
  {
    const char* retval((*base->get_keybinding)(const_cast<AtkAction*>(gobj()),i));
    return retval;
  }

  typedef const char* RType;
  return RType();
}
bool Atk::Action::set_description_vfunc(int i, const Glib::ustring& desc) 
{
  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->set_description)
  {
    bool retval((*base->set_description)(gobj(),i,desc.c_str()));
    return retval;
  }

  typedef bool RType;
  return RType();
}


} // namespace Atk


