/**********************************************************************
 *
 *   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_HAND_HEADER
#define GTK_HAND_HEADER

#include "htin.h"

class Player;
class Card;

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

  // margin of the icons, names and trickpiles to the hand
#define HAND_MARGIN_LEFT int(0.04 * this->gui().cards().width(const_cast<Game const&>(::party.game()).player(1)))
#define HAND_MARGIN_RIGHT int(0.04 * this->gui().cards().width(const_cast<Game const&>(::party.game()).player(3)))
#define HAND_MARGIN_TOP int(0.04 * this->gui().cards().height(const_cast<Game const&>(::party.game()).player(2)))
#define HAND_MARGIN_BOTTOM int(0.04 * this->gui().cards().height(const_cast<Game const&>(::party.game()).player(0)))

  // one hand
  // (I couldn't name it 'Hand', so I appended the g (for graphic or so) )
  class Handg : public HTINBase {
    public:
      /// constructor
      Handg(class Handgs* hands, Player const& player);

      /// the hands group
      class Handgs& hands();

      /// starting x-position
      int start_x();
      /// starting y-position
      int start_y();
      /// width of the hand
      unsigned width();
      /// height of the hand
      unsigned height();
      /// x-step of the cards
      double cards_step_x();
      /// y-step of the cards
      double cards_step_y();

      /// draws the hand of player 'playerno' in the pixmap
      void draw(bool const update = true);

      /// plays the card
      void play_card(Card const& card);

      /// updates the language
      void language_update();

      /// a mouse click
      bool mouse_click(GdkEventButton* button_event);

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

  // all hands of the players
  class Handgs : public HTINBaseGroup {
    public:
      /// constructor
      Handgs(class Table* table);

      /// the variables
      Handg& hand(Player const& player); /// the hand

      /// starting x-position of the hands
      int start_x();
      /// starting y-position of the hands
      int start_y();
      /// width of the hands
      unsigned width();
      /// height of the hands
      unsigned height();

      /// a mouse click
      bool mouse_click(GdkEventButton* button_event);

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

} // namespace GTK_DOKO

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