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

#include "ui.h"

#include "main_window.h"
#include "menu.h"
#include "party_settings.h"
#include "table.h"

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

#include <gtkmm/main.h>

namespace UI_GTKMM_NS {

  /**
   **
   ** start a new party
   **
   ** @param	-
   **
   ** @return	-
   **
   ** @version	0.5.4
   **
   ** @author	Diether Knof
   **
   **/
  void
    UI_GTKMM::start_new_party()
    {
      DEBUG_CALLING(INFO_GTKMM_UI && INFO_GTKMM_GAMEPLAY,
		    "UI_GTKMM::start_new_party()");

      ::game_status = GAMESTATUS::PARTY_NEW;
      this->main_quit();

      DEBUG_RETURNING(VOID,
		      INFO_GTKMM_UI && INFO_GTKMM_GAMEPLAY,
		      "UI_GTKMM::start_new_party()");
    } // void UI_GTKMM::start_new_party()

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

      this->main_window->menu->party_open();
      this->table->party_open();

      DEBUG_RETURNING(VOID,
		      INFO_GTKMM_UI,
		      "UI_GTKMM::party_open()");
    } // void UI_GTKMM::party_open()

  /**
   **
   ** gets and sets the settings of the party:
   **   names, types and configuration of the players,
   **   rules,
   **   starting seed
   **   startplayer
   **
   ** @param	-
   **
   ** @return	-
   **
   ** @version	0.5.2
   **
   ** @author	Diether Knof
   **
   **/
  void
    UI_GTKMM::party_get_settings()
    {
      DEBUG_CALLING(INFO_GTKMM_UI,
		    "UI_GTKMM::party_get_settings()");

      if (!FAST_PLAY)
	this->party_settings->get();

      DEBUG_RETURNING(VOID,
		      INFO_GTKMM_UI,
		      "UI_GTKMM::party_get_settings()");
    } // void UI_GTKMM::party_get_Settings()

  /**
   **
   ** the party is started:
   ** the gametype and announcements of the other players are shown
   **
   ** @param	-
   **
   ** @return	-
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  void
    UI_GTKMM::party_start()
    { 
      DEBUG_CALLING(INFO_GTKMM_UI,
		    "UI_GTKMM::party_start()");

      // the order is important:
      // first the party points window is created,
      // then the menu item can send signals to it
      this->table->party_start();
      this->main_window->menu->party_start();

      DEBUG_RETURNING(VOID,
		      INFO_GTKMM_UI,
		      "UI_GTKMM::party_start()");
    } // void UI_GTKMM::party_start()

  /**
   **
   ** the party is finished
   **
   ** @param	-
   **
   ** @return	-
   **
   ** @version	0.5.2
   **
   ** @author	Diether Knof
   **
   ** @todo	show the points and the winner
   **
   **/
  void
    UI_GTKMM::party_finish()
    {
      DEBUG_CALLING(INFO_GTKMM_UI,
		    "UI_GTKMM::party_finish()");

      DEBUG_RETURNING(VOID,
		      INFO_GTKMM_UI,
		      "UI_GTKMM::party_finish()");
    } // void UI_GTKMM::party_end()

  /**
   **
   ** the party is closed
   **
   ** @param	-
   **
   ** @return	-
   **
   ** @version	0.6.1
   **
   ** @author	Diether Knof
   **
   **/
  void
    UI_GTKMM::party_close()
    {
      DEBUG_CALLING(INFO_GTKMM_UI,
		    "UI_GTKMM::party_close()");

      this->main_window->menu->party_close();
      this->table->party_close();

      DEBUG_RETURNING(VOID,
		      INFO_GTKMM_UI,
		      "UI_GTKMM::party_close()");
    } // void UI_GTKMM::party_close()


} // namespace UI_GTKMM_NS

#endif // #ifdef USE_UI_GTKMM
