/**********************************************************************
 *
 *   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_SETTINGS_CARDS_ORDER_HEADER
#define GTK_SETTINGS_CARDS_ORDER_HEADER

#include "settings.h"

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

  class Settings::CardsOrder {
    public:
      // constructor
      CardsOrder(Settings* settings_a);

      // initialize the settings
      void init();
    private:
      // (re)draws the pixmap
      void draw_pixmap(unsigned const c);
    public:

      // update the sensitivity
      void sensitivity_update();
      // update the buttons
      void update();

      // the variables
      class GTK_GUI& gui(); // the gui
      Settings& settings(); // the settings
      GtkWidget* bookmark(); // the bookmark
      GtkWidget* widget(); // the widget (container)

    private:
      static void set_direction_event(GtkWidget* button, gpointer CardsOrder);
      static void pos_to_left_event(GtkWidget* button, gpointer CardsOrder);
      static void pos_to_right_event(GtkWidget* button, gpointer CardsOrder);
      static void sort_cards_event(GtkWidget*, gpointer CardsOrder);
      static void mix_cards_event(GtkWidget*, gpointer CardsOrder);

    public:
      void set_direction(unsigned const n,
			 ::CardsOrder::Direction const direction);
      void pos_to_left(unsigned const n);
      void pos_to_right(unsigned const n);
      void sort_cards();
      void mix_cards();

      // draw all
      void draw_all();
      // update the cards
      void cards_update();
      // update the language
      void language_update();
    private:
      Settings* const settings_p;

      XGtkLabel bookmark_p;
      GtkWidget* alignment;

    protected:
      vector<GtkWidget*> arrow_container;
      vector<GtkWidget*> arrow_left;
      vector<GtkWidget*> arrow_right;
      vector<GtkWidget*> tcolor_container;
      vector<GtkWidget*> pixmap;
      vector<GtkWidget*> direction_up;
      vector<GtkWidget*> direction_down;
      GtkWidget* sorted;
      GtkWidget* mixed;
      GtkWidget* mix_cards_button;

    private: // not implemented
      CardsOrder();
      CardsOrder(CardsOrder const&);
      CardsOrder& operator=(CardsOrder const&);
  }; // class Settings::CardsOrder

} // namespace GTK_DOKO

#endif // #ifndef GTK_SETTINGS_CARDS_ORDER_HEADER
#endif // #ifdef USE_UI_GTK
