/* ***********************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 "Wizard_Callbacks.h"
#include "Wizard_Interface.h"
#include "../Debug.h"


void Wizard_Bouton_Page1 ()
{
	gtk_widget_set_sensitive (button_wizard_Annuler, TRUE);
	gtk_widget_set_sensitive (button_wizard_Revenir, FALSE);
	gtk_widget_set_sensitive (button_wizard_Avancer, TRUE);
}

void Wizard_Bouton_Enable ()
{	
	gtk_widget_set_sensitive (button_wizard_Annuler, !(Wizard_Bouton_Annuler == NULL));
	gtk_widget_set_sensitive (button_wizard_Revenir, !(Wizard_Bouton_Revenir == NULL));
	gtk_widget_set_sensitive (button_wizard_Avancer, !(Wizard_Bouton_Avancer == NULL));	
}

void on_button_wizard_Annuler_clicked (GtkButton * button, gpointer user_data)
{
	DEBUG_ACTION_USER ();
	if (Wizard_Bouton_Annuler != NULL) {
		if (viewport_wizard_Contenu == NULL)
			debug_printf (INTERFACE, D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "viewport_wizard_Contenu==NULL");
		if (viewport_wizard_Contenu != NULL)
			gtk_widget_destroy (GTK_WIDGET (viewport_wizard_Contenu));
		else
			debug_printf (INTERFACE, D_WARN, __FILE__, __PRETTY_FUNCTION__, __LINE__, "viewport_wizard_Contenu==NULL");
		viewport_wizard_Contenu = NULL;
		(*Wizard_Bouton_Annuler) (NULL);
	}
	else
		debug_printf (INTERFACE, D_WARN_USER, __FILE__, __PRETTY_FUNCTION__, __LINE__, "Action indefini");
}


void on_button_wizard_Revenir_clicked (GtkButton * button, gpointer user_data)
{
	DEBUG_ACTION_USER ();
	if (Wizard_Bouton_Revenir != NULL) {
		if (viewport_wizard_Contenu == NULL)
			debug_printf (INTERFACE, D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "viewport_wizard_Contenu==NULL");
		if (viewport_wizard_Contenu != NULL)
			gtk_widget_destroy (GTK_WIDGET (viewport_wizard_Contenu));
		else
			debug_printf (INTERFACE, D_WARN, __FILE__, __PRETTY_FUNCTION__, __LINE__, "viewport_wizard_Contenu==NULL");
		viewport_wizard_Contenu = NULL;
		(*Wizard_Bouton_Revenir) (NULL);
	}

	
}


void on_button_wizard_Avancer_clicked (GtkButton * button, gpointer user_data)
{
	DEBUG_ACTION_USER ();
	if (Wizard_Bouton_Avancer_Post != NULL) {
		(*Wizard_Bouton_Avancer_Post) (NULL);
		if (!Post_Boolean)
			return;
	}
	if (Wizard_Bouton_Avancer != NULL) {
		if (viewport_wizard_Contenu == NULL)
			debug_printf (INTERFACE, D_ERRO, __FILE__, __PRETTY_FUNCTION__, __LINE__, "viewport_wizard_Contenu==NULL");
		if (viewport_wizard_Contenu != NULL)
			gtk_widget_destroy (GTK_WIDGET (viewport_wizard_Contenu));
		else
			debug_printf (INTERFACE, D_WARN, __FILE__, __PRETTY_FUNCTION__, __LINE__, "viewport_wizard_Contenu==NULL");
		viewport_wizard_Contenu = NULL;
		(*Wizard_Bouton_Avancer) (NULL);
	}

	
}


gboolean on_window_wizard_delete_event (GtkWidget * widget, GdkEvent * event, gpointer user_data)
{
	return TRUE;
}
