/**********************************************************************
 *
 *   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_PARTY_POINTS_HEADER
#define GTKMM_PARTY_POINTS_HEADER

#include "base.h"
#include <gtkmm/dialog.h>

#include <gtkmm/liststore.h>
namespace Gtk {
  class TreeView;
  class TreeViewColumn;
  class CheckButton;
  class StockButton;
} // namespace Gtk
class Player;

namespace UI_GTKMM_NS {
  class GameSummary;

  /**
   **
   ** @brief	the party points window
   **
   ** @author	Diether Knof
   **
   ** @todo	equal width for the names
   ** @todo	event for col size changing
   ** @todo	flat sum row
   ** @todo	deselection of the games
   ** @todo	separators between the rounds
   ** @todo	collapsing the rounds
   ** @todo	colors for the different game types
   ** @todo	bold number for the startplayer
   **
   **/
  class PartyPoints : public Base, public Gtk::Dialog {
    class GameOverview;
    friend class GameOverview;

    class PartyPointsModel : public Gtk::TreeModel::ColumnRecord {
      public:
	PartyPointsModel(unsigned const playerno);

	Gtk::TreeModelColumn<unsigned> gameno;
	vector<Gtk::TreeModelColumn<Glib::ustring> > playerpoints;
	Gtk::TreeModelColumn<Glib::ustring> gametype;
    }; // class PartyPointsModel : public Gtk::TreeModel::ColumnRecord

    public:
    PartyPoints(Base* const parent);
    ~PartyPoints();

    void game_finished();

    void name_changed(Player const& player);
    void language_update();

    protected:
    void clear_selection();

    private:
    void init();
    void recreate_party_points();
    void add_game(unsigned const gameno);

    void row_selection_changed();

    void sum_columns_size_update();

    void show_game_overview_toggled();

    private:
    //TrickpointsModel party_points_model;
    PartyPointsModel* party_points_model;
    Glib::RefPtr<Gtk::ListStore> party_points_list;
    Gtk::TreeView* party_points_treeview;

    Gtk::TreeView* party_points_sum_treeview;

    protected:
    Gtk::CheckButton* show_game_overview_button;
    private:
    Gtk::StockButton* close_button;

    GameOverview* game_overview;

    private: // unused
    PartyPoints();
    PartyPoints(PartyPoints const& party_points);
    PartyPoints& operator=(PartyPoints const& party_points);
  }; // class PartyPoints : public Base, public Gtk::Dialog

} // namespace UI_GTKMM_NS

#endif // #ifdef GTKMM_PARTY_POINTS_HEADER

#endif // #ifdef USE_UI_GTKMM
