// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-

/* Copyright (C) 2007 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., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <glibmm/object.h>
#include <giomm/file.h>
#include <giomm/icon.h>
#include <giomm/loadableicon.h>

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

namespace Gio
{

/** Icon theming support
 * ThemedIcon is an implementation of Gio::Icon that supports icon themes.
 * ThemedIcon contains a list of all of the icons present in an icon
 * theme, so that icons can be looked up quickly. ThemedIcon does
 * not provide actual pixmaps for icons, just the icon names.
 * Ideally something like Gtk::IconTheme::choose_icon() should be used to
 * resolve the list of names so that fallback icons work nicely with
 * themes that inherit other themes.
 *
 * @newin{2,16}
 */
class ThemedIcon
: public Glib::Object,
  public Icon
{
  _CLASS_GOBJECT(ThemedIcon, GThemedIcon, G_THEMED_ICON, Glib::Object, GObject)
  _IMPLEMENTS_INTERFACE(Icon)

protected:
  /** Creates a new themed icon for @ iconname, and optionally all the names that can be created by shortening @a iconname at '-' characters.
   *
   * @param iconname A string containing an icon name.
   * use_default_callbacks Whether to use all the names that can be created by shortening @a iconname at '-' characters.
   */
  explicit ThemedIcon(const std::string& iconname, bool use_default_callbacks = false);
  _IGNORE(g_themed_icon_new, g_themed_icon_new_with_default_fallbacks)

public:
  /** Creates a new themed icon for @ iconname, and optionally all the names that can be created by shortening @a iconname at '-' characters.
   *
   * @param iconname A string containing an icon name.
   * use_default_callbacks Whether to use all the names that can be created by shortening @a iconname at '-' characters.
   */
  _WRAP_CREATE(const std::string& iconname, bool use_default_callbacks = false)

  //TODO: GIcon *g_themed_icon_new_from_names (char **iconnames, int len);

  _WRAP_METHOD(void prepend_name(const std::string& iconname), g_themed_icon_prepend_name)
  _WRAP_METHOD(void append_name(const std::string& iconname), g_themed_icon_append_name)

  //TODO: Use _WRAP_METHOD() instead, but:
  //#m4 _CONVERSION(`const char*const*',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)')
  //TODO: gmmproc complains about the wrong number of arguments, but I can't see why. murrayc.
  //_WRAP_METHOD(Glib::StringArrayHandle get_names() const, g_themed_icon_get_names)
  Glib::StringArrayHandle get_names() const;
  _IGNORE(g_themed_icon_get_names)


  //There are no signals.

  //The "name" property is write-only and construct-only so it should not be wrapped.
  //An array: This is awkward to wrap_WRAP_PROPERTY("names", )
  _WRAP_PROPERTY("use-default-fallbacks", bool)
};

} // namespace Gio
