/**********************************************************************
 *
 *   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
 *
 *********************************************************************/

#include "constants.h"

#ifdef USE_UI_GTK

#include "icongroups.h"
#include "gtk_gui.h"

#include "../../party/party.h"

namespace GTK_DOKO {

  /**
   *
   * constructor
   *
   * @param	table	the table, the icongroups belong to
   *
   * @return	-
   * 
   * @version	0.4.4
   *
   * @author	Diether Knof
   *
   * @bug		takes the players from 'party' and not from 'game'
   *
   */
  IconGroups::IconGroups(Table* table) :
    HTINBaseGroup(table)
    {
      DEBUG_CALLING(INFO_GTK_ICONGROUP && INFO_GTK_INIT,
		    "IconGroups::IconGroups()");

      for (unsigned p = 0; p < ::party.playerno(); p++)
	this->object_p.push_back(new IconGroup(this, ::party.player(p)));

      DEBUG_RETURNING(VOID,
		      INFO_GTK_ICONGROUP && INFO_GTK_INIT,
		      "IconGroups::IconGroups()");
    } // IconGroups::IconGroups()

  /**
   *
   * -> result
   *
   * @param	player	the player, whose icongroup is returned
   *
   * @return	The icongroup of the given player
   * 
   * @version	0.4.4
   *
   * @author	Diether Knof
   *
   */
  IconGroup&
    IconGroups::icongroup(Player const& player)
    {
      DEBUG_CALLING(INFO_GTK_ICONGROUP && INFO_GTK_VALUE,
		    "IconGroups::icongroup(player)");

      DEBUG_RETURNING(static_cast<IconGroup&>(this->object(player)),
		      INFO_GTK_ICONGROUP && INFO_GTK_VALUE,
		      "IconGroups::icongroup(player)");
    } // IconGroup& IconGroups::icongroup(Player const& player)

} // namespace GTK_DOKO
#endif // #ifdef USE_UI_GTK
