/**********************************************************************
 *
 *   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_AICONFIG_HEADER
#define GTKMM_AICONFIG_HEADER

#include "base.h"
#include "player.h"
#include "../../player/aiconfig.h"

#include <sigc++/object.h>
namespace Gtk {
  class VBox;
  class Notebook;
  class StockButton;
  class Label;
  class CheckButton;
  class LabelSpinButton;
  class SpinButton;
  class OptionMenu;
  class MenuItem;
  class FileSelection;

  class FileMenu;
} // namespace Gtk

class Player;
class Aiconfig;
namespace UI_GTKMM_NS {

  /**
   **
   ** @brief	the ai configuration of one player
   **
   ** @author	Diether Knof
   **
   **/
  class Players::Player::AiConfig : public Base, public SigC::Object {
    public:
      friend class Players;
      friend class Player;

    public:
      AiConfig(Player* const player);
      ~AiConfig();

      void create_container();

      ::Aiconfig& aiconfig();
      
      void aitype_change(int const type);
      void change(int const type);

      void hardcoded();
      void adopt();
      void adopt_aiconfig(unsigned const playerno);
      void allot();
      void load();
      void load_file(string const filename);
      void save();

      void sensitivity_update();
      void update();
      void name_update();

    private:
      void init();

      void aitype_changed(unsigned const trickno);
      void future_limit_changed(unsigned const trickno);
      void aitype_as_previous_changed(unsigned const trickno);

    private:
      Player* const player;

    protected:
      Gtk::VBox* container;
      Gtk::Notebook* notebook;
      Gtk::Notebook* heuristic_notebook;

      Gtk::StockButton* hardcoded_button;
      Gtk::StockButton* adopt_button;
      Gtk::StockButton* allot_button;
      Gtk::StockButton* load_button;
      Gtk::StockButton* save_button;
      Gtk::FileSelection* save_file_selector;

      vector<Gtk::OptionMenu*> aitype;
      vector<Gtk::SpinButton*> future_limit;
      vector<Gtk::CheckButton*> aitype_as_previous;
      vector<Gtk::CheckButton*> type_heuristic;
      vector<Gtk::CheckButton*> type_bool;
      vector<Gtk::LabelSpinButton*> type_unsigned;

    private: // unused
      AiConfig();
      AiConfig(AiConfig const& aiconfig);
      AiConfig& operator=(AiConfig const& aiconfig);
  }; // class Players::Player::AiConfig : public Base, public Gtk::Object

} // namespace UI_GTKMM_NS

#endif // #ifdef GTKMM_AICONFIG_HEADER

#endif // #ifdef USE_UI_GTKMM
