// Generated by gtkmmproc -- DO NOT MODIFY!


#include <cluttermm/score.h>
#include <cluttermm/private/score_p.h>

/* Copyright (C) 2007 The cluttermm 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 <clutter/clutter.h>

namespace Clutter
{

gulong Score::append(const Glib::RefPtr<Timeline>& timeline)
{
  return clutter_score_append(gobj(), NULL, timeline->gobj());
}

std::vector<Glib::RefPtr<Timeline> > Score::list_timelines()
{
  GSList* timelineList = clutter_score_list_timelines(gobj());
  const guint timelineCount = g_slist_length(timelineList);
  std::vector<Glib::RefPtr<Timeline> > timelineVec;
  timelineVec.reserve(timelineCount);

  for(GSList* timelineNode = timelineList; timelineNode->next; timelineNode = timelineList->next)
  {
    timelineVec.push_back(Glib::wrap(static_cast<ClutterTimeline*>(timelineNode->data), true));
  }

  return timelineVec;
}

    std::vector<Glib::RefPtr<const Timeline> > Score::list_timelines() const
{
  GSList* timelineList = clutter_score_list_timelines(const_cast<ClutterScore*>(gobj()));
  const guint timelineCount = g_slist_length(timelineList);
  std::vector<Glib::RefPtr<const Timeline> > timelineVec;
  timelineVec.reserve(timelineCount);

  for(GSList* timelineNode = timelineList; timelineNode->next; timelineNode = timelineList->next)
  {
    timelineVec.push_back(Glib::wrap(static_cast<ClutterTimeline*>(timelineNode->data), true));
  }

  return timelineVec;
}

} // namespace Clutter

namespace
{


static const Glib::SignalProxyInfo Score_signal_completed_info =
{
  "completed",
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};


static const Glib::SignalProxyInfo Score_signal_paused_info =
{
  "paused",
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};


static const Glib::SignalProxyInfo Score_signal_started_info =
{
  "started",
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};


static void Score_signal_timeline_completed_callback(ClutterScore* self, ClutterTimeline* p0,void* data)
{
  using namespace Clutter;
  typedef sigc::slot< void,const Glib::RefPtr<Timeline>& > 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 Score_signal_timeline_completed_info =
{
  "timeline-completed",
  (GCallback) &Score_signal_timeline_completed_callback,
  (GCallback) &Score_signal_timeline_completed_callback
};


static void Score_signal_timeline_started_callback(ClutterScore* self, ClutterTimeline* p0,void* data)
{
  using namespace Clutter;
  typedef sigc::slot< void,const Glib::RefPtr<Timeline>& > 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 Score_signal_timeline_started_info =
{
  "timeline-started",
  (GCallback) &Score_signal_timeline_started_callback,
  (GCallback) &Score_signal_timeline_started_callback
};


} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Clutter::Score> wrap(ClutterScore* object, bool take_copy)
{
  return Glib::RefPtr<Clutter::Score>( dynamic_cast<Clutter::Score*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
  //We use dynamic_cast<> in case of multiple inheritance.
}

} /* namespace Glib */


namespace Clutter
{


/* The *_Class implementation: */

const Glib::Class& Score_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Class has to know the class init function to clone custom types.
    class_init_func_ = &Score_Class::class_init_function;

    // This is actually just optimized away, apparently with no harm.
    // Make sure that the parent type has been created.
    //CppClassParent::CppObjectType::get_type();

    // Create the wrapper type, with the same class/instance size as the base type.
    register_derived_type(clutter_score_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:

  }

  return *this;
}


void Score_Class::class_init_function(void* g_class, void* class_data)
{
  BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
  CppClassParent::class_init_function(klass, class_data);


  klass->completed = &completed_callback;
  klass->paused = &paused_callback;
  klass->started = &started_callback;
  klass->timeline_completed = &timeline_completed_callback;
  klass->timeline_started = &timeline_started_callback;
}


void Score_Class::completed_callback(ClutterScore* 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.
        obj->on_completed();
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

  // Call the original underlying C function:
  if(base && base->completed)
    (*base->completed)(self);
}
void Score_Class::paused_callback(ClutterScore* 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.
        obj->on_paused();
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

  // Call the original underlying C function:
  if(base && base->paused)
    (*base->paused)(self);
}
void Score_Class::started_callback(ClutterScore* 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.
        obj->on_started();
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

  // Call the original underlying C function:
  if(base && base->started)
    (*base->started)(self);
}
void Score_Class::timeline_completed_callback(ClutterScore* self, ClutterTimeline* 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_timeline_completed(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_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

  // Call the original underlying C function:
  if(base && base->timeline_completed)
    (*base->timeline_completed)(self, p0);
}
void Score_Class::timeline_started_callback(ClutterScore* self, ClutterTimeline* 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_timeline_started(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_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

  // Call the original underlying C function:
  if(base && base->timeline_started)
    (*base->timeline_started)(self, p0);
}


Glib::ObjectBase* Score_Class::wrap_new(GObject* object)
{
  return new Score((ClutterScore*)object);
}


/* The implementation: */

ClutterScore* Score::gobj_copy()
{
  reference();
  return gobj();
}

Score::Score(const Glib::ConstructParams& construct_params)
:
  Glib::Object(construct_params)
{

}

Score::Score(ClutterScore* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


Score::~Score()
{}


Score::CppClassType Score::score_class_; // initialize static member

GType Score::get_type()
{
  return score_class_.init().get_type();
}


GType Score::get_base_type()
{
  return clutter_score_get_type();
}


Score::Score()
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(0),
  Glib::Object(Glib::ConstructParams(score_class_.init()))
{
  

}

Glib::RefPtr<Score> Score::create()
{
  return Glib::RefPtr<Score>( new Score() );
}
void Score::set_loop(bool loop)
{
clutter_score_set_loop(gobj(), static_cast<int>(loop)); 
}

bool Score::get_loop() const
{
  return clutter_score_get_loop(const_cast<ClutterScore*>(gobj()));
}

gulong Score::append(const Glib::RefPtr<Timeline>& parent, const Glib::RefPtr<Timeline>& timeline)
{
  return clutter_score_append(gobj(), Glib::unwrap(parent), Glib::unwrap(timeline));
}

void Score::append_at_marker(const Glib::RefPtr<Timeline>& parent, const Glib::ustring& marker_name, const Glib::RefPtr<Timeline>& timeline)
{
clutter_score_append_at_marker(gobj(), Glib::unwrap(parent), marker_name.c_str(), Glib::unwrap(timeline)); 
}

void Score::remove(gulong id)
{
clutter_score_remove(gobj(), id); 
}

void Score::remove_all()
{
clutter_score_remove_all(gobj()); 
}

Glib::RefPtr<Timeline> Score::get_timeline(gulong id)
{

  Glib::RefPtr<Timeline> retvalue = Glib::wrap(clutter_score_get_timeline(gobj(), id));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;

}

Glib::RefPtr<const Timeline> Score::get_timeline(gulong id) const
{
  return const_cast<Score*>(this)->get_timeline(id);
}

void Score::start()
{
clutter_score_start(gobj()); 
}

void Score::pause()
{
clutter_score_pause(gobj()); 
}

void Score::stop()
{
clutter_score_stop(gobj()); 
}

void Score::rewind()
{
clutter_score_rewind(gobj()); 
}

bool Score::is_playing() const
{
  return clutter_score_is_playing(const_cast<ClutterScore*>(gobj()));
}


Glib::SignalProxy0< void > Score::signal_completed()
{
  return Glib::SignalProxy0< void >(this, &Score_signal_completed_info);
}


Glib::SignalProxy0< void > Score::signal_paused()
{
  return Glib::SignalProxy0< void >(this, &Score_signal_paused_info);
}


Glib::SignalProxy0< void > Score::signal_started()
{
  return Glib::SignalProxy0< void >(this, &Score_signal_started_info);
}


Glib::SignalProxy1< void,const Glib::RefPtr<Timeline>& > Score::signal_timeline_completed()
{
  return Glib::SignalProxy1< void,const Glib::RefPtr<Timeline>& >(this, &Score_signal_timeline_completed_info);
}


Glib::SignalProxy1< void,const Glib::RefPtr<Timeline>& > Score::signal_timeline_started()
{
  return Glib::SignalProxy1< void,const Glib::RefPtr<Timeline>& >(this, &Score_signal_timeline_started_info);
}


#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<bool> Score::property_loop() 
{
  return Glib::PropertyProxy<bool>(this, "loop");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> Score::property_loop() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "loop");
}
#endif //GLIBMM_PROPERTIES_ENABLED


void Clutter::Score::on_completed()
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->completed)
    (*base->completed)(gobj());
}
void Clutter::Score::on_paused()
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->paused)
    (*base->paused)(gobj());
}
void Clutter::Score::on_started()
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->started)
    (*base->started)(gobj());
}
void Clutter::Score::on_timeline_completed(const Glib::RefPtr<Timeline>& timeline)
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->timeline_completed)
    (*base->timeline_completed)(gobj(),Glib::unwrap(timeline));
}
void Clutter::Score::on_timeline_started(const Glib::RefPtr<Timeline>& timeline)
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->timeline_started)
    (*base->timeline_started)(gobj(),Glib::unwrap(timeline));
}


} // namespace Clutter


