/**********************************************************************
 *
 *   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
   **
   ** party
   **   +- new party		C-n
   **   +- load party		C-l
   **   +- save party		C-s
   **   +- end party
   **   `- quit			C-q
   ** information
   **   +- card suggestion	h
   **   +- last trick		l
   **   +- rules		r
   **   +- players
   **   `- party points		p
   ** announcement
   **   `-  ...			n	m
   ** preferences
   **   +- show all hands
   **   +- show valid cards
   **   +- cards order
   **   `- preferences		F2
   ** bug report
   ** help
   **   +- help index		F1
   **   +- license
   **   +- cardset license
   **   +- changelog
   **   `- about
   ** 
   ** 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 emphasize_valid_cards_set();

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

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

    public:
    void announcement_event(unsigned const playerno, int const announcement);
    void swines_announcement_event(unsigned const playerno);
    void hyperswines_announcement_event(unsigned const playerno);

    private:
    MainWindow* main_window;

    Gtk::Menu* party_menu;
    Gtk::MenuItem* party;
    Gtk::ImageMenuItem* new_party;
    Gtk::ImageMenuItem* load_party;
    Gtk::ImageMenuItem* save_party;
    Gtk::ImageMenuItem* end_party;
    Gtk::ImageMenuItem* quit;

    Gtk::Menu* information_menu;
    Gtk::MenuItem* information;
    Gtk::ImageMenuItem* card_suggestion;
    Gtk::ImageMenuItem* last_trick;
    Gtk::ImageMenuItem* game_info;
    Gtk::ImageMenuItem* bug_report_replay;
    Gtk::ImageMenuItem* rules;
    Gtk::ImageMenuItem* party_points;
    Gtk::ImageMenuItem* players;
    Gtk::ImageMenuItem* players_db;

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

    Gtk::Menu* preferences_menu;
    Gtk::MenuItem* preferences;
    protected:
    Gtk::CheckMenuItem* emphasize_valid_cards;
    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* changelog;
    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
