// Generated by gtkmmproc -- DO NOT MODIFY!


#include <glibmm.h>

#include <gstreamermm/colorbalance.h>
#include <gstreamermm/private/colorbalance_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.
 */

#include <gstreamermm/colorbalancechannel.h>

namespace Gst
{

const GList* ColorBalance_Class::list_channels_vfunc_callback(GstColorBalance* 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.
    {
      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 (obj->list_channels_vfunc()).data();
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }
  
  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->list_channels)
    return (*base->list_channels)(self);


  typedef const GList* RType;
  return RType();
}
Glib::ListHandle< Glib::RefPtr<ColorBalanceChannel> > Gst::ColorBalance::list_channels_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->list_channels)
    return Glib::ListHandle< Glib::RefPtr<ColorBalanceChannel> >(const_cast<GList*>((*base->list_channels)(const_cast<GstColorBalance*>(gobj()))), Glib::OWNERSHIP_NONE);

  typedef Glib::ListHandle< Glib::RefPtr<ColorBalanceChannel> > RType;
  return RType(0, Glib::OWNERSHIP_NONE);
}

} // namespace Gst

namespace
{


static void ColorBalance_signal_value_changed_callback(GstColorBalance* self, GstColorBalanceChannel* p0,gint p1,void* data)
{
  using namespace Gst;
  typedef sigc::slot< void,const Glib::RefPtr<ColorBalanceChannel>&,int > 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)
, p1
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo ColorBalance_signal_value_changed_info =
{
  "value-changed",
  (GCallback) &ColorBalance_signal_value_changed_callback,
  (GCallback) &ColorBalance_signal_value_changed_callback
};


} // anonymous namespace

// static
GType Glib::Value<Gst::ColorBalanceType>::value_type()
{
  return gst_color_balance_type_get_type();
}


namespace Glib
{

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

} // namespace Glib


namespace Gst
{


/* The *_Class implementation: */

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

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

  return *this;
}

void ColorBalance_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->set_value = &set_value_vfunc_callback;
  klass->get_value = &get_value_vfunc_callback;
  klass->list_channels = &list_channels_vfunc_callback;
  
  klass->value_changed = &value_changed_callback;
}

void ColorBalance_Class::set_value_vfunc_callback(GstColorBalance* self, GstColorBalanceChannel* balance, gint value)
{
  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->set_value_vfunc(Glib::wrap(balance, true)
, value
);
        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->set_value)
  {
    (*base->set_value)(self, balance, value);
  }

}
gint ColorBalance_Class::get_value_vfunc_callback(GstColorBalance* self, GstColorBalanceChannel* balance)
{
  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_value_vfunc(Glib::wrap(balance, true)
);
      #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_value)
  {
    gint result = (*base->get_value)(self, balance);
    return result;
  }


  typedef gint RType;
  return RType();
}

void ColorBalance_Class::value_changed_callback(GstColorBalance* self, GstColorBalanceChannel* p0, gint 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_value_changed(Glib::wrap(p0, true)
, 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->value_changed)
    (*base->value_changed)(self, p0, p1);
}


Glib::ObjectBase* ColorBalance_Class::wrap_new(GObject* object)
{
  return new ColorBalance((GstColorBalance*)(object));
}


/* The implementation: */

ColorBalance::ColorBalance()
:
  Glib::Interface(colorbalance_class_.init())
{}

ColorBalance::ColorBalance(GstColorBalance* castitem)
:
  Glib::Interface((GObject*)(castitem))
{}

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

ColorBalance::~ColorBalance()
{}

// static
void ColorBalance::add_interface(GType gtype_implementer)
{
  colorbalance_class_.init().add_interface(gtype_implementer);
}

ColorBalance::CppClassType ColorBalance::colorbalance_class_; // initialize static member

GType ColorBalance::get_type()
{
  return colorbalance_class_.init().get_type();
}


GType ColorBalance::get_base_type()
{
  return gst_color_balance_get_type();
}


Glib::ListHandle< Glib::RefPtr<ColorBalanceChannel> > ColorBalance::list_channels()
{
  return Glib::ListHandle< Glib::RefPtr<ColorBalanceChannel> >(const_cast<GList*>(gst_color_balance_list_channels(gobj())), Glib::OWNERSHIP_NONE);
}

Glib::ListHandle< Glib::RefPtr<const ColorBalanceChannel> > ColorBalance::list_channels() const
{
  return Glib::ListHandle< Glib::RefPtr<const ColorBalanceChannel> >(const_cast<GList*>(gst_color_balance_list_channels(const_cast<GstColorBalance*>(gobj()))), Glib::OWNERSHIP_NONE);
}

int ColorBalance::get_value(const Glib::RefPtr<const ColorBalanceChannel>& channel) const
{
  return gst_color_balance_get_value(const_cast<GstColorBalance*>(gobj()), const_cast<GstColorBalanceChannel*>(Glib::unwrap(channel)));
}

void ColorBalance::set_value(const Glib::RefPtr<ColorBalanceChannel>& channel, int value)
{
  gst_color_balance_set_value(gobj(), Glib::unwrap(channel), value);
}

void ColorBalance::value_changed(const Glib::RefPtr<ColorBalanceChannel>& channel, int value)
{
  gst_color_balance_value_changed(gobj(), Glib::unwrap(channel), value);
}

Gst::ColorBalanceType ColorBalance::get_balance_type() const
{
  return ((Gst::ColorBalanceType)(gst_color_balance_get_balance_type(const_cast<GstColorBalance*>(gobj()))));
}


Glib::SignalProxy2< void,const Glib::RefPtr<ColorBalanceChannel>&,int > ColorBalance::signal_value_changed()
{
  return Glib::SignalProxy2< void,const Glib::RefPtr<ColorBalanceChannel>&,int >(this, &ColorBalance_signal_value_changed_info);
}


void Gst::ColorBalance::on_value_changed(const Glib::RefPtr<ColorBalanceChannel>& channel, int 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->value_changed)
    (*base->value_changed)(gobj(),Glib::unwrap(channel),value);
}

void Gst::ColorBalance::set_value_vfunc(const Glib::RefPtr<ColorBalanceChannel>& channel, int 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->set_value)
  {
    (*base->set_value)(gobj(),Glib::unwrap(channel),value);
  }
}
int Gst::ColorBalance::get_value_vfunc(const Glib::RefPtr<const ColorBalanceChannel>& channel) 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_value)
  {
    int result((*base->get_value)(const_cast<GstColorBalance*>(gobj()),const_cast<GstColorBalanceChannel*>(Glib::unwrap(channel))));
    return result;
  }

  typedef int RType;
  return RType();
}


} // namespace Gst


