/**********************************************************************
 *
 *   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 "aiconfigs.h"
#include "../../player/aiconfig.h"

#include <gtkmm/notebook.h>
namespace Gtk {
  class StockButton;
  class Label;
  class VBox;
  class CheckButton;
  class RadioButton;
  class LabelSpinButton;
  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::AiConfigs::AiConfig : public Base, public Gtk::Notebook {
    public:
      friend class AiConfigs;

    public:
      AiConfig(AiConfigs* const aiconfigs, unsigned const playerno);
      ~AiConfig();

      ::Player& player();
      ::Aiconfig& aiconfig();
      unsigned playerno() const;
      
      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 on_switch_page(GtkNotebookPage* page, guint pageno);

    private:
      AiConfigs* const aiconfigs;
      Players* const players;
      unsigned const playerno_;

    protected:
      Gtk::Label* name_bookmark;
      Gtk::VBox* container;

    private:
      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::RadioButton*> aitype;
      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 : public Base, public Gtk::Alignment

} // namespace UI_GTKMM_NS

#endif // #ifdef GTKMM_AICONFIG_HEADER

#endif // #ifdef USE_UI_GTKMM
