/* 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, see <http://www.gnu.org/licenses/>.
 */

#include <glibmm/object.h>
#include <giomm/icon.h>
#include <giomm/emblem.h>

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

namespace Gio
{

/** Icons with Emblems
 *
 * EmblemedIcon is an implementation of Icon that supports adding an emblem to
 * an icon. Adding multiple emblems to an icon is ensured via add_emblem().
 *
 * Note that EmblemedIcon allows no control over the position of the emblems.
 * See also Emblem for more information.
 *
 * @newin{2,20}
 */
class GIOMM_API EmblemedIcon
: public Glib::Object,
  public Icon
{
  _CLASS_GOBJECT(EmblemedIcon, GEmblemedIcon, G_EMBLEMED_ICON, Glib::Object, GObject, , , GIOMM_API)
  _IMPLEMENTS_INTERFACE(Icon)

protected:
  //We have this constructor because g_emblemed_icon_new() may take a nullptr emblem parameter.
  /** Creates a new emblemed icon for @a icon with no emblem.
   * @param icon An Icon.
   *
   * @newin{2,28}
   */
  explicit EmblemedIcon(const Glib::RefPtr<Icon>& icon);

  /** Creates a new emblemed icon for @a icon with the emblem @a emblem.
   * @param icon An Icon.
   * @param emblem An Emblem.
   */
 _WRAP_CTOR(EmblemedIcon(const Glib::RefPtr<Icon>& icon, const Glib::RefPtr<Emblem>& emblem), g_emblemed_icon_new)

public:

  /** Creates a new emblemed icon for @a icon with the emblem @a emblem.
   * @param icon An Icon.
   * @param emblem An Emblem.
   * @result An Icon.
   */
  _WRAP_CREATE(const Glib::RefPtr<Icon>& icon, const Glib::RefPtr<Emblem>& emblem)

  /** Creates a new emblemed icon for @a icon with no emblem.
   * @param icon An Icon.
   * @result An Icon.
   *
   * @newin{2,28}
   */
  _WRAP_CREATE(const Glib::RefPtr<Icon>& icon)


  _WRAP_METHOD(Glib::RefPtr<Icon> get_icon(), g_emblemed_icon_get_icon)
  _WRAP_METHOD(Glib::RefPtr<const Icon> get_icon() const, g_emblemed_icon_get_icon, constversion)

#m4 _CONVERSION(`GList*',`std::vector<Glib::RefPtr<Emblem>>',`Glib::ListHandler<Glib::RefPtr<Emblem>>::list_to_vector($3, Glib::OWNERSHIP_NONE)')
  _WRAP_METHOD(std::vector<Glib::RefPtr<Emblem>> get_emblems(), g_emblemed_icon_get_emblems)
  dnl// Can't use the constversion parameter in _WRAP_METHOD() when a vector is returned.
#m4 _CONVERSION(`GList*',`std::vector<Glib::RefPtr<const Emblem>>',`Glib::ListHandler<Glib::RefPtr<const Emblem>>::list_to_vector($3, Glib::OWNERSHIP_NONE)')
  _WRAP_METHOD(std::vector<Glib::RefPtr<const Emblem>> get_emblems() const, g_emblemed_icon_get_emblems)

  _WRAP_METHOD(void add_emblem(const Glib::RefPtr<Emblem>& emblem), g_emblemed_icon_add_emblem)
  _WRAP_METHOD(void clear_emblems(), g_emblemed_icon_clear_emblems)
};

} // namespace Gio
