/* This file is part of cardwords
   (c) 1999 2000 Tobias Peters
   see file COPYING for the copyright terms.
   
   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 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
*/

// cardwords_gtk_handdisplay.hh

#ifndef CARDWORDS_GTK_HANDDISPLAY_HH
#define CARDWORDS_GTK_HANDDISPLAY_HH

#include "cardwords_hand.hh"
#include <vector>
#include <gtk--/box.h>
namespace CardWords {

class Gtk_Common_Card_Cell_Styles;
class Gtk_CardCell;

class Gtk_HandDisplay : public Gtk::HBox
{
public:
  Gtk_HandDisplay(const
                            Gtk_Common_Card_Cell_Styles *
                            styles,
                            const Hand *);
  ~Gtk_HandDisplay();

  // Call this when the hand has changed:
  void
  update(void);

  // This signal is raised when the user clicks on a card in the hand
  SigC::Signal1<void, Card *> card_clicked;
  
private:
  // Declaring the copy constructor private. It must not be used.
  Gtk_HandDisplay(const Gtk_HandDisplay &);

  const Hand * hand;

  const Gtk_Common_Card_Cell_Styles * styles;

  class cell {
  public:
    Gtk_CardCell * gtk_card_cell;
    Card   * card; // Remember which card.
    Card   * old_card; // Remember the card that was here before
    //                                  if the cell is empty now.
    cell (); // init with no card;

    ~cell(); // delete the card cell if it is != 0
    void set(Hand::const_iterator); // set to this card;
    void set(Card *);
  };
  vector<cell> cells;

  void
  received_click_on_card(const Gtk_CardCell *);
};
}
#endif

