/* ***********************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 <gtk/gtk.h>

#include "Alert_Callbacks.h"
#include "Alert_Interface.h"
#include "Root_Interface.h"
#include "Maemo.h"
#include "../Declaration_Constante.h"
#include "../Style.h"

void Affiche_Win_Alert(void){
	if (win_Alert==NULL)
		create_win_Alert();
	gtk_widget_show (win_Alert);
}


void create_win_Alert (void)
{
#ifndef         __MAEMO
	win_Alert = gtk_window_new (GTK_WINDOW_POPUP);
#else
	win_Alert = gtk_window_new_maemo ();
#endif
	gtk_widget_set_size_request (win_Alert, 350, 188);
	gtk_container_set_border_width (GTK_CONTAINER (win_Alert), 2);
	gtk_window_set_title (GTK_WINDOW (win_Alert), "Alert");
	gtk_window_set_resizable (GTK_WINDOW (win_Alert), FALSE);
	gtk_window_set_decorated (GTK_WINDOW (win_Alert), FALSE);
	gtk_window_set_modal (GTK_WINDOW (win_Alert), TRUE);
	gtk_window_set_position (GTK_WINDOW (win_Alert), GTK_WIN_POS_CENTER_ON_PARENT);
	gtk_window_set_transient_for (GTK_WINDOW (win_Alert), GTK_WINDOW (window_root));

	viewport_Alert = gtk_viewport_new (NULL, NULL);
	gtk_widget_show (viewport_Alert);
	gtk_container_add (GTK_CONTAINER (win_Alert), viewport_Alert);
	gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport_Alert), GTK_SHADOW_NONE);

	vbox_Alert = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vbox_Alert);
	gtk_container_add (GTK_CONTAINER (viewport_Alert), vbox_Alert);

	image_Alert1 = gtk_image_new_from_file (PATH_ICONE "Alert.gif");
	gtk_widget_show (image_Alert1);
	gtk_box_pack_start (GTK_BOX (vbox_Alert), image_Alert1, FALSE, TRUE, 0);

	viewport_Haut = gtk_viewport_new (NULL, NULL);
	gtk_widget_show (viewport_Haut);
	gtk_box_pack_start (GTK_BOX (vbox_Alert), viewport_Haut, FALSE, FALSE, 0);
	gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport_Haut), GTK_SHADOW_NONE);

	label_Alert_Haut = gtk_label_new ("<span size='xx-large' foreground='#d94545' background='#000000'><b> Alert notification </b></span>");
	gtk_widget_show (label_Alert_Haut);
	gtk_container_add (GTK_CONTAINER (viewport_Haut), label_Alert_Haut);
	gtk_label_set_use_markup (GTK_LABEL (label_Alert_Haut), TRUE);

	image_Alert2 = gtk_image_new_from_file (PATH_ICONE "Alert.gif");
	gtk_widget_show (image_Alert2);
	gtk_box_pack_start (GTK_BOX (vbox_Alert), image_Alert2, FALSE, TRUE, 0);

	label_Info_Alert = gtk_label_new ("Host [------------] is -----");
	gtk_widget_show (label_Info_Alert);
	gtk_box_pack_start (GTK_BOX (vbox_Alert), label_Info_Alert, FALSE, FALSE, 9);
	gtk_widget_set_size_request (label_Info_Alert, -1, 70);

	image_Alert3 = gtk_image_new_from_file (PATH_ICONE "Alert.gif");
	gtk_widget_show (image_Alert3);
	gtk_box_pack_start (GTK_BOX (vbox_Alert), image_Alert3, FALSE, TRUE, 0);

	viewport_Bas = gtk_viewport_new (NULL, NULL);
	gtk_widget_show (viewport_Bas);
	gtk_box_pack_start (GTK_BOX (vbox_Alert), viewport_Bas, FALSE, TRUE, 0);
	gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport_Bas), GTK_SHADOW_NONE);

	label_Alert_Bas = gtk_label_new ("<span size='xx-large' foreground='#d94545' background='#000000'><b> Alert notification </b></span>");
	gtk_widget_show (label_Alert_Bas);
	gtk_container_add (GTK_CONTAINER (viewport_Bas), label_Alert_Bas);
	gtk_label_set_use_markup (GTK_LABEL (label_Alert_Bas), TRUE);

	image_Alert4 = gtk_image_new_from_file (PATH_ICONE "Alert.gif");
	gtk_widget_show (image_Alert4);
	gtk_box_pack_start (GTK_BOX (vbox_Alert), image_Alert4, FALSE, TRUE, 0);

	g_signal_connect ((gpointer) win_Alert, "button_press_event", G_CALLBACK (on_win_Alert_button_press_event), NULL);

	Modifie_BackGround_Fenetre (win_Alert, 0, 0, 0);
	Modifie_BackGround_Fenetre (viewport_Alert, 0xFD02, 0xFC03, 0);
	Modifie_BackGround_Fenetre (viewport_Haut, 0, 0, 0);
	Modifie_BackGround_Fenetre (viewport_Bas, 0, 0, 0);
}
