/*
	Rogue Trader.
	Copyright (c) 2007, Darragh Coy.
	All rights reserved.
	Original work(s), source code & author(s) details available at: http://www.darraghcoy.com

	Redistribution and use in source and binary forms, with or without modification, are permitted 
	provided that the following conditions are met:

		* 	Redistributions of source code must retain the above copyright notice, this list of 
			conditions and the following disclaimer.
		* 	Redistributions in binary form must reproduce the above copyright notice, this list of 
			conditions and the following disclaimer in the documentation.
		* 	Neither the name of the author nor the names of contributors may be used to endorse or 
			promote products derived from this software without specific prior written permission.
		* 	The use of any third party libraries, modules or data files provided with the source 
			form of the program must follow and respect the individual licensing terms of these 
			components. You do not have permission to modify or circumvent the licensing terms for 
			provided third party components unless the third party licenses specifically allow this. 
			If you do not agree to the terms of provided third party components then you do not have 
			permission to use them in your derived work(s).
		* 	The terms of this license do not apply to separate (but related) distributions if supplied 
			by the author(s), only to the contents of this source distribution, derived works, and the 
			binaries produced by either modified or unmodified versions of the source code. The terms 
			of this license do not also apply to any third party libraries or components provided with 
			the source distribution. Such third party elements are licensed under their own separate 
			agreements.

	THIS SOFTWARE IS PROVIDED BY DARRAGH COY ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
	BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
	ARE DISCLAIMED. IN NO EVENT SHALL DARRAGH COY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
	EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
	OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
	OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
	IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

//##############################################################################
//##############################################################################
//##############################################################################
//##############################################################################
//
//
// Class Name:   GuiScreen_SpaceStation
// Purpose:      Gui screen which is displayed when the player gets into a spacestation.
//
//
//##############################################################################
//##############################################################################
//##############################################################################
//##############################################################################

#include "GuiScreen_SpaceStation.h"
#include "SaveDataFolder.h"

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Name:     GuiScreen_SpaceStation::GuiScreen_SpaceStation()
Purpose:  Constructor for this gui screen. populates the screen with widgets.
Params:   pointer to a game
Returns:  n/a

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

GuiScreen_SpaceStation::GuiScreen_SpaceStation( Game * game )
{
    //--------------------------------------------------------------------------
    // Create the event listeners for the gui screen
    //--------------------------------------------------------------------------

    eventTrade    = new EventTrade(this);
    eventMap      = new EventMap(this);
    eventUpgrade  = new EventUpgrade(this);
    eventRepair   = new EventRepair(this);
    eventBuyShip  = new EventBuyShip(this);
    eventLoad     = new EventLoad(this);
    eventSave     = new EventSave(this);
    eventLaunch   = new EventLaunch(this);

    //--------------------------------------------------------------------------
    // Create the main gui panel and set its attributes
    //--------------------------------------------------------------------------

    // Create panel

    GuiPanel * mainPanel = new GuiPanel();

    // Set panel size

    mainPanel->setSize( 750 , 550 );

    // center the panel in the middle of the window

    {
		// Get the effective or virtual resolution of the game:
		float effectiveResX = 0;
		float effectiveResY = 0;
		Game::getEffectiveResolution(effectiveResX, effectiveResY);

		// Center the panel within that 'effective' resolution
		mainPanel->setPosition
		(
			(int) effectiveResX / 2 - mainPanel->getSizeX() / 2,
			(int) effectiveResY / 2 - mainPanel->getSizeY() / 2
		);
    }

    // Add the main panel into the gui

    addWidget(mainPanel);
    
    //--------------------------------------------------------------------------
    // Get the paths to the save game files:
    //--------------------------------------------------------------------------
    
    std::string save_file_1 = SaveDataFolder::GetSaveFolder("Darragh Coy\\Rogue Trader") + std::string("\\save1.sav");
    std::string save_file_2 = SaveDataFolder::GetSaveFolder("Darragh Coy\\Rogue Trader") + std::string("\\save2.sav");
    std::string save_file_3 = SaveDataFolder::GetSaveFolder("Darragh Coy\\Rogue Trader") + std::string("\\save3.sav");
    std::string save_file_4 = SaveDataFolder::GetSaveFolder("Darragh Coy\\Rogue Trader") + std::string("\\save4.sav");
    std::string save_file_5 = SaveDataFolder::GetSaveFolder("Darragh Coy\\Rogue Trader") + std::string("\\save5.sav");       

    //--------------------------------------------------------------------------
    // Create the side bar title panel: this is acually an image
    //--------------------------------------------------------------------------

    // Create panel

    GuiImage * sideTitlePanel = new GuiImage();

    // Set image for the panel:

    sideTitlePanel->setImage( const_cast<GLTexture*>(GLTextureManager::getTexMenuTitlePanel()) );

    // Set panel size

    sideTitlePanel->setSize( 256, 64 );

    // Set panel position

    sideTitlePanel->setPosition(8,8);

    // Add the main panel into the gui

    mainPanel->addWidget(sideTitlePanel);

    //--------------------------------------------------------------------------
    // Create a side bar panel to hold the buttons: again an image
    //--------------------------------------------------------------------------

    // Create panel

    GuiImage * sidePanel = new GuiImage();

    // Set image for the panel:

    sidePanel->setImage( const_cast<GLTexture*>(GLTextureManager::getTexMenuButtonPanel()) );

    // Set panel size

    sidePanel->setSize( 256, 512 );

    // Set panel position

    sidePanel->setPosition(8,58);

    // Add the main panel into the gui

    mainPanel->addWidget(sidePanel);

    //--------------------------------------------------------------------------
    // Create the side bar title
    //--------------------------------------------------------------------------

    // Create the label

    GuiLabel * sideTitle = new GuiLabel();

    // Set the label

    sideTitle->setLabel("Dock menu");

    // Get the big font from the font manager

    GLFont * bigFont = GLFontManager::getFont_big();

    // Set the label font

    sideTitle->setFont(bigFont);

    // Set the label font size

    sideTitle->setFontSize(16);

    // Set the label position

    sideTitle->setPosition(24,20);

    // Add it into the side bar panel

    mainPanel->addWidget(sideTitle);

    //--------------------------------------------------------------------------
    // Create the trade panel
    //--------------------------------------------------------------------------

    // Create panel

    panelTrade = new GuiPanel();

    panelTrade->setRaised(false);
    panelTrade->setSize( 526, 534 );
    panelTrade->setPosition(216,8);
    panelTrade->setColor(0.3f,0.3f,0.3f);

    // Create the panel tiltle:

    GuiLabel * tradeTitle = new GuiLabel();

    tradeTitle->setFont(bigFont);
    tradeTitle->setLabel("Trade goods");
    tradeTitle->setFontSize(16);
    tradeTitle->setPosition(20,15);
    tradeTitle->setColor(1,1,1);

    panelTrade->addWidget(tradeTitle);

    // Create a horizontal rule to go under the title

    GuiHRule * tradeRule = new GuiHRule();

    tradeRule->setColor(1,1,1);
    tradeRule->setSize(486,4);
    tradeRule->setPosition(20,40);

    panelTrade->addWidget(tradeRule);

    // Create a big title to go above the buy widget:

    GuiLabel * buyTitle = new GuiLabel();

    buyTitle->setFont(bigFont);
    buyTitle->setLabel("Buy");
    buyTitle->setFontSize(16);
    buyTitle->setPosition(20,60);
    buyTitle->setColor(1,1,1);

    panelTrade->addWidget(buyTitle);

    // Create a panel to hold the buy widget

    GuiPanel * buyPanel = new GuiPanel();

    buyPanel->setRaised(false);
    buyPanel->setSize(486,168);
    buyPanel->setPosition(20,80);
    buyPanel->setColor(0.3f,0.3f,0.3f);

    panelTrade->addWidget(buyPanel);

    // Create a buy widget and add it into the buy panel:

    GuiTrade_Buy * buyWidget = new GuiTrade_Buy(game);

    buyWidget->setSize(484,166);
    buyWidget->setPosition(0,0);

    buyPanel->addWidget(buyWidget);

    // Create a big title to go above the sell widget:

    GuiLabel * sellTitle = new GuiLabel();

    sellTitle->setFont(bigFont);
    sellTitle->setLabel("Sell");
    sellTitle->setFontSize(16);
    sellTitle->setPosition(20,258);
    sellTitle->setColor(1,1,1);

    panelTrade->addWidget(sellTitle);

    // Create a panel to hold the sell widget

    GuiPanel * sellPanel = new GuiPanel();

    sellPanel->setRaised(false);
    sellPanel->setSize(486,168);
    sellPanel->setPosition(20,278);
    sellPanel->setColor(0.3f,0.3f,0.3f);

    panelTrade->addWidget(sellPanel);

    // Create a sell widget and add it into the sell panel:

    GuiTrade_Sell * sellWidget = new GuiTrade_Sell(game);

    sellWidget->setSize(484,166);
    sellWidget->setPosition(0,0);

    sellPanel->addWidget(sellWidget);

    // Create a big title to go above the status widget:

    GuiLabel * statusTitle = new GuiLabel();

    statusTitle->setFont(bigFont);
    statusTitle->setLabel("Status");
    statusTitle->setFontSize(16);
    statusTitle->setPosition(20,454);
    statusTitle->setColor(1,1,1);

    panelTrade->addWidget(statusTitle);

    // Create a panel to hold the status widget

    GuiPanel * statusPanel = new GuiPanel();

    statusPanel->setRaised(false);
    statusPanel->setSize(486,46);
    statusPanel->setPosition(20,478);
    statusPanel->setColor(0.3f,0.3f,0.3f);

    panelTrade->addWidget(statusPanel);

    // Create the status widget and put in the status panel

    GuiTrade_Status * status = new GuiTrade_Status(game);

    status->setPosition(0,0);
    status->setSize(484,44);

    statusPanel->addWidget(status);


    // Add the panel into the main gui panel

    mainPanel->addWidget(panelTrade);

    //--------------------------------------------------------------------------
    // Create the Map panel
    //--------------------------------------------------------------------------

    // Create panel

    panelMap = new GuiPanel();

    panelMap->setRaised(false);
    panelMap->setSize( 526, 534 );
    panelMap->setPosition(216,8);
    panelMap->setColor(0.3f,0.3f,0.3f);

    // Create the panel tiltle:

    GuiLabel * mapTitle = new GuiLabel();

    mapTitle->setFont(bigFont);
    mapTitle->setLabel("Galactic map");
    mapTitle->setFontSize(16);
    mapTitle->setPosition(20,15);
    mapTitle->setColor(1,1,1);

    panelMap->addWidget(mapTitle);

    // Create a horizontal rule to go under the title

    GuiHRule * mapRule = new GuiHRule();

    mapRule->setColor(1,1,1);
    mapRule->setSize(486,4);
    mapRule->setPosition(20,40);

    panelMap->addWidget(mapRule);

    // Create a panel to stick the actual galactic map widget in:

    GuiPanel * mapDisplayPanel = new GuiPanel();

    mapDisplayPanel->setRaised(false);
    mapDisplayPanel->setSize( 486, 320 );
    mapDisplayPanel->setPosition(20,60);
    mapDisplayPanel->setColor(0.3f,0.3f,0.3f);

    panelMap->addWidget(mapDisplayPanel);

    // Create a galaxy map and add it into this panel:

    this->galacticMap = new GuiGalaxyMap(game,this,false);

    galacticMap->setPosition(2,2);
    galacticMap->setSize(482,316);
    galacticMap->centerView();

    mapDisplayPanel->addWidget(galacticMap);

    // Create a panel to hold the star information widget:

    GuiPanel * starInformationPanel = new GuiPanel();

    starInformationPanel->setRaised(false);
    starInformationPanel->setSize( 130, 140 );
    starInformationPanel->setPosition(20,384);
    starInformationPanel->setColor(0.3f,0.3f,0.3f);

    panelMap->addWidget(starInformationPanel);

    // Create the star information widget and add it to this panel

    GuiStarInfo * starInfo = new GuiStarInfo(galacticMap,game);

    starInfo->setSize( 128, 138 );
    starInfo->setPosition(0,0);

    starInformationPanel->addWidget(starInfo);

    // Create another panel to hold the market information widget

    GuiPanel * marketInformationPanel = new GuiPanel();

    marketInformationPanel->setRaised(false);
    marketInformationPanel->setSize( 350, 140 );
    marketInformationPanel->setPosition(156,384);
    marketInformationPanel->setColor(0.3f,0.3f,0.3f);

    panelMap->addWidget(marketInformationPanel);

    // Create the market information widget and add it to this panel:

    GuiMarketInfo * marketInfo = new GuiMarketInfo(game,galacticMap);

    marketInfo->setSize(348,138);
    marketInfo->setPosition(0,0);

    marketInformationPanel->addWidget(marketInfo);

    // Add the panel into the main gui panel

    mainPanel->addWidget(panelMap);

    //--------------------------------------------------------------------------
    // Create the upgrade panel
    //--------------------------------------------------------------------------

    // Create panel

    panelUpgrade = new GuiPanel();

    panelUpgrade->setRaised(false);
    panelUpgrade->setSize( 526, 534 );
    panelUpgrade->setPosition(216,8);
    panelUpgrade->setColor(0.3f,0.3f,0.3f);

    // Create the panel tiltle:

    GuiLabel * upgradeTitle = new GuiLabel();

    upgradeTitle->setFont(bigFont);
    upgradeTitle->setLabel("Ship upgrades");
    upgradeTitle->setFontSize(16);
    upgradeTitle->setPosition(20,15);
    upgradeTitle->setColor(1,1,1);

    panelUpgrade->addWidget(upgradeTitle);

    // Create a horizontal rule to go under the title

    GuiHRule * upgradeRule = new GuiHRule();

    upgradeRule->setColor(1,1,1);
    upgradeRule->setSize(486,4);
    upgradeRule->setPosition(20,40);

    panelUpgrade->addWidget(upgradeRule);

    // Create a sub-panel to go in the upgrade panel to hold the ship upgrade widget

    GuiPanel * panelUpgradeWidget = new GuiPanel();

    panelUpgradeWidget->setRaised(false);
    panelUpgradeWidget->setSize( 486, 464 );
    panelUpgradeWidget->setPosition( 20 , 60 );
    panelUpgradeWidget->setColor(0.3f,0.3f,0.3f);

    panelUpgrade->addWidget(panelUpgradeWidget);

    // Create the upgrade widget and add it into the widget sub panel:

    GuiUpgrade * upgrade = new GuiUpgrade(game);

    upgrade->setPosition(0,0);
    upgrade->setSize(484,462);

    panelUpgradeWidget->addWidget(upgrade);

    // Add the panel into the main gui panel

    mainPanel->addWidget(panelUpgrade);

    //--------------------------------------------------------------------------
    // Create the repair panel
    //--------------------------------------------------------------------------

    // Create panel

    panelRepair = new GuiPanel();

    panelRepair->setRaised(false);
    panelRepair->setSize( 526, 534 );
    panelRepair->setPosition(216,8);
    panelRepair->setColor(0.3f,0.3f,0.3f);

    // Create the panel title:

    GuiLabel * repairTitle = new GuiLabel();

    repairTitle->setFont(bigFont);
    repairTitle->setLabel("Ship repairs");
    repairTitle->setFontSize(16);
    repairTitle->setPosition(20,15);
    repairTitle->setColor(1,1,1);

    panelRepair->addWidget(repairTitle);

    // Create a horizontal rule to go under the title

    GuiHRule * repairRule = new GuiHRule();

    repairRule->setColor(1,1,1);
    repairRule->setSize(486,4);
    repairRule->setPosition(20,40);

    panelRepair->addWidget(repairRule);

    // Create a sub-panel to go in the repair panel to hold the ship repairs widget

    GuiPanel * panelShipRepairs = new GuiPanel();

    panelShipRepairs->setRaised(false);
    panelShipRepairs->setSize( 486, 464 );
    panelShipRepairs->setPosition( 20 , 60 );
    panelShipRepairs->setColor(0.3f,0.3f,0.3f);

    panelRepair->addWidget(panelShipRepairs);

    // Create the repair widget and add it into the repair sub panel:

    GuiRepair * repairWidget = new GuiRepair(game);

    repairWidget->setPosition(0,0);
    repairWidget->setSize(484,462);

    panelShipRepairs->addWidget(repairWidget);

    // Add the panel into the main gui panel

    mainPanel->addWidget(panelRepair);

    //--------------------------------------------------------------------------
    // Create the buyShip panel
    //--------------------------------------------------------------------------

    // Create panel

    panelBuyShip = new GuiPanel();

    panelBuyShip->setRaised(false);
    panelBuyShip->setSize( 526, 534 );
    panelBuyShip->setPosition(216,8);
    panelBuyShip->setColor(0.3f,0.3f,0.3f);

    // Create the title above the select ship widget:

    GuiLabel * selectShipTitle = new GuiLabel();

    selectShipTitle->setFont(bigFont);
    selectShipTitle->setLabel("Select ship");
    selectShipTitle->setFontSize(16);
    selectShipTitle->setPosition(18,16);
    selectShipTitle->setColor(1,1,1);

    panelBuyShip->addWidget(selectShipTitle);

    // Create a sub-panel to hold the ship selection widget

    GuiPanel * panelShipSelect = new GuiPanel();

    panelShipSelect->setRaised(false);
    panelShipSelect->setSize( 486, 128 );
    panelShipSelect->setPosition( 20 , 40 );
    panelShipSelect->setColor(0.3f,0.3f,0.3f);

    panelBuyShip->addWidget(panelShipSelect);

    // Create the ship selection widget and add it to its sub panel

    GuiBuyShip_Select * shipSelect = new GuiBuyShip_Select();

    shipSelect->setSize( 484, 126 );
    shipSelect->setPosition(0,0);

    panelShipSelect->addWidget(shipSelect);

    // Add all the ships available to purchase into the ship selection widget:

    shipSelect->addShip( Ship_ExplorerMark1(0,0,0) );
    shipSelect->addShip( Ship_ExplorerMark2(0,0,0) );
    shipSelect->addShip( Ship_FighterMark1(0,0,0)  );
    shipSelect->addShip( Ship_FighterMark2(0,0,0)  );

    // Create the title above the buy ship widget:

    GuiLabel * buyShipTitle = new GuiLabel();

    buyShipTitle->setFont(bigFont);
    buyShipTitle->setLabel("Buy ship");
    buyShipTitle->setFontSize(16);
    buyShipTitle->setPosition(18,176);
    buyShipTitle->setColor(1,1,1);

    panelBuyShip->addWidget(buyShipTitle);

    // Create a sub-panel to hold the ship buy widget

    GuiPanel * panelShipBuyWidget = new GuiPanel();

    panelShipBuyWidget->setRaised(false);
    panelShipBuyWidget->setSize( 486, 324 );
    panelShipBuyWidget->setPosition( 20 , 200 );
    panelShipBuyWidget->setColor(0.3f,0.3f,0.3f);

    panelBuyShip->addWidget(panelShipBuyWidget);

    // Create the actual buy ship widget:

    GuiBuyShip_Buy * shipBuy = new GuiBuyShip_Buy( game , shipSelect );

    shipBuy->setPosition(0,0);
    shipBuy->setSize(484,322);

    panelShipBuyWidget->addWidget(shipBuy);

    // Add the panel into the main gui panel

    mainPanel->addWidget(panelBuyShip);

    //--------------------------------------------------------------------------
    // Create the load panel
    //--------------------------------------------------------------------------

    // Create panel

    panelLoad = new GuiPanel();

    panelLoad->setRaised(false);
    panelLoad->setSize( 526, 534 );
    panelLoad->setPosition(216,8);
    panelLoad->setColor(0.3f,0.3f,0.3f);

    // Create the panel tiltle:

    GuiLabel * loadTitle = new GuiLabel();

    loadTitle->setFont(bigFont);
    loadTitle->setLabel("Load game");
    loadTitle->setFontSize(16);
    loadTitle->setPosition(20,15);
    loadTitle->setColor(1,1,1);

    panelLoad->addWidget(loadTitle);

    // Create a horizontal rule to go under the title

    GuiHRule * loadRule = new GuiHRule();

    loadRule->setColor(1,1,1);
    loadRule->setSize(486,4);
    loadRule->setPosition(20,40);

    panelLoad->addWidget(loadRule);

    // Create a couple of load game widgets to go on this panel:

    GuiLoadGame * loadGame1 = new GuiLoadGame( game , save_file_1.c_str() );

    loadGame1->setSize(486,75);
    loadGame1->setPosition(20,60);

    panelLoad->addWidget(loadGame1);

    GuiLoadGame * loadGame2 = new GuiLoadGame( game , save_file_2.c_str() );

    loadGame2->setSize(486,75);
    loadGame2->setPosition(20,140);

    panelLoad->addWidget(loadGame2);

    GuiLoadGame * loadGame3 = new GuiLoadGame( game , save_file_3.c_str() );

    loadGame3->setSize(486,75);
    loadGame3->setPosition(20,220);

    panelLoad->addWidget(loadGame3);

    GuiLoadGame * loadGame4 = new GuiLoadGame( game , save_file_4.c_str() );

    loadGame4->setSize(486,75);
    loadGame4->setPosition(20,300);

    panelLoad->addWidget(loadGame4);

    GuiLoadGame * loadGame5 = new GuiLoadGame( game , save_file_5.c_str() );

    loadGame5->setSize(486,75);
    loadGame5->setPosition(20,380);

    panelLoad->addWidget(loadGame5);

    // Add the panel into the main gui panel

    mainPanel->addWidget(panelLoad);

    //--------------------------------------------------------------------------
    // Create the save panel
    //--------------------------------------------------------------------------

    // Create panel

    panelSave = new GuiPanel();

    panelSave->setRaised(false);
    panelSave->setSize( 526, 534 );
    panelSave->setPosition(216,8);
    panelSave->setColor(0.3f,0.3f,0.3f);

    // Create the panel tiltle:

    GuiLabel * saveTitle = new GuiLabel();

    saveTitle->setFont(bigFont);
    saveTitle->setLabel("Save game");
    saveTitle->setFontSize(16);
    saveTitle->setPosition(20,15);
    saveTitle->setColor(1,1,1);

    panelSave->addWidget(saveTitle);

    // Create a horizontal rule to go under the title

    GuiHRule * saveRule = new GuiHRule();

    saveRule->setColor(1,1,1);
    saveRule->setSize(486,4);
    saveRule->setPosition(20,40);

    panelSave->addWidget(saveRule); 

    // Create a couple of save game widgets to go on this panel:

    GuiSaveGame * saveGame1 = new GuiSaveGame( game , save_file_1.c_str() );

    saveGame1->setSize(486,75);
    saveGame1->setPosition(20,60);

    panelSave->addWidget(saveGame1);

    GuiSaveGame * saveGame2 = new GuiSaveGame( game , save_file_2.c_str() );

    saveGame2->setSize(486,75);
    saveGame2->setPosition(20,140);

    panelSave->addWidget(saveGame2);

    GuiSaveGame * saveGame3 = new GuiSaveGame( game , save_file_3.c_str() );

    saveGame3->setSize(486,75);
    saveGame3->setPosition(20,220);

    panelSave->addWidget(saveGame3);

    GuiSaveGame * saveGame4 = new GuiSaveGame( game , save_file_4.c_str() );

    saveGame4->setSize(486,75);
    saveGame4->setPosition(20,300);

    panelSave->addWidget(saveGame4);

    GuiSaveGame * saveGame5 = new GuiSaveGame( game , save_file_5.c_str() );

    saveGame5->setSize(486,75);
    saveGame5->setPosition(20,380);

    panelSave->addWidget(saveGame5);

    // Add the panel into the main gui panel

    mainPanel->addWidget(panelSave);

    //--------------------------------------------------------------------------
    // Create the buttons for this gui screen
    //--------------------------------------------------------------------------

    // Create the buttons

    GuiButton * btnTrade        = new GuiButton();
    GuiButton * btnMap          = new GuiButton();
    GuiButton * btnUpgrade      = new GuiButton();
    GuiButton * btnRepair       = new GuiButton();
    GuiButton * btnBuyShip      = new GuiButton();
    GuiButton * btnLoad         = new GuiButton();
    GuiButton * btnSave         = new GuiButton();
    GuiButton * btnLaunch       = new GuiButton();

    // Set size of the buttons

    btnTrade->setSize(180,35);
    btnMap->setSize(180,35);
    btnUpgrade->setSize(180,35);
    btnRepair->setSize(180,35);
    btnBuyShip->setSize(180,35);
    btnLoad->setSize(180,35);
    btnSave->setSize(180,35);
    btnLaunch->setSize(180,35);

    // Set position of the buttons

    btnTrade->setPosition(18,80);
    btnMap->setPosition(18,120);
    btnUpgrade->setPosition(18,160);
    btnRepair->setPosition(18,200);
    btnBuyShip->setPosition(18,240);
    btnLoad->setPosition(18,415);
    btnSave->setPosition(18,455);
    btnLaunch->setPosition(18,495);

    // Set label of the buttons

    btnTrade->setLabel("Trade");
    btnMap->setLabel("Galactic map");
    btnUpgrade->setLabel("Upgrades");
    btnRepair->setLabel("Repairs");
    btnBuyShip->setLabel("Purchase ship");
    btnLoad->setLabel("Load game");
    btnSave->setLabel("Save game");
    btnLaunch->setLabel("Launch ship");

    // Set button event listeners

    btnTrade->setEventListener(eventTrade);
    btnMap->setEventListener(eventMap);
    btnUpgrade->setEventListener(eventUpgrade);
    btnRepair->setEventListener(eventRepair);
    btnBuyShip->setEventListener(eventBuyShip);
    btnLoad->setEventListener(eventLoad);
    btnSave->setEventListener(eventSave);
    btnLaunch->setEventListener(eventLaunch);

    // Add all four buttons into the main panel

    mainPanel->addWidget(btnTrade);
    mainPanel->addWidget(btnMap);
    mainPanel->addWidget(btnUpgrade);
    mainPanel->addWidget(btnRepair);
    mainPanel->addWidget(btnBuyShip);
    mainPanel->addWidget(btnLoad);
    mainPanel->addWidget(btnSave);
    mainPanel->addWidget(btnLaunch);

    //--------------------------------------------------------------------------
    // Set the trade panel as the current panel
    //--------------------------------------------------------------------------

    setCurrentPanel_trade();
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Name:     GuiScreen_SpaceStation::~GuiScreen_SpaceStation()
Purpose:  Destructor for this gui screen. frees resources used.
Params:   n/a
Returns:  n/a

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

GuiScreen_SpaceStation::~GuiScreen_SpaceStation()
{
    // Delete all the event listeners

    delete eventTrade;
    delete eventMap;
    delete eventUpgrade;
    delete eventRepair;
    delete eventBuyShip;
    delete eventLoad;
    delete eventSave;
    delete eventLaunch;
}



