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

#include "ui.wrap.h"

#include "../card/hand.h"

/**
 **
 ** Constructor
 ** a ui of the type 'NONE' and no os
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
UI_Wrap::UI_Wrap() :
UI(UI_TYPE::WRAP),
  ui(new_UI(UI_TYPE::NONE)),
os()
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::UI_Wrap()");

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::UI_Wrap()");
} // UI_Wrap::UI_Wrap()

/**
 **
 ** Destructor
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
UI_Wrap::~UI_Wrap()
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::~UI_Wrap()");

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::~UI_Wrap()");
} // UI_Wrap::~UI_Wrap()


/**
 **
 ** Function for the initialisation of the UI.
 **
 ** @param	argc	number of arguments
 ** @param	argv	arguments
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::init(int& argc, char**& argv)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::init(int argc, char** argv)");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->init(argc, argv);

  this->ui->init(argc, argv);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::init(int argc, char** argv)");
} // UI_Wrap::init(argc, argv)


/**
 **
 ** updates the UI
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::update()
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::update()");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->update();

  this->ui->update();

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::update()");
} // void UI_Wrap::update()

/**
 **
 ** sleeps the given time
 ** (in miliseconds, UINT_MAX for infinity)
 **
 ** @param	sleep_usec	time to sleep
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::sleep(unsigned const sleep_usec)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::sleep(usec)");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->sleep(sleep_usec);

  this->ui->sleep(sleep_usec);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::sleep(usec)");
} // void UI_Wrap::sleep(unsigned const sleep_usec)

/**
 **
 ** all language elements of the UI shall be updated
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::language_update()
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::language_update()");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->language_update();

  this->ui->language_update();

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::language_update()");
} // void UI_Wrap::language_update()


/**
 **
 ** the party is opened
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::party_open()
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::party_open()");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->party_open();

  this->ui->party_open();

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::party_open()");
} // void UI_Wrap::party_open()

/**
 **
 ** gets and sets the settings of the party
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::party_get_settings()
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::party_get_settings()");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->party_get_settings();

  this->ui->party_get_settings();

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::party_get_settings()");
} // void UI_Wrap::party_get_Settings()

/**
 **
 ** start of the party
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::party_start()
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::party_start()");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->party_start();

  this->ui->party_start();

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::party_start()");
} // void UI_Wrap::party_start()

/**
 **
 ** end of the party
 ** (p.e. to show the points and the winner)
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::party_finish()
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::party_finish()");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->party_finish();

  this->ui->party_finish();

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::party_finish()");
} // void UI_Wrap::party_end()

/**
 **
 ** the party will close
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::party_close()
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::party_close()");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->party_close();

  this->ui->party_close();

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::party_close()");
} // void UI_Wrap::party_close()

/**
 **
 ** a game is opened
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::game_open()
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::game_open()");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->game_open();

  this->ui->game_open();

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::game_open()");
} // void UI_Wrap::game_open()

/**
 **
 ** gets the reservations of the player 'player'
 ** Here is the first time, the hands can be shown (and should)
 **
 ** @param	player	the player that makes the reservation
 **
 ** @return	Reservation of the player 'player'
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
Reservation
UI_Wrap::reservation_get(Player const& player)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::reservation_get(player)");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->reservation_get(player);

  DEBUG_RETURNING(this->ui->reservation_get(player),
		  INFO_UI_WRAP,
		  "UI_Wrap::reservation_get(player)");
} // Reservation UI_Wrap::reservation_get(player)


/**
 **
 ** the game is started
 ** (p.e. show the announcements of the other players)
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::game_start()
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::game_start()");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->game_start();

  this->ui->game_start();

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::game_start()");
} // void UI_Wrap::game_start()


/**
 **
 ** the game is finished
 ** (p.e. show the winner and the points of the game)
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::game_finish()
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::game_finish()");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->game_finish();

  this->ui->game_finish();

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::game_finish()");
} // void UI_Wrap::game_finish()

/**
 **
 ** the game will close
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::game_close()
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::game_close()");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->game_close();

  this->ui->game_close();

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::game_close()");
} // void UI_Wrap::game_close()


/**
 **
 ** a new trick is opened
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::trick_open()
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::trick_open()");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->trick_open();

  this->ui->trick_open();

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::trick_open()");
} // void UI_Wrap::trick_open()

/**
 **
 ** gets the card, the player wishes to play
 ** (don't remove it from the hand!)
 **
 ** @param	player	the player who shall play a card
 **
 ** @return	Card to be played
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
Card
UI_Wrap::card_get(Player const& player)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::card_get(player)");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->card_get(player);

  DEBUG_RETURNING(this->ui->card_get(player),
		  INFO_UI_WRAP,
		  "UI_Wrap::card_get(player)");
} // Card UI_Wrap::card_get(Player const& player)

/**
 **
 ** the player 'player' plays the card 'card'
 **
 ** @param	card  	the played card
 ** @param	player	the player, who has played a card
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::card_played(Card const& card, Player const& player)
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::card_played(card, player)");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->card_played(card, player);

  this->ui->card_played(card, player);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::card_played(card, player)");
} // void UI_Wrap::card_played(Card const& card, Player const& player)

/**
 **
 ** the announcement 'announcement' has been made by player 'player'
 **
 ** @param	announcement	the announcement
 ** @param	player		the player, who has made the announcement
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::announcement_made(Announcement const& announcement,
			   Player const& player)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::announcement_made(announcement, player)");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->announcement_made(announcement, player);

  this->ui->announcement_made(announcement, player);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::announcement_made(card, player)");
} // void UI_Wrap::announcement_made(Announcement const& announcement, Player const& player)

/**
 **
 ** the player has swines
 **
 ** @param	player		the player with the swines
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::swines_announced(Player const& player)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::swines_announced(player)");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->swines_announced(player);

  this->ui->swines_announced(player);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::swines_announced(player)");
} // void UI_Wrap::swines_announced(Player const& player)

/**
 **
 ** the player has hyperswines
 **
 ** @param	player		the player with the swines
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::hyperswines_announced(Player const& player)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::hyperswines_announced(player)");

  vector<OS*> oss = this->os;
  
  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->hyperswines_announced(player);

  this->ui->hyperswines_announced(player);


  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::hyperswines_announced(player)");
} // void UI_Wrap::hyperswines_announced(Player const& player)

/**
 **
 ** 'player' shifts 'cardno' cards
 **
 ** @param	player	the player who shifts the cards
 ** @param	cardno	the number of cards that are shifted
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::poverty_shift(Player const& player, unsigned const cardno)
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::poverty_shift(player, cardno)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->poverty_shift(player, cardno);

  this->ui->poverty_shift(player, cardno);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::poverty_shift(player, cardno)");
} // void UI_Wrap::poverty_shift(Player const& player, unsigned const cardno)

/**
 **
 ** ask 'player' whether to accept the poverty
 **
 ** @param	player	the player who is asked
 ** @param	cardno	number of cards that are given back
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::poverty_ask(Player const& player, unsigned const cardno)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::poverty_ask(player, cardno)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->poverty_ask(player, cardno);

  this->ui->poverty_ask(player, cardno);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::poverty_ask(player, cardno)");
} // void UI_Wrap::poverty_ask(Player const& player, unsigned const cardno)

/**
 **
 ** 'player' denied to take the shifted cards
 **
 ** @param	player	the player who has denied to take the cards
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::poverty_take_denied(Player const& player)
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::poverty_take_denied(player)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->poverty_take_denied(player);

  this->ui->poverty_take_denied(player);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::poverty_take_denied(player)");
} // void UI_Wrap::poverty_take_denied(Player const& player)

/**
 **
 ** all players have denied to take the cards
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::poverty_take_denied_by_all()
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::poverty_take_denied_by_all()");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->poverty_take_denied_by_all();

  this->ui->poverty_take_denied_by_all();

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::poverty_take_denied_by_all()");
} // void UI_Wrap::poverty_take_denied_by_all()

/**
 **
 ** 'player' accepts to take the shifted cards
 ** and returns 'cardno' cards with 'trumpno' trumps
 **
 ** @param	player	the player who has denied to take the cards
 ** @param	cardno	number of cards that are given back
 ** @param	trumpno	number of trumps of the cards
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::poverty_take_accepted(Player const& player,
			       unsigned const cardno, unsigned const trumpno)
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::poverty_take_accepted(player, cardno, trumpno)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->poverty_take_accepted(player, cardno, trumpno);

  this->ui->poverty_take_accepted(player, cardno, trumpno);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::poverty_take_accepted(player, cardno, trumpno)");
} // void UI_Wrap::poverty_take_accepted(Player const& player, unsigned const cardno, unsigned const trumpno)

/**
 **
 ** returns which cards the player shifts
 **
 ** @param	player	the player who shifts the cards
 **
 ** @return	the cards that are to be shifted
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
Hand
UI_Wrap::poverty_shift(Player& player)
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::poverty_shift(player)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->poverty_shift(player);

  DEBUG_RETURNING(this->ui->poverty_shift(player),
		  INFO_UI_WRAP,
		  "UI_Wrap::poverty_shift(player)");
} // void UI_Wrap::poverty_shift(Player const& player)

/**
 **
 ** returns whether 'player' accepts the shifted cards
 **
 ** @param	player	the player who shifts the cards
 ** @param	cardno	the number of shifted cards
 **
 ** @return	whether to accept the cards
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
bool
UI_Wrap::poverty_take_accept(Player& player, unsigned const cardno)
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::poverty_take_accept(player, cardno)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->poverty_take_accept(player, cardno);

  DEBUG_RETURNING(this->ui->poverty_take_accept(player, cardno),
		  INFO_UI_WRAP,
		  "UI_Wrap::poverty_take_accept(player, cardno)");
} // void UI_Wrap::poverty_take_accept(Player const& player, unsigned const cardno)

/**
 **
 ** changes the cards from the poverty-player
 **
 ** @param	player	the player who has accepted the cards
 ** @param	cards	the cards that are given to the player
 **
 ** @return	the cards that are returned to the poverty-player
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
Hand
UI_Wrap::poverty_cards_change(Player& player, Hand const& cards)
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::poverty_cards_change(player, cards)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->poverty_cards_change(player, cards);

  DEBUG_RETURNING(this->ui->poverty_cards_change(player, cards),
		  INFO_UI_WRAP,
		  "UI_Wrap::poverty_cards_change(player, cards)");
} // Hand UI_Wrap::poverty_cards_change(Player& player, Hand const& cards)

/**
 **
 ** the poverty player 'player' gets 'cards'
 **
 ** @param	player	the player gets the cards
 ** @param	cards	the cards that are given to the player
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::poverty_cards_get_back(Player& player, Hand const& cards)
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::poverty_cards_get_back(player, cards)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->poverty_cards_get_back(player, cards);

  DEBUG_RETURNING(this->ui->poverty_cards_get_back(player, cards),
		  INFO_UI_WRAP,
		  "UI_Wrap::poverty_cards_get_back(player, cards)");
} // void UI_Wrap::poverty_cards_get_back(Player& player, Hand const& cards)

/**
 **
 ** marriage: Information of the new team
 **
 ** @param	bridegroom	the player with the marriage
 ** @param	bride		the bride
 **
 ** @return	-
 **
 ** @author	Diether Knof
 **
 ** @version	0.6.1
 **
 **/
void
UI_Wrap::marriage(Player const& bridegroom,
	     Player const& bride)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::marriage(bridegroom, bride)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->marriage(bridegroom, bride);

  this->ui->marriage(bridegroom, bride);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::marriage(bridegroom, bride)");
} // void UI_Wrap::marriage(Player const& bridegroom, Player const& bride)

/**
 **
 ** genscher: -> result
 **
 ** @param	-
 **
 ** @return	pointer to the new teammate,
 **		NULL if the genscher is not to be announced
 **
 ** @author	Diether Knof
 **
 ** @version	0.5.4
 **
 **/
Player const*
UI_Wrap::genscher_partner()
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::genscher_partner()");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->genscher_partner();

  DEBUG_RETURNING(this->ui->genscher_partner(),
		  INFO_UI_WRAP,
		  "UI_Wrap::genscher_partner()");
} // Player const* UI_Wrap::genscher_partner()

/**
 **
 ** genscher: Information of the new team
 **
 ** @param	player	genscher player
 ** @param	partner	partner of the gensher player
 **
 ** @return	-
 **
 ** @author	Diether Knof
 **
 ** @version	0.5.4
 **
 **/
void
UI_Wrap::genscher(Player const& player,
		  Player const& partner)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::genscher(player, partner)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->genscher(player, partner);

  this->ui->genscher(player, partner);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::genscher(player, partner)");
} // void UI_Wrap::genscher(Player const& player, Player const& partner)

/**
 **
 ** the trick 'trick' is full
 **
 ** @param	trick	the full trick
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::trick_full(Trick const& trick)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::trick_full(trick)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->trick_full(trick);

  this->ui->trick_full(trick);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::trick_full(trick)");
} // void UI_Wrap::trick_full(trick)

/**
 **
 ** moves the trick in the pile of the winnerplayer
 **
 ** @param	trick	the full trick
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::trick_move_in_pile(Trick const& trick)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::trick_move_in_pile(trick)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->trick_move_in_pile(trick);

  this->ui->trick_move_in_pile(trick);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::trick_move_in_pile(trick)");
} // void UI_Wrap::trick_move_in_pile(trick)

/**
 **
 ** the trick is closed
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::trick_close()
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::trick_close()");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->trick_close();

  this->ui->trick_close();

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::trick_close()");
} // void UI_Wrap::trick_close()

/**
 **
 ** redraw all
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::redraw_all()
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::redraw_all()");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->redraw_all();

  this->ui->redraw_all();

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::redraw_all()");
} // void UI_Wrap::redraw_all()

/**
 **
 ** the player 'player' has to be updated
 **
 ** @param	player	the player
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::player_update(Player const& player)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::player_update(player)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->player_update(player);

  this->ui->player_update(player);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::player_update(player)");
} // void UI_Wrap::player_update(player)

/**
 **
 ** the name of the player 'player' has to be updated
 **
 ** @param	player	the player, whose name is changed
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::name_update(Player const& player)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::name_update(player)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->name_update(player);

  this->ui->name_update(player);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::name_update(player)");
} // void UI_Wrap::name_update(player)

/**
 **
 ** the hand of the player 'player' has to be updated
 **
 ** @param	player	the player, whose hand is to be updated
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::hand_update(Player const& player)
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::hand_update(player)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->hand_update(player);

  this->ui->hand_update(player);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::hand_update(player)");
} // void UI_Wrap::hand_update(player)

/**
 **
 ** the teaminfo of the player 'player' has to be updated
 **
 ** @param	player	the player whose team should be updated
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::teaminfo_update(Player const& player)
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::teaminfo_update(player)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->teaminfo_update(player);

  this->ui->teaminfo_update(player);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::teaminfo_update(player)");
} // void UI_Wrap::team_udpate(player)

/**
 **
 ** the gametype has to be updated
 ** (take the player from 'game.soloplayer()'
 **
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::gametype_update()
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::gametype_update()");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->gametype_update();

  this->ui->gametype_update();

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::gametype_update()");
} // void UI_Wrap::gametype_udpate()

/**
 **
 ** the rule 'type' has changed
 **
 ** @param	type		the type that has changed
 ** @param	old_value	old value
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::rule_update(int const type, void const* const old_value)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::rule_update(type, old_value)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->rule_update(type, old_value);

  this->ui->rule_update(type, old_value);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::rule_update(type, old_value)");
} // void UI_Wrap::rule_update(int const type, void const* const old_value)

/**
 **
 ** the setting 'type' has changed
 **
 ** @param	type		the type that has changed
 ** @param	old_value	old value
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::setting_update(int const type, void const* const old_value)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::setting_update(type)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->setting_update(type, old_value);

  this->ui->setting_update(type, old_value);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::setting_update(type, old_value)");
} // void UI_Wrap::setting_update(int const type, void const* const old_value)

/**
 **
 ** load the page with the help
 **
 ** @param	page	the page to be loaded
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::help_load(string const& page)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::help_load(page)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->help_load(page);

  this->ui->help_load(page);

  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::help_load(page)");
} // void UI_Wrap::help_load(string const& page)

/**
 **
 ** the status message has changed
 **
 ** @param	message	the status message
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::status_message_changed(Translator::Translation const& message)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap:status_message_changed(message)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->status_message_changed(message);

  this->ui->status_message_changed(message);

  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap:status_message_changed(message)");
} // void UI_Wrap:status_message_changed(Translator::Translation const& message)

/**
 **
 ** the progress has changed
 **
 ** @param	progress	the progress
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::progress_changed(double const progress)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap:progress_changed(progress)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->progress_changed(progress);

  this->ui->progress_changed(progress);

  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap:progress_changed(progress)");
} // void UI_Wrap::progress_changed(double const progress)

/**
 **
 ** the progress is finished
 **
 ** @param	-
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::progress_finished()
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap:progress_finished()");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->progress_finished();

  this->ui->progress_finished();

  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap:progress_finished()");
} // void UI_Wrap::progress_finished()

/**
 **
 ** information for the user
 **
 ** @param	message		message for the user
 **
 ** @return	-
 **
 ** @version	0.6.2
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::information(Translator::Translation const& message)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap:information(message)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->information(message);

  this->ui->information(message);

  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap:information(message)");
} // void UI_Wrap::information(Translator::Translation const& message)

/**
 **
 ** an error has occured
 **
 ** @param	message		message with the error description (hopefully)
 **
 ** @return	-
 **
 ** @version	0.6.2
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::error(string const& message)
{
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap:error(message)");

  vector<OS*> oss = this->os;

  for (vector<OS*>::iterator os = oss.begin(); os != oss.end(); os++)
    (*os)->error(message);

  this->ui->error(message);

  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap:error(message)");
} // void UI_Wrap::error(string const& message)

/**
 **
 ** sets the ui that is wrapped
 **
 ** @param	ui	the wrapped ui
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::ui_set(UI* const ui)
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::ui_set(ui)");

  delete this->ui;
  this->ui = ui;

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::ui_set(ui)");
} // void UI_Wrap::ui_set(UI* const ui)

/**
 **
 ** add the os to the wrapped os's
 **
 ** @param	os	os to be appended
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::append(OS* const os)
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::append(os)");

  this->os.push_back(os);

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::append(os)");
} // void UI_Wrap::append(OS* const os)

/**
 **
 ** remove 'os' from the wrapped 'os's
 **
 ** @param	os	os to be removeed
 **
 ** @return	-
 **
 ** @version	0.5.4
 **
 ** @author	Diether Knof
 **
 **/
void
UI_Wrap::remove(OS* const os)
{ 
  DEBUG_CALLING(INFO_UI_WRAP,
		"UI_Wrap::remove(os)");

  for (vector<OS*>::iterator os_it = this->os.begin();
       os_it != this->os.end();
       os_it++)
    if (*os_it == os) {
      this->os.erase(os_it);
      break;
    } // if (*os_it == os) 

  DEBUG_RETURNING(VOID,
		  INFO_UI_WRAP,
		  "UI_Wrap::remove(os)");
} // void UI_Wrap::remove(OS* const os)
