/**********************************************************************
 *
 *   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_GTK
#ifndef GTK_PARTY_SETTINGS_PLAYER_HEADER
#define GTK_PARTY_SETTINGS_PLAYER_HEADER

#include "players.h"

#include "widget.h"

namespace GTK_DOKO {
#include <gtk/gtkwidget.h>

  class PartySettings::Players::Player {
    public:
      // constructor
      Player(Players* const players, unsigned const playerno);
      // destructor
      ~Player();


      // update the sensitivity
      void sensitivity_update();


      // create a backup
      void backup();
      // destroy the backup
      void backup_destroy();


      // reset the settings
      void reset(); 

      // the variables
      class GTK_GUI& gui(); // the gui
      Players& players(); // the players

      unsigned playerno() const; // the playernumber
      ::Player& player(); // the corresponding player

      GtkWidget* widget(); // the widget (container)

    private:
      // event for selecting a random name
      static void random_name_event(GtkWidget*, gpointer player);
      // event for a changing of the name
      static void name_changed_event(GtkWidget*, gpointer player);
      // event for a changing of the type
      static void type_changed_event(GtkWidget* widget, gpointer player);
      // event for the configuration
      static void configure_event(GtkWidget*, gpointer player);
    public:
      // select a random name
      void random_name();
      // the name of the player has changed
      void name_changed();
      // the type of the player has changed
      void type_changed();
      // configure
      void configure();

      // the whole player has changed
      void update();
      // the name of the player has changed
      void name_update();
      // the type of the player has changed
      void type_update();

      // update the language
      void language_update();
    private:
      Players* const players_; // the players

      unsigned const playerno_; // the number of the player
      ::Player const* player_bak; // backup of the player

      GtkWidget* alignment;

      GtkWidget* name_container;
      GtkWidget* name_label;
      GtkWidget* name_entry;
      GtkWidget* name_button;

      GtkWidget* type_container;
      GtkWidget* type_label;
      GtkWidget* type_human;
      GtkWidget* type_ai;
      GtkWidget* type_ai_dummy;

      GtkWidget* config_button;

    private: // not to be used
      Player();
      Player(Player const&);
      Player& operator=(Player const&);
  }; // class PartySettings::Players::Player

} // namespace GTK_DOKO

#endif // #ifndef GTK_PARTY_SETTINGS_PLAYER_HEADER
#endif // #ifdef USE_UI_GTK
