/* 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 <glibmm/object.h>
#include <cluttermm/timeline.h>
#include <clutter/clutter.h>

_DEFS(cluttermm,clutter)
_PINCLUDE(glibmm/private/object_p.h)


namespace Clutter
{

class Score : public Glib::Object
{
  _CLASS_GOBJECT(Score, ClutterScore, CLUTTER_SCORE, Glib::Object, GObject)

protected:
  _CTOR_DEFAULT()

public:
  _WRAP_CREATE()

  _WRAP_METHOD(void set_loop(bool loop = true), clutter_score_set_loop)
  _WRAP_METHOD(bool get_loop() const, clutter_score_get_loop)

  _WRAP_METHOD(gulong append(const Glib::RefPtr<Timeline>& parent, const Glib::RefPtr<Timeline>& timeline), clutter_score_append)

  /** Appends a timeline to another one existing in the score. The new timeline
   * will be started when start() is called.
   *
   * @param timeline the Timeline to append
   * @return the id of the newly added timeline, to be used with get_timeline() and remove().
   */
  gulong append(const Glib::RefPtr<Timeline>& timeline);

  _WRAP_METHOD(void append_at_marker(const Glib::RefPtr<Timeline>& parent, const Glib::ustring& marker_name, const Glib::RefPtr<Timeline>& timeline), clutter_score_append_at_marker)

  _WRAP_METHOD(void remove(gulong id), clutter_score_remove)
  _WRAP_METHOD(void remove_all(), clutter_score_remove_all)

  _WRAP_METHOD(Glib::RefPtr<Timeline> get_timeline(gulong id), clutter_score_get_timeline, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Timeline> get_timeline(gulong id) const, clutter_score_get_timeline, , refreturn, constversion)

  std::vector<Glib::RefPtr<Timeline> > list_timelines();
  std::vector<Glib::RefPtr<const Timeline> > list_timelines() const;

  _WRAP_METHOD(void start(), clutter_score_start)
  _WRAP_METHOD(void pause(), clutter_score_pause)
  _WRAP_METHOD(void stop(), clutter_score_stop)
  _WRAP_METHOD(void rewind(), clutter_score_rewind)
  _WRAP_METHOD(bool is_playing() const, clutter_score_is_playing)

  _WRAP_PROPERTY("loop", bool)

#m4 _CONVERSION(`ClutterTimeline*', `const Glib::RefPtr<Timeline>&', `Glib::wrap(($3), true)')
  _WRAP_SIGNAL(void completed(), "completed")
  _WRAP_SIGNAL(void paused(), "paused")
  _WRAP_SIGNAL(void started(), "started")
  _WRAP_SIGNAL(void timeline_completed(const Glib::RefPtr<Timeline>& timeline), "timeline-completed")
  _WRAP_SIGNAL(void timeline_started(const Glib::RefPtr<Timeline>& timeline), "timeline-started")
};

} // namespace Clutter
