// Generated by gmmproc 2.42.0 -- DO NOT MODIFY!


#include <glibmm.h>

#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
{

bool ChildProxy::lookup(const Glib::RefPtr<Gst::ChildProxy>& object,
  const Glib::ustring& name, Glib::RefPtr<Glib::Object>& target,
  GParamSpec*& pspec)
{
  GObject* g_object = 0;
  bool const result = gst_child_proxy_lookup(Glib::unwrap(object),
    name.c_str(), &g_object, &pspec);
  target = Glib::wrap(g_object);
  return result;
}

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

} //namespace Gst

namespace
{


static void ChildProxy_signal_child_added_callback(GstChildProxy* self, GObject* p0,const gchar* p1,void* data)
{
  using namespace Gst;
  typedef sigc::slot< void,const Glib::RefPtr<Gst::Object>&,const Glib::ustring& > SlotType;

  ChildProxy* obj = dynamic_cast<ChildProxy*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
  // Do not try to call a signal on a disassociated wrapper.
  if(obj)
  {
    #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(GST_OBJECT(p0), true)
, Glib::convert_const_gchar_ptr_to_ustring(p1)
);
    #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, GObject* p0,const gchar* p1,void* data)
{
  using namespace Gst;
  typedef sigc::slot< void,const Glib::RefPtr<Gst::Object>&,const Glib::ustring& > SlotType;

  ChildProxy* obj = dynamic_cast<ChildProxy*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
  // Do not try to call a signal on a disassociated wrapper.
  if(obj)
  {
    #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(GST_OBJECT(p0), true)
, Glib::convert_const_gchar_ptr_to_ustring(p1)
);
    #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); 

  klass->get_child_by_index = &get_child_by_index_vfunc_callback;
  klass->get_children_count = &get_children_count_vfunc_callback;

  klass->child_added = &child_added_callback;
  klass->child_removed = &child_removed_callback;
}

GObject* 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)
  {
    GObject* retval = (*base->get_child_by_index)(self, index);
    return retval;
  }

  typedef GObject* 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)
  {
    guint retval = (*base->get_children_count)(self);
    return retval;
  }

  typedef guint RType;
  return RType();
}

void ChildProxy_Class::child_added_callback(GstChildProxy* self, GObject* p0, const gchar* 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_child_added(Glib::wrap(GST_OBJECT(p0), true)
, Glib::convert_const_gchar_ptr_to_ustring(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->child_added)
    (*base->child_added)(self, p0, p1);
}
void ChildProxy_Class::child_removed_callback(GstChildProxy* self, GObject* p0, const gchar* 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_child_removed(Glib::wrap(GST_OBJECT(p0), true)
, Glib::convert_const_gchar_ptr_to_ustring(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->child_removed)
    (*base->child_removed)(self, p0, p1);
}


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_OBJECT(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 const_cast<ChildProxy*>(this)->get_child(name);
}

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

Glib::RefPtr<const Glib::Object> ChildProxy::get_child(guint index) const
{
  return const_cast<ChildProxy*>(this)->get_child(index);
}

void ChildProxy::child_added(const Glib::RefPtr<Gst::Object>& child, const Glib::ustring& name)
{
  gst_child_proxy_child_added(gobj(), G_OBJECT(Glib::unwrap(child)), name.c_str());
}

void ChildProxy::child_removed(const Glib::RefPtr<Gst::Object>& child, const Glib::ustring& name)
{
  gst_child_proxy_child_removed(gobj(), G_OBJECT(Glib::unwrap(child)), name.c_str());
}


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


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


void Gst::ChildProxy::on_child_added(const Glib::RefPtr<Gst::Object>& object, const Glib::ustring& 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->child_added)
    (*base->child_added)(gobj(),G_OBJECT(Glib::unwrap(object)),name.c_str());
}
void Gst::ChildProxy::on_child_removed(const Glib::RefPtr<Gst::Object>& object, const Glib::ustring& 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->child_removed)
    (*base->child_removed)(gobj(),G_OBJECT(Glib::unwrap(object)),name.c_str());
}

Glib::RefPtr<Glib::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)
  {
    Glib::RefPtr<Glib::Object> retval(Glib::wrap((*base->get_child_by_index)(const_cast<GstChildProxy*>(gobj()),index)));
    return retval;
  }

  typedef Glib::RefPtr<Glib::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)
  {
    guint retval((*base->get_children_count)(const_cast<GstChildProxy*>(gobj())));
    return retval;
  }

  typedef guint RType;
  return RType();
}


} // namespace Gst


