/**********************************************************************
 *
 *   FreeDoko a Doppelkopf-Game
 *    
 *   Copyright (C) 2001-2004  by Diether Knof and Borg Enders
 *
 *   This program is free software; you can redistribute it and/or 
 *   modify it under the terms of the GNU General Public License as 
 *   published by the Free Software Foundation; either version 2 of 
 *   the License, or (at your option) any later version.
 *
 *   This program 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 General Public License for more details. 
 *   You can find this license in the file 'gpl.txt'.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
 *   MA  02111-1307  USA
 *
 *  Contact:
 *    Diether Knof dknof@gmx.de
 *    Borg Enders  borg@borgsoft.de
 *
 **********************************************************************/

#ifdef USE_UI_GTKMM

#ifndef GTKMM_ICONS_HEADER
#define GTKMM_ICONS_HEADER


#include "base.h"

#include "widgets/scaled_pixbuf_rotations.h"

#include "../../basistypes.h"
#include "../../card/card.h"

class Player;

#include <glibmm/refptr.h>
#include <gdkmm/drawable.h>

namespace UI_GTKMM_NS {

  /**
   **
   ** @brief	the icons
   **
   ** @author	Diether Knof
   **
   **/
  class Icons : public Base {
    friend class Icongroup;
    protected:
      enum Type {
	NONE,
	RE,
	CONTRA,
	FIVE_NINES,
	SIX_KINGS,
	FOX_HIGHEST_TRUMP,
	MARRIAGE,
	MARRIAGE_FOREIGN,
	MARRIAGE_TRUMP,
	MARRIAGE_COLOR,
	MARRIAGE_CLUB,
	MARRIAGE_SPADE,
	MARRIAGE_HEART,
	GENSCHER,
	POVERTY,
	POVERTY_TRUMPS_0,
	POVERTY_TRUMPS_1,
	POVERTY_TRUMPS_2,
	POVERTY_TRUMPS_3,
	SWINES_CLUB,
	SWINES_SPADE,
	SWINES_HEART,
	SWINES_DIAMOND,
	HYPERSWINES_CLUB,
	HYPERSWINES_SPADE,
	HYPERSWINES_HEART,
	HYPERSWINES_DIAMOND,
	SWINES_HYPERSWINES_CLUB,
	SWINES_HYPERSWINES_SPADE,
	SWINES_HYPERSWINES_HEART,
	SWINES_HYPERSWINES_DIAMOND,
	SOLO_CLUB,
	SOLO_SPADE,
	SOLO_HEART,
	SOLO_DIAMOND,
	SOLO_JACK,
	SOLO_QUEEN,
	SOLO_KING,
	SOLO_QUEEN_JACK,
	SOLO_KING_JACK,
	SOLO_KING_QUEEN,
	SOLO_KOEHLER,
	SOLO_MEATLESS,
	NO_120_REPLY,
	NO_90_REPLY,
	NO_60_REPLY,
	NO_30_REPLY,
	NO_0_REPLY,
	NO_120,
	NO_90,
	NO_60,
	NO_30,
	NO_0
      }; // enum Type
      static unsigned const NUMBER_OF_TYPES; // number of icons
    public:
      Icons(Base* const base);
      ~Icons();

      double scaling() const;
      void update_scaling();

      int max_width() const;
      int max_height() const;
      int max_width(vector<Glib::RefPtr<Gdk::Pixbuf> > const& icons) const;
      int max_height(vector<Glib::RefPtr<Gdk::Pixbuf> > const& icons) const;

      // the specific icon
      Glib::RefPtr<Gdk::Pixbuf> const&
	icon(Type const type,
	     Rotation const rotation = UP) ;

      // the specific gametype icon
      Glib::RefPtr<Gdk::Pixbuf> const&
	icon(GAMETYPE::GameType const gametype,
	     Rotation const rotation = UP) ;
      // the specific marriage selector icon
      Glib::RefPtr<Gdk::Pixbuf> const&
	icon(MARRIAGE_SELECTOR::MarriageSelector const marriage_selector,
	     Rotation const rotation = UP) ;
      // the specific team icon
      Glib::RefPtr<Gdk::Pixbuf> const&
	icon(TEAM::Team const team,
	     Rotation const rotation = UP) ;
      // the specific announcement icon
      Glib::RefPtr<Gdk::Pixbuf> const&
	icon(Announcement const announcement,
	     Rotation const rotation = UP) ;
      // the specific swines icon
      Glib::RefPtr<Gdk::Pixbuf> const&
	swines(Card::Color const color,
	       Rotation const rotation = UP) ;
      // the specific hyperswines icon
      Glib::RefPtr<Gdk::Pixbuf> const&
	hyperswines(Card::Color const color,
		    Rotation const rotation = UP) ;
      // the specific swines-hyperswines icon
      Glib::RefPtr<Gdk::Pixbuf> const&
	swines_hyperswines(Card::Color const color,
			   Rotation const rotation = UP) ;

      void load();

      Gdk::ScaledPixbufRotations load(Type const type, string const directory);

    private:
      Gdk::ScaledPixbufRotations construct(Card const card1);
      Gdk::ScaledPixbufRotations construct(Card const card1,
					   Card const card2);
      Gdk::ScaledPixbufRotations construct(Card const card1,
					   Card const card2,
					   Card const card3);
      Gdk::ScaledPixbufRotations construct(Card const card1,
					   Card const card2,
					   Card const card3,
					   Card const card4);
      Gdk::ScaledPixbufRotations construct(Card const card1,
					   Card const card2,
					   Card const card3,
					   Card const card4,
					   Card const card5);
      Gdk::ScaledPixbufRotations construct(Card const card1,
					   Card const card2,
					   Card const card3,
					   Card const card4,
					   Card const card5,
					   Card const card6);
      Gdk::ScaledPixbufRotations construct(vector<Card> const& cards);

    private:
      vector<Gdk::ScaledPixbufRotations> icon_;

      Glib::RefPtr<Gdk::Drawable> drawable_ref;
    private: // unused
      Icons();
      Icons(Icons const& icons);
      Icons& operator=(Icons const& icons);
  }; // class Icons : public Base

} // namespace UI_GTKMM_NS

#endif // #ifdef GTKMM_ICONS_HEADER

#endif // #ifdef USE_UI_GTKMM
