// src/statistics_container_window.cc - Copyright 2005, 2006, University
//               of Padova, dept. of Pure and Applied
//               Mathematics
//
// This file is part of SGPEMv2.
//
// This 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.
//
// SGPEMv2 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 should have received a copy of the GNU General Public License
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

#include "statistics_container_window.hh"
#include <glibmm/ustring.h>

#include <iostream>


using namespace Gtk;
using Gnome::Glade::Xml;
using namespace sgpem;
using namespace std;

StatisticsContainerWindow::StatisticsContainerWindow(const std::string& gladefile)
	: _refXml(Xml::create(gladefile))
{
	_refXml->get_widget("StatisticsWindow", _main_win);	
    // This just sets the title of our new window.
	_main_win->set_title(_("Simulation Statistics"));
	
	
	   
	ScrolledWindow *scroll1, *scroll2;
	_refXml->get_widget("SchedulableStatisticsScroll", scroll1);
	_tab_sched = manage(new TabularSchedulableStatisticsWidget());
	scroll1->add(*_tab_sched);
	
	_refXml->get_widget("SimulationStatisticsScroll", scroll2);
	_tab_sim = manage(new TabularSimulationStatisticsWidget());
	scroll2->add(*_tab_sim);
	  
	
	_main_win->show();

	scroll1->show();
	scroll2->show();
	_tab_sched->show();
	_tab_sim->show();
	
	_main_win->set_type_hint(Gdk::WINDOW_TYPE_HINT_UTILITY);
	/*
	_scrolled_tabular.add(_tabular_schedulables_statistics_widget);
	add(_scrolled_tabular);
	_scrolled_tabular.show();
	_tabular_schedulables_statistics_widget.show();
	
	_scrolled_tabular.get_hscrollbar()->property_visible() = true;
	_scrolled_tabular.get_vscrollbar()->property_visible() = true;
	*/
	//_scrolled_tabular.get_vscrollbar()->set_visible(true);
	
	/*cout << "\n\nSIIIIIIIIIIIIIIIIIIIII\n\n";
	if (_scrolled_tabular.get_vscrollbar_visible())
		cout << "\n\nSIIIIIIIIIIIIIIIIIIIII\n\n";
	else
		cout << "\n\nNNNNNNNNNNNNNNNOOOOOOOOOOO\n\n";
	*/
}
  
StatisticsContainerWindow::~StatisticsContainerWindow()
{
}

void									
StatisticsContainerWindow::make_child(Window& w)
{
	_main_win->set_transient_for(w);
}

TabularSimulationStatisticsWidget*   	
StatisticsContainerWindow::get_tabular_simulation_statistics_widget()
{
	return _tab_sim;	
}
																	 
TabularSchedulableStatisticsWidget*
StatisticsContainerWindow::get_tabular_schedulables_statistics_widget()
{
	return _tab_sched;
}

Window*									
StatisticsContainerWindow::get_main_window()
{
	return _main_win;
}

