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

#include "base.h"

#include "../../basistypes.h"

#include <gtkmm/menubar.h>
#include <sigc++/connection.h>
namespace Gtk {
  class Menu;
  class MenuItem;
  class TearoffMenuItem;
  class CheckMenuItem;
  class Label;
} // namespace Gtk

namespace UI_GTKMM_NS {
  class MainWindow;
  class Preferences;

  /**
   **
   ** @brief	the main window
   **
   ** game
   **   +- new party		C-n
   **   +- load party		C-l
   **   +- save party		C-s
   **   `- quit			C-q
   ** information
   **   +- card suggestion	h
   **   +- last trick		l
   **   +- rules		r
   **   `- party points		p
   ** announcement
   **   `-  ...			n	m
   ** preferences
   **   +- show all hands
   **   +- cards order
   **   `- preferences		F2
   ** bug report
   ** help
   **   +- help index		F1
   **   +- license
   **   +- cardset license
   **   +- about
   **   `- generate error
   ** 
   ** Note: the translation of the announcements are managed internally
   ** 
   **
   ** @author	Diether Knof
   **
   ** @todo	replace 'party_points_*_connection' (see SigC-doc)
   ** @todo	update the player names in the announcement
   **
   **/
  class Menu : public Base, public Gtk::MenuBar {
    friend class Preferences;
    public:
    Menu(MainWindow* const main_window);
    ~Menu();

    void set_signals();
    void show_all_hands_set();

    void party_open();
    void party_start();
    void game_start();
    void trick_open();
    void card_get();
    void card_got();
    void game_finish();
    void party_close();

    void announcements_update();
    void language_update();
    private:
    void init();

    void announcement_event(unsigned const playerno, int const announcement);

    private:
    MainWindow* main_window;

    Gtk::Menu* game_menu;
    Gtk::MenuItem* game;
    Gtk::ImageMenuItem* new_party;
    Gtk::ImageMenuItem* load_party;
    Gtk::ImageMenuItem* save_party;
    Gtk::ImageMenuItem* quit;

    Gtk::Menu* information_menu;
    Gtk::MenuItem* information;
    Gtk::ImageMenuItem* card_suggestion;
    Gtk::ImageMenuItem* last_trick;
    Gtk::ImageMenuItem* rules;
    Gtk::ImageMenuItem* party_points;

    Gtk::MenuItem* announcements;
    vector<Gtk::MenuItem*> announcements_player;
    vector<Gtk::Menu*> announcements_player_menu;
    vector<vector<Gtk::MenuItem*> > announcements_announcement;

    Gtk::Menu* preferences_menu;
    Gtk::MenuItem* preferences;
    protected:
    Gtk::CheckMenuItem* show_all_hands;
    private:
    Gtk::ImageMenuItem* cards_order;
    Gtk::ImageMenuItem* preferences_preferences;

    Gtk::ImageMenuItem* bug_report;

    Gtk::Menu* help_menu;
    Gtk::MenuItem* help;
    Gtk::ImageMenuItem* help_index;
    Gtk::ImageMenuItem* license;
    Gtk::ImageMenuItem* cardset_license;
    Gtk::ImageMenuItem* about;
    Gtk::ImageMenuItem* generate_error;

    SigC::Connection party_points_present_connection;

    private: // unused
    Menu();
    Menu(Menu const& main_window);
    Menu& operator=(Menu const& main_window);
  }; // class Menu : public Base, public Gtk::MenuBar

} // namespace UI_GTKMM_NS

#endif // #ifdef GTKMM_MENU_HEADER

#endif // #ifdef USE_UI_GTKMM
