/* Copyright (C) 2007 The giomm 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, see <http://www.gnu.org/licenses/>.
 */

#include <glibmm/interface.h>
#include <giomm/inputstream.h>

_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/interface_p.h)

#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GLoadableIconIface GLoadableIconIface;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

namespace Gio
{

/** Extends the Icon interface and adds the ability to load icons from streams.
 *
 * @newin{2,16}
 */
class GIOMM_API LoadableIcon : public Glib::Interface
{
  _CLASS_INTERFACE(LoadableIcon, GLoadableIcon, G_LOADABLE_ICON, GLoadableIconIface, , , GIOMM_API)

public:
/**
 * Loads a loadable icon. For the asynchronous version of this function,
 * see load_async().
 *
 * @param size an integer.
 * @param type a location to store the type of the loaded icon
 * @param cancellable a Cancellable object
 *
 * @return a InputStream to read the icon from.
 **/
  Glib::RefPtr<InputStream> load(int size, Glib::ustring& type, const Glib::RefPtr<Cancellable>& cancellable);
  /** Non-cancellable version of load()
   */
  Glib::RefPtr<InputStream> load(int size, Glib::ustring& type);
  //TODO: 'type' can be nullptr as well, but I don't really want to add 2 more
  //overloads -- one cancellable, and one not...

  /**
   * Loads an icon asynchronously. To finish this function, see load_finish().
   * For the synchronous, blocking version of this function, see load().
   *
   * @param size an integer.
   * @param cancellable a Cancellable object
   * @param slot a function to call when the request is satisfied
   **/
  void load_async(int size, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable);
  /** Non-cancellable version of load_async()
   */
  void load_async(int size, const SlotAsyncReady& slot);
  //_WRAP_METHOD(Glib::RefPtr<InputStream> load_finish(const Glib::RefPtr<AsyncResult>& res, Glib::ustring& type), g_loadable_icon_load_finish, errthrow)

protected:
  //_WRAP_VFUNC(Glib::RefPtr<InputStream> load(int size, Glib::ustring& type, const Glib::RefPtr<Cancellable>& cancellable), "load")
};


} // namespace Gio

