// Generated by gtkmmproc -- DO NOT MODIFY!


#include <gstreamermm/childproxy.h>
#include <gstreamermm/private/childproxy_p.h>

/* gstreamermm - a C++ wrapper for gstreamer
 *
 * Copyright 2008 The gstreamermm 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.
 */

namespace Gst
{

Glib::RefPtr<Gst::ChildProxy> ChildProxy::get_proxy_property(const Glib::ustring& name, Glib::ValueBase& value)
{
  gst_child_proxy_get_property(GST_OBJECT(gobj()), name.c_str(), value.gobj());
  return Glib::wrap(gobj(), true);
}

Glib::RefPtr<const Gst::ChildProxy> ChildProxy::get_proxy_property(const Glib::ustring& name, Glib::ValueBase& value) const
{
  gst_child_proxy_get_property(GST_OBJECT(gobj()), name.c_str(), value.gobj());
  return Glib::wrap(const_cast<GstChildProxy*>(gobj()), true);
}

Glib::RefPtr<Gst::ChildProxy> ChildProxy::set_proxy_property(const Glib::ustring& name, const Glib::ValueBase& value)
{
  gst_child_proxy_set_property(GST_OBJECT(gobj()), name.c_str(), value.gobj());
  return Glib::wrap(gobj(), true);
}

void ChildProxy::child_added(const Glib::RefPtr<Gst::Object>& child)
{
  gst_child_proxy_child_added(GST_OBJECT(gobj()), child->gobj());
}

void ChildProxy::child_removed(const Glib::RefPtr<Gst::Object>& child)
{
  gst_child_proxy_child_removed(GST_OBJECT(gobj()), child->gobj());
}

} //namespace Gst

namespace
{


static void ChildProxy_signal_child_added_callback(GstChildProxy* self, GstObject* p0,void* data)
{
  using namespace Gst;
  typedef sigc::slot< void,const Glib::RefPtr<Gst::Object>& > 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::wrap(p0, true)
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo ChildProxy_signal_child_added_info =
{
  "child-added",
  (GCallback) &ChildProxy_signal_child_added_callback,
  (GCallback) &ChildProxy_signal_child_added_callback
};


static void ChildProxy_signal_child_removed_callback(GstChildProxy* self, GstObject* p0,void* data)
{
  using namespace Gst;
  typedef sigc::slot< void,const Glib::RefPtr<Gst::Object>& > 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::wrap(p0, true)
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo ChildProxy_signal_child_removed_info =
{
  "child-removed",
  (GCallback) &ChildProxy_signal_child_removed_callback,
  (GCallback) &ChildProxy_signal_child_removed_callback
};


} // anonymous namespace


namespace Glib
{

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

} // namespace Glib


namespace Gst
{


/* The *_Class implementation: */

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

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

  return *this;
}

void ChildProxy_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); 

#ifdef GLIBMM_VFUNCS_ENABLED
  klass->get_child_by_index = &get_child_by_index_vfunc_callback;
  klass->get_children_count = &get_children_count_vfunc_callback;
#endif //GLIBMM_VFUNCS_ENABLED

#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
  klass->child_added = &child_added_callback;
  klass->child_removed = &child_removed_callback;
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
}

#ifdef GLIBMM_VFUNCS_ENABLED
GstObject* ChildProxy_Class::get_child_by_index_vfunc_callback(GstChildProxy* self, guint index)
{
  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 Glib::unwrap(obj->get_child_by_index_vfunc(index));
      #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_child_by_index)
    return (*base->get_child_by_index)(self, index);


  typedef GstObject* RType;
  return RType();
}
guint ChildProxy_Class::get_children_count_vfunc_callback(GstChildProxy* 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_children_count_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_children_count)
    return (*base->get_children_count)(self);


  typedef guint RType;
  return RType();
}
#endif //GLIBMM_VFUNCS_ENABLED

#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
void ChildProxy_Class::child_added_callback(GstChildProxy* self, GstObject* 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_child_added(Glib::wrap(p0, 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->child_added)
    (*base->child_added)(self, p0);
}
void ChildProxy_Class::child_removed_callback(GstChildProxy* self, GstObject* 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_child_removed(Glib::wrap(p0, 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->child_removed)
    (*base->child_removed)(self, p0);
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED


Glib::ObjectBase* ChildProxy_Class::wrap_new(GObject* object)
{
  return new ChildProxy((GstChildProxy*)(object));
}


/* The implementation: */

ChildProxy::ChildProxy()
:
  Glib::Interface(childproxy_class_.init())
{}

ChildProxy::ChildProxy(GstChildProxy* castitem)
:
  Glib::Interface((GObject*)(castitem))
{}

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

ChildProxy::~ChildProxy()
{}

// static
void ChildProxy::add_interface(GType gtype_implementer)
{
  childproxy_class_.init().add_interface(gtype_implementer);
}

ChildProxy::CppClassType ChildProxy::childproxy_class_; // initialize static member

GType ChildProxy::get_type()
{
  return childproxy_class_.init().get_type();
}

GType ChildProxy::get_base_type()
{
  return gst_child_proxy_get_type();
}


guint ChildProxy::get_children_count() const
{
  return gst_child_proxy_get_children_count(const_cast<GstChildProxy*>(gobj()));
}

Glib::RefPtr<Gst::Object> ChildProxy::get_child(const Glib::ustring& name)
{
  return Glib::wrap(gst_child_proxy_get_child_by_name(gobj(), name.c_str()));
}

Glib::RefPtr<const Gst::Object> ChildProxy::get_child(const Glib::ustring& name) const
{
  return Glib::wrap(gst_child_proxy_get_child_by_name(const_cast<GstChildProxy*>(gobj()), name.c_str()));
}

Glib::RefPtr<Gst::Object> ChildProxy::get_child(guint index)
{
  return Glib::wrap(gst_child_proxy_get_child_by_index(gobj(), index));
}

Glib::RefPtr<const Gst::Object> ChildProxy::get_child(guint index) const
{
  return Glib::wrap(gst_child_proxy_get_child_by_index(const_cast<GstChildProxy*>(gobj()), index));
}


Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Object>& > ChildProxy::signal_child_added()
{
  return Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Object>& >(this, &ChildProxy_signal_child_added_info);
}


Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Object>& > ChildProxy::signal_child_removed()
{
  return Glib::SignalProxy1< void,const Glib::RefPtr<Gst::Object>& >(this, &ChildProxy_signal_child_removed_info);
}


#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
void Gst::ChildProxy::on_child_added(const Glib::RefPtr<Gst::Object>& object)
{
  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->child_added)
    (*base->child_added)(gobj(),Glib::unwrap(object));
}
void Gst::ChildProxy::on_child_removed(const Glib::RefPtr<Gst::Object>& object)
{
  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->child_removed)
    (*base->child_removed)(gobj(),Glib::unwrap(object));
}
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED

#ifdef GLIBMM_VFUNCS_ENABLED
Glib::RefPtr<Gst::Object> Gst::ChildProxy::get_child_by_index_vfunc(guint index) 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_child_by_index)
    return Glib::wrap((*base->get_child_by_index)(const_cast<GstChildProxy*>(gobj()),index));

  typedef Glib::RefPtr<Gst::Object> RType;
  return RType();
}
guint Gst::ChildProxy::get_children_count_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_children_count)
    return (*base->get_children_count)(const_cast<GstChildProxy*>(gobj()));

  typedef guint RType;
  return RType();
}
#endif //GLIBMM_VFUNCS_ENABLED


} // namespace Gst


