/**********************************************************************
 *
 *   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_HTIN_BASE_HEADER
#define GTK_HTIN_BASE_HEADER

class Player;
class Game;

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

  // htin stands for hand, trickpile, icon, name
  // this class is a baseclasse for the corresponding classes

  class HTINBase {
    public:
      friend class HTINBaseGroup;
    public:
      /// constructor
      HTINBase(class HTINBaseGroup* group, Player const& player);

      /// destructor
      virtual ~HTINBase();

      /// the gui
      class GTK_GUI& gui();
      /// the corresponding group
      class HTINBaseGroup& group();
      /// the corresponding hand
      class Handg& hand();
      /// the corresponding trickpile
      class TrickPile& trickpile();
      /// the corresponding icongroup
      class IconGroup& icongroup();
      /// the corresponding name
      class Name& name();

      /// the corresponding player
      Player const& player() const;

      /// starting x-position
      virtual int start_x();
      /// starting y-position
      virtual int start_y();
      /// width
      virtual unsigned width();
      /// height
      virtual unsigned height();

      /// draws the object
      virtual void draw(bool const update = true);

    protected:
      // the corresponding group
      class HTINBaseGroup* group_p;

      /// the corresponding player
      Player const* player_p;

    private: // not to be used
      HTINBase();
      HTINBase(HTINBase const& base);
      HTINBase& operator=(HTINBase const& base);
  }; // class HTINBase

  class HTINBaseGroup {
    public:
      // constructor -- set the table
      HTINBaseGroup(class Table* table);
      /// destructor
      virtual ~HTINBaseGroup();

      /// initializes the group
      virtual void init();

      /// the gui
      class GTK_GUI& gui();
      /// the table
      class Table& table();
      /// the corresponding object
      HTINBase& object(Player const& player);

      /// a new game is opened
      virtual void game_open(Game const& game);
      /// a new game is closed
      virtual void game_close(Game const& game);

      /// draws all objects
      virtual void draw(bool const update = true);

      /// updates the language
      virtual void language_update();

    private:
      /// the corresponding table
      class Table* const table_p;
    protected:
      /// the objects
      vector<HTINBase*> object_p;

    private: // not to be used
      HTINBaseGroup();
      HTINBaseGroup(HTINBaseGroup const&);
      HTINBaseGroup& operator=(HTINBaseGroup const&);
  }; // HTINBaseGroup

} // namespace GTK_DOKO

#endif // #ifndef GTK_HTIN_BASE_HEADER
#endif // #ifdef USE_UI_GTK
