/*============================================================================*

	SUITE:		e-Scrabble
	FILE:		menu.c
	
	COPYRIGHT NOTICE:
	
	Copyright (C) 2001 Players Inc, All Rights Reserved

	THIS MATERIAL IS PROVIDED FOR ACADEMIC USE ONLY, you may modify it
	provided this copyright notice is preserved, however you may not
	redistribute it, or use it for commercial purposes without prior
	written permission of the authors.

	Direct questions, comments, or bug reports to:
	aul@ecf.utoronto.ca
	ticku@ecf.utoronto.ca
	varia@ecf.utoronto.ca	

*============================================================================*/


#include <gtk/gtk.h>
#include "user_events.h"
#include "menu.h"


extern GtkWidget *window;
extern GtkWidget *vbox;


/* Menu Structure, Label, and Accelerator Declarations */
static GtkItemFactoryEntry menu_items[] = {
	{ "/_Game",			NULL,		NULL, 0, "<Branch>" },
	{ "/Game/_New Game",	"<control>N",	menu_game_new, 0, NULL },
	{ "/Game/_Add AP",	"<control>A",	menu_add_ap, 0, NULL },	
	{ "/Game/_Resign",		"<control>R",	menu_game_resign, 0, NULL },
	{ "/Game/sep1",		NULL,		NULL, 0, "<Separator>" },
	{ "/Game/_Save Game",	"<control>S",	menu_game_save, 0, NULL },
	{ "/Game/_Load Game",	"<control>L",	menu_game_restore, 0, NULL },
	{ "/Game/sep2",		NULL,		NULL, 0, "<Separator>" },
	{ "/Game/_Quit",		"<control>Q",	menu_game_end, 0, NULL },
		
	{ "/_Help",			NULL,		NULL, 0, "<LastBranch>" },
	{ "/Help/_Game Info",		"<control>G",	menu_help_about, 0, NULL }
};



void
create_menu()
{
	GtkWidget *menu_bar;
	GtkItemFactory *item_factory;
	GtkAccelGroup *accel_group;
	gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
	
	accel_group = gtk_accel_group_new ();

	item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>",
									accel_group);
	gtk_item_factory_create_items (item_factory, nmenu_items, menu_items,
									NULL);
	
	gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
	
	menu_bar = gtk_item_factory_get_widget (item_factory, "<main>");

	gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 2);
	gtk_widget_show(menu_bar);
	
}


