/* ***********************IMPORTANT *********************************************
 *  Copyright (C) 2004-2007 Thierry Lagarde <tlagarde@users.sourceforge.net>
 *  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.
 *
 *
 *                      ********************
 *
 *
 *  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 Library General Public License for more details.
 *
 *
 *                      ********************
 *
 *
 * You are highly encouraged to send your changes to <tlagarde@users.sourceforge.net>
 * for possible incorporation into the main distribution.
 * By sending these changes to <tlagarde@users.sourceforge.net>,
 * it is assumed that you are offering <tlagarde@users.sourceforge.net>
 * the unlimited, non-exclusive right to reuse, modify, and relicense the code.
 *
 *
 *                      ********************
 *
 *  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.
 **************************************************************************************/
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>

#include "Wizard_Callbacks.h"
#include "Wizard_Interface.h"
#include "Root_Interface.h"
#include "../Declaration_Constante.h"
#include "../Image.h"

void create_window_wizard (void)
{

	Couleur_Bleu.red = 26471;
	Couleur_Bleu.green = 36237;
	Couleur_Bleu.blue = 45745;
	gdk_colormap_alloc_color (gdk_colormap_get_system (), &Couleur_Bleu, 1, 1);
	Couleur_Blanc.red = 65535;
	Couleur_Blanc.green = 65535;
	Couleur_Blanc.blue = 65535;
	gdk_colormap_alloc_color (gdk_colormap_get_system (), &Couleur_Blanc, 1, 1);

#ifndef         __MAEMO
	window_wizard = gtk_window_new (GTK_WINDOW_TOPLEVEL);
#else
	window_wizard = gtk_window_new_maemo (); 
#endif
	gtk_widget_set_size_request (window_wizard, 650, 484);
	gtk_window_set_title (GTK_WINDOW (window_wizard), "Wizard");
	gtk_window_set_resizable (GTK_WINDOW (window_wizard), TRUE);
	
	gtk_window_set_modal (GTK_WINDOW (window_wizard), TRUE);
	gtk_window_set_position (GTK_WINDOW (window_wizard), GTK_WIN_POS_CENTER_ON_PARENT);
	gtk_window_set_transient_for (GTK_WINDOW (window_wizard), GTK_WINDOW (window_root));
	
	about_icon_pixbuf = Chargement_Image (PATH_ICONE "AutoScan.png", COULEUR);
	if (about_icon_pixbuf) {
		gtk_window_set_icon (GTK_WINDOW (window_wizard), about_icon_pixbuf);
		gdk_pixbuf_unref (about_icon_pixbuf);
	}
	gtk_window_set_type_hint (GTK_WINDOW (window_wizard), GDK_WINDOW_TYPE_HINT_DIALOG);
	gtk_window_set_transient_for (GTK_WINDOW (window_wizard), GTK_WINDOW (window_root));

	vbox_wizard = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vbox_wizard);
	gtk_container_add (GTK_CONTAINER (window_wizard), vbox_wizard);

	eventbox_wizard_Titre = gtk_event_box_new ();
	gtk_widget_show (eventbox_wizard_Titre);
	gtk_box_pack_start (GTK_BOX (vbox_wizard), eventbox_wizard_Titre, FALSE, TRUE, 0);

	hbox_wizard_Titre = gtk_hbox_new (FALSE, 70);
	gtk_widget_modify_bg (eventbox_wizard_Titre, GTK_STATE_NORMAL, &Couleur_Bleu);
	gtk_widget_show (hbox_wizard_Titre);
	gtk_container_set_border_width (GTK_CONTAINER (hbox_wizard_Titre), 7);
	gtk_container_add (GTK_CONTAINER (eventbox_wizard_Titre), hbox_wizard_Titre);

	label_wizard = gtk_label_new ("<span foreground=\"white\" font_desc=\"18\"><b>Titre</b></span>");
	gtk_widget_show (label_wizard);
	gtk_box_pack_start (GTK_BOX (hbox_wizard_Titre), label_wizard, FALSE, FALSE, 0);
	gtk_label_set_use_markup (GTK_LABEL (label_wizard), TRUE);

	image_wizard = gtk_image_new_from_file (PATH_ICONE "Logo_32.png");
	gtk_widget_show (image_wizard);
	gtk_box_pack_end (GTK_BOX (hbox_wizard_Titre), image_wizard, FALSE, TRUE, 9);

	scrolledwindow_wizard = gtk_scrolled_window_new (NULL, NULL);
	gtk_widget_show (scrolledwindow_wizard);
	gtk_box_pack_start (GTK_BOX (vbox_wizard), scrolledwindow_wizard, TRUE, TRUE, 0);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_wizard), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

	viewport_wizard = gtk_viewport_new (NULL, NULL);
	gtk_widget_show (viewport_wizard);
	gtk_container_add (GTK_CONTAINER (scrolledwindow_wizard), viewport_wizard);
	gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport_wizard), GTK_SHADOW_NONE);


	hbox_wizard_Bouton = gtk_hbox_new (FALSE, 4);
	gtk_widget_show (hbox_wizard_Bouton);
	gtk_box_pack_start (GTK_BOX (vbox_wizard), hbox_wizard_Bouton, FALSE, TRUE, 4);

	fixed_wizard_Bouton = gtk_fixed_new ();
	gtk_widget_show (fixed_wizard_Bouton);
	gtk_box_pack_start (GTK_BOX (hbox_wizard_Bouton), fixed_wizard_Bouton, TRUE, TRUE, 0);

	button_wizard_Annuler = gtk_button_new_from_stock ("gtk-cancel");
	gtk_widget_show (button_wizard_Annuler);
	gtk_box_pack_start (GTK_BOX (hbox_wizard_Bouton), button_wizard_Annuler, FALSE, FALSE, 0);

	button_wizard_Revenir = gtk_button_new_from_stock ("gtk-go-back");
	gtk_widget_show (button_wizard_Revenir);
	gtk_box_pack_start (GTK_BOX (hbox_wizard_Bouton), button_wizard_Revenir, FALSE, FALSE, 0);

	button_wizard_Avancer = gtk_button_new_from_stock ("gtk-go-forward");
	gtk_widget_show (button_wizard_Avancer);
	gtk_box_pack_start (GTK_BOX (hbox_wizard_Bouton), button_wizard_Avancer, FALSE, FALSE, 0);

	g_signal_connect ((gpointer) button_wizard_Annuler, "clicked", G_CALLBACK (on_button_wizard_Annuler_clicked), NULL);
	g_signal_connect ((gpointer) button_wizard_Revenir, "clicked", G_CALLBACK (on_button_wizard_Revenir_clicked), NULL);
	g_signal_connect ((gpointer) button_wizard_Avancer, "clicked", G_CALLBACK (on_button_wizard_Avancer_clicked), NULL);
	g_signal_connect ((gpointer) window_wizard, "delete_event", G_CALLBACK (on_window_wizard_delete_event), NULL);

	Wizard_Bouton_Annuler = NULL;
	Wizard_Bouton_Revenir = NULL;
	Wizard_Bouton_Avancer_Post = NULL;
	Wizard_Bouton_Avancer = NULL;
	viewport_wizard_Contenu = NULL;
}
