///////////////////////////////////////////////////////////////////////////////////////////
// Authors: Eva Bunodiere, Yasmin Kossak
// splash.cpp
// Splash Class function definitions
// JPC36 Wx-View 
// July 25th 2000
// Technical Advisor : Carlos Moreno
///////////////////////////////////////////////////////////////////////////////////////////

#include "Splash.h"
#include "wx-view.h"

BEGIN_EVENT_TABLE(Splash, wxFrame)
    EVT_TIMER(ID_Timer, Splash::on_timer)
END_EVENT_TABLE()

/******************************************************************************************
	Function: Splash::on_timer()
	Receives: N/A
	Returns: N/A
	Description:
		Creates, centres and displays the Main (Wx-View)GUI Window.
*******************************************************************************************/
void Splash::on_timer()
{
    const int MARGIN = 2;

    const int w = wxSystemSettings::GetSystemMetric(wxSYS_SCREEN_X) - 2 * MARGIN;
    const int h = wxSystemSettings::GetSystemMetric(wxSYS_SCREEN_Y) - 2 * MARGIN;

	MainFrame * main = new MainFrame(translation["Wx-View 1.0"], wxPoint(MARGIN, MARGIN), wxSize(w,h));

    main->Centre();
    main->Show(true);
    Close(true);
}

/******************************************************************************************
	Function: Splash::Splash
	Receives: N/A (constructor)
	Returns: N/A (constructor)
	Description:
		Creates the splash page which is dispalyed for 5 seconds.
*******************************************************************************************/
Splash::Splash(const wxPoint& pos, const wxSize& size)
    : wxFrame(NULL, -1, "", pos, size, wxSIMPLE_BORDER | wxCAPTION)
{
    timer = new wxTimer (this, ID_Timer);
    timer->Start(2000, true);

    wxStaticBitmap * bmpCtrl = new wxStaticBitmap (this, -1, wxBitmap("splash.bmp", wxBITMAP_TYPE_BMP), wxPoint(0, 0));
    bmpCtrl->Show(true);
}
