/**********************************************************************
 *
 *   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
 *
 *********************************************************************/

#include "constants.h"

#ifdef USE_UI_GTK

#include "menu.h"
#include "gtk_gui.h"
#include "help.h"
#include "license.h"
#include "license.cardset.h"
#include "about.h"

namespace GTK_DOKO {

  /**
   **
   ** inits the help submenu
   **
   ** @param	-
   **
   ** @return	-
   **
   ** @author	Diether Knof
   ** 
   ** @version	0.5.1
   **
   **/
  void
    Menu::help_init()
    {
      DEBUG_CALLING(INFO_GTK_MENU && INFO_GTK_INIT,
		    "Menu::help_init()");

      { // create the submenu
	gtk_object_set_data(GTK_OBJECT(GTK_BIN(this->help_item)->child), "text",
			    new string("Help"));
	this->labels.push_back(GTK_LABEL(GTK_BIN(this->help_item)->child));
	gtk_object_set_data(GTK_OBJECT(GTK_BIN(this->help_index)->child), "text",
			    new string("Help"));
	this->labels.push_back(GTK_LABEL(GTK_BIN(this->help_index)->child));
	gtk_object_set_data(GTK_OBJECT(GTK_BIN(this->help_license)->child), "text",
			    new string("License"));
	this->labels.push_back(GTK_LABEL(GTK_BIN(this->help_license)->child));
	gtk_object_set_data(GTK_OBJECT(GTK_BIN(this->help_cardset_license)->child), "text",
			    new string("Cardset license"));
	this->labels.push_back(GTK_LABEL(GTK_BIN(this->help_cardset_license)->child));
	gtk_object_set_data(GTK_OBJECT(GTK_BIN(this->help_about)->child), "text",
			    new string("About"));
	this->labels.push_back(GTK_LABEL(GTK_BIN(this->help_about)->child));

	GtkWidget* menu = gtk_menu_new();
	gtk_menu_append(GTK_MENU(menu), this->help_index);
	gtk_menu_append(GTK_MENU(menu), this->help_license);
	gtk_menu_append(GTK_MENU(menu), this->help_cardset_license);
	gtk_menu_append(GTK_MENU(menu), this->help_about);
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(this->help_item), menu);
	gtk_menu_item_right_justify(GTK_MENU_ITEM(this->help_item));
	gtk_menu_bar_append(GTK_MENU_BAR(this->bar), this->help_item);
      } // create the submenu

      // the events
      gtk_signal_connect(GTK_OBJECT(this->help_index), "activate",
			 GTK_SIGNAL_FUNC(GTK_DOKO::Help::index_load_event),
			 &(this->gui().help()));
      gtk_signal_connect(GTK_OBJECT(this->help_license), "activate",
			 GTK_SIGNAL_FUNC(GTK_DOKO::License::show_event),
			 &gui().license());
      gtk_signal_connect(GTK_OBJECT(this->help_cardset_license), "activate",
			 GTK_SIGNAL_FUNC(GTK_DOKO::LicenseCardset::show_event),
			 &gui().license_cardset());
      gtk_signal_connect(GTK_OBJECT(this->help_about), "activate",
			 GTK_SIGNAL_FUNC(GTK_DOKO::About::show_event),
			 &gui().about());

      DEBUG_RETURNING(VOID,
		      INFO_GTK_MENU && INFO_GTK_INIT,
		      "void Menu::help_init()");
    } // void Menu::help_init()

} // namespace GTK_DOKO

#endif // #ifdef USE_UI_GTK
