/*
 * Copyright (C) 1998-2002 The gtkmm 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <glibmm/object.h>
#include <gdkmm/pixbuf.h>
#include <glibmm/timeval.h>
#include <gdk-pixbuf/gdk-pixbuf.h>

_DEFS(gdkmm,gdk)
_PINCLUDE(glibmm/private/object_p.h)


namespace Gdk
{


/** An iterator which points to a certain position in a PixbufAnimation.
 */
class GDKMM_API PixbufAnimationIter : public Glib::Object
{
  _CLASS_GOBJECT(PixbufAnimationIter, GdkPixbufAnimationIter, GDK_PIXBUF_ANIMATION_ITER, Glib::Object, GObject, , , GDKMM_API)
protected:

  //A constructor (if any) would go here, protected.

public:
  _WRAP_METHOD(int get_delay_time() const, gdk_pixbuf_animation_iter_get_delay_time)

  _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> get_pixbuf(), gdk_pixbuf_animation_iter_get_pixbuf, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> get_pixbuf() const, gdk_pixbuf_animation_iter_get_pixbuf, refreturn, constversion)

  _WRAP_METHOD(bool on_currently_loading_frame() const, gdk_pixbuf_animation_iter_on_currently_loading_frame)

  //TODO: GTimeVal is deprecated, but gdk_pixbuf_animation_iter_advance() is not deprecated,
  // and there is not replacement for it.
  _WRAP_METHOD_DOCS_ONLY(gdk_pixbuf_animation_iter_advance)
  bool advance(const Glib::TimeVal& current_time);
#m4 _CONVERSION(`const Glib::TimeVal&', `const GTimeVal*', static_cast<$2>(&$3))
  //_WRAP_METHOD(bool advance(const Glib::TimeVal& current_time), gdk_pixbuf_animation_iter_advance,
  //  deprecated "Use ??? instead.")

  /** Possibly advances an animation to a new frame. Chooses the frame based
   * on the start time passed to Gdk::PixbufAnimation::get_iter().
   *
   * If this function returns false, there's no need to update the animation
   * display, assuming the display had been rendered prior to advancing;
   * if true, you need to call get_pixbuf() and update the
   * display with the new pixbuf.
   *
   * @newin{2,14}
   *
   * @return true if the image may need updating.
   */
  bool advance();
};

} // namespace Gdk

