/**********************************************************************
 *
 *   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_MENU_HEADER
#define GTK_MENU_HEADER

#include "widget.h"

class Player;

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

  class Menu {
    public:
      // constructor
      Menu(MainWindow* const main_window);

      // inits the menu (dependencies, ...)
      void init();

      void game_init();
      void settings_init();
      void announcements_init();
      void help_init();

      // the variables
      class GTK_GUI& gui(); // the gui
      class MainWindow& main_window(); // the main window
      GtkWidget* widget(); // the menu bar

      // activate/deactivate menu buttons
      void party_open(); // the party is opened
      void party_start(); // the party is opened
      void game_open(); // the game is opened
      void game_start(); // the game is started
      void trick_open(); // a new trick is opened
      void trick_full(); // the trick is full
      void game_finish(); // the game is finished
      void game_close(); // the game is closed
      void party_finish(); // the party is finished
      void party_close(); // the party is closed
      void name_update(Player const& player); // the name is updated
      // the announcement is updated
      void announcement_update(Player const& player);

      static void game_new_party_event(GtkWidget* widget, gpointer menu);

      void settings_show_all_hands_button_update();
      static void settings_show_all_hands_toggled_event(GtkWidget* widget,
							gpointer menu);
      static void settings_cards_order_event(GtkWidget* widget, gpointer menu);

      void announcements_game_start();
      void announcements_sensitivity_update();
      static void announcements_announce_event(GtkWidget* window, gpointer);
      void announcements_name_update(Player const& player);

      // update the language
      void language_update();
      void announcements_language_update();

    private:
      class MainWindow* const main_window_p; // the main window

      vector<GtkLabel*> labels;

      GtkWidget* bar;

      GtkWidget* game_item;
      GtkWidget* game_new_party;
      GtkWidget* game_party_settings;
      GtkWidget* game_quit;

      GtkWidget* settings_item;
      GtkWidget* settings_show_all_hands;
      GtkWidget* settings_cards_order;
      GtkWidget* settings_settings;

      GtkWidget* announcements_item;
      vector<GtkWidget*> announcements_name;
      vector<vector<GtkWidget*> > announcements_announcement;

      GtkWidget* last_trick;
      GtkWidget* party_points;
      GtkWidget* bug_report;

      GtkWidget* help_item;
      GtkWidget* help_index;
      GtkWidget* help_license;
      GtkWidget* help_cardset_license;
      GtkWidget* help_about;

    protected:
      // activate the menu_check_item
      static void window_show_event(GtkWidget* window, gpointer menu_check_item);
      // deactivate the menu_check_item
      static void window_hide_event(GtkWidget* window, gpointer menu_check_item);


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

} // namespace GTK_DOKO

#endif // #ifdef USE_UI_GTK_MENU_HEADER
#endif // #ifdef USE_UI_GTK
