// reset
//---------------------------------------------------------------------------
// Purpose: Reset all the settings for this window.
//---------------------------------------------------------------------------
void View::reset()
{
    min.zero();
    max.zero();
    status                =  0;
    searchName            = 0;
    title                 = 0;
    subTitle              = 0;
    statusText            = 0;
    focusComponent        = 0;

    setSearchName("donut");
    setTitle("donut");
    setSubTitle("donut");

    removeComponents();

    moveAreaHeight  = DEFAULT_MOVE_AREA_HEIGHT;
    borderSize      = DEFAULT_BORDER_SIZE;
    snapToTolerance = DEFAULT_SNAP_TOLERANCE;

    setAllowResize(true);
    setAllowMove(true);
    setBordered(true);
    setVisible(false);
    setDisplayStatusBar(false);
    setAlwaysOnBottom(false);

    //setScrollBar(false);
} // end reset
// UnitSelectionView
//---------------------------------------------------------------------------
UnitSelectionView::UnitSelectionView() : View()
{
    setSearchName("UnitSelectionView");
    setTitle("Selects Your Units");
    setSubTitle("");

    setAllowResize(false);
    setAllowMove(false);
    setDisplayStatusBar(true);
    setVisible(false);

    moveTo(bodyTextRect.min);

    resize(bodyTextRect.getSize());

    //setScrollBar(true);

    maxYOffset =  0;

    // Define the scrollBar fot this view.
    scrollBar = new ScrollBar(HORIZONTAL, 0, 1, 0, 100);

    add(scrollBar);

} // end UnitSelectionView::UnitSelectionView
// LibView
//---------------------------------------------------------------------------
LibView::LibView() : GameTemplateView()
{
    setSearchName("LibView");
    setTitle("Lib Stats");
    setSubTitle(" - F5");

    setAllowResize(false);
    setAllowMove(true);
    setDisplayStatusBar(false);
    setVisible(false);

    moveTo(0, 0);
    resize(325, 375);

    addButtonCenterText(iXY((getClientRect().getSize().x / 3) * 0, 0), getClientRect().getSize().x / 3, "Surface", "", bSurfaceInfo);
    addButtonCenterText(iXY((getClientRect().getSize().x / 3) * 1, 0), getClientRect().getSize().x / 3, "Particles", "", bParticleInfo);
    addButtonCenterText(iXY((getClientRect().getSize().x / 3) * 2, 0), getClientRect().getSize().x / 3, "Environment", "", bEnvironmentInfo);

    checkBoxAllowParticleGeneration.setLabel("Allow Particle Generation");
    checkBoxAllowParticleGeneration.setLocation(0, 15);
    checkBoxAllowParticleGeneration.setState(Particle2D::getCreateParticles());
    add(&checkBoxAllowParticleGeneration);

    checkBoxAllowTimeSlice.setLabel("Allow Time Slice");
    checkBoxAllowTimeSlice.setLocation(0, 30);
    checkBoxAllowTimeSlice.setState(gTimeSliceFlag);
    add(&checkBoxAllowTimeSlice);

    checkBoxAllowSpanBlitting.setLabel("Allow Blended Span Blitting");
    checkBoxAllowSpanBlitting.setLocation(0, 45);
    checkBoxAllowSpanBlitting.setState(allowSpanBlitting);
    add(&checkBoxAllowSpanBlitting);

    checkBoxParticlesCanHaveSmoke.setLabel("Allow Explosion Particle Smoke");
    checkBoxParticlesCanHaveSmoke.setLocation(0, 60);
    checkBoxParticlesCanHaveSmoke.setState(ParticleInterface::gParticlesCanHaveSmoke);
    add(&checkBoxParticlesCanHaveSmoke);

    checkBoxSolidColorExplosionParticles.setLabel("Solid Color Explosion Particles");
    checkBoxSolidColorExplosionParticles.setLocation(0, 75);
    checkBoxSolidColorExplosionParticles.setState(ParticleInterface::gSolidColorExplosionParticles);
    add(&checkBoxSolidColorExplosionParticles);

    checkBoxParticleInterfaceSim.setLabel("Particle Interface Sim");
    checkBoxParticleInterfaceSim.setLocation(0, 90);
    checkBoxParticleInterfaceSim.setState(ParticleInterface::gTestSim);
    add(&checkBoxParticleInterfaceSim);

    checkBoxSolidBackground.setLabel("Solid Background");
    checkBoxSolidBackground.setLocation(0, 105);
    checkBoxSolidBackground.setState(GameView::gDrawSolidBackground);
    add(&checkBoxSolidBackground);

    checkBoxDrawExplosionParticleCount.setLabel("Draw Explosion Particle Count");
    checkBoxDrawExplosionParticleCount.setLocation(0, 120);
    checkBoxDrawExplosionParticleCount.setState(ParticleInterface::gDrawExplosionParticleCount);
    add(&checkBoxDrawExplosionParticleCount);

} // end LibView::LibView
// ImageSelectorView
//---------------------------------------------------------------------------
ImageSelectorView::ImageSelectorView() : cView()
{
    setTitle("Image Selector View");
    setAllowResize(false);
    setDisplayStatusBar(false);
    setVisible(false);
    setAllowMove(false);
    setBordered(false);

    reset();

} // end ImageSelectorView::ImageSelectorView
ParticleTweakView::ParticleTweakView() : View()
{
    setTitle("ParticleTweakView");
    setAllowResize(false);
    setAllowMove(true);
    setDisplayStatusBar(true);
    setVisible(false);

    moveTo(0, 0);
    resizeClientArea(640, 480);

} // end ParticleTweakView::ParticleTweakView
CodeStatsView::CodeStatsView() : GameTemplateView()
{
    setSearchName("CodeStatsView");
    setTitle("CodeStatsView");
    setSubTitle(" - F4");

    setAllowResize(false);
    setAllowMove(true);
    setDisplayStatusBar(true);
    setVisible(false);

    moveTo(iXY(0, 0));

    iXY  area_size = iXY(280, 280) ;
    long bXOffset;
    INFO_AREA_Y_OFFSET = 2;

    resizeClientArea(area_size);

    bXOffset = area_size.x / 3;
    addButtonCenterText(iXY(0, INFO_AREA_Y_OFFSET), bXOffset,  "Net", "", buttonNetwork);
    addButtonCenterText(iXY(bXOffset, INFO_AREA_Y_OFFSET), bXOffset, "Sprite", "", buttonSorter);
    addButtonCenterText(iXY(bXOffset*2, INFO_AREA_Y_OFFSET), bXOffset, "Unit", "", buttonUnit);

    INFO_AREA_Y_OFFSET += 18;
    addButtonCenterText(iXY(0, INFO_AREA_Y_OFFSET), area_size.x, "Path", "", buttonPathing);

    INFO_AREA_Y_OFFSET += 18;
    bXOffset = area_size.x / 3;
    addButtonCenterText(iXY(0, INFO_AREA_Y_OFFSET), bXOffset,  "Debug", "", buttonDebug);
    addButtonCenterText(iXY(bXOffset, INFO_AREA_Y_OFFSET), bXOffset, "Sample", "", buttonSample);
    addButtonCenterText(iXY(bXOffset*2, INFO_AREA_Y_OFFSET), bXOffset, "NetLog", "", bNetLog );

    INFO_AREA_Y_OFFSET += 18;
    /*
       addButtonCenterText(iXY(0, INFO_AREA_Y_OFFSET), 20, "+", "", bPlusPacketSize );
    addButtonCenterText(iXY(25, INFO_AREA_Y_OFFSET), 20, "-", "", bMinusPacketSize );
    addButtonCenterText(iXY(50, INFO_AREA_Y_OFFSET), 20, "0", "", bMinusPacketSize );
    addButtonCenterText(iXY(65, INFO_AREA_Y_OFFSET), 20, "1", "", bMinusPacketSize );

    addButtonCenterText(iXY(45, INFO_AREA_Y_OFFSET), 40, "Send", "", bSend );

       INFO_AREA_Y_OFFSET += 18;
       INFO_AREA_Y_OFFSET += 18;
       */

    display_mode = _display_mode_network_stats;

} // end CodeStatsView::CodeStatsView
// init
//---------------------------------------------------------------------------
void GameView::init()
{
    setSearchName("GameView");
    setTitle("Game");
    setSubTitle("");

    setBordered(false);
    setAlwaysOnBottom(true);
    setAllowResize(false);
    setDisplayStatusBar(false);
    setVisible(false);

    moveTo(iXY(0, 0));
    resize(iXY(screen->getPixX(), screen->getPixY()));

} // end GameView::init
// init
//---------------------------------------------------------------------------
void GameView::init()
{
    setSearchName("GameView");
    setTitle("Game");
    setSubTitle("");

    setBordered(false);
    setAlwaysOnBottom(true);
    setAllowResize(false);
    setDisplayStatusBar(false);
    setVisible(false);

    moveTo(iXY(0, 0));
    resize(iXY(SCREEN_XPIX, SCREEN_YPIX));

} // end GameView::init
// init
//---------------------------------------------------------------------------
void AreYouSureResignView::init()
{
    setBordered(false);
    setAllowResize(false);
    setDisplayStatusBar(false);

    moveTo(iXY(0, 0));
    resize(iXY(800, 600));

    int x = (getClientRect().getSize().x - (141 * 2 + 20)) / 2;
    int y = getClientRect().getSize().y/2 + 30;
    add( Button::createTextButton( _("YES"), iXY(x, y), 137, ActionManager::getAction("disconnect")));
    x += 141 + 10;
    add( Button::createTextButton( _("NO"), iXY(x, y), 137, ActionManager::getAction("hide_confirmdisconnect")));
    loaded = true;
} // end AreYouSureResignView::init
// MiniMapView
//---------------------------------------------------------------------------
MiniMapView::MiniMapView() : GameTemplateView()
{
    assert(this != 0);

    setSearchName("MiniMapView");
    setTitle("MiniMapView");
    setSubTitle("");
    setAllowResize(false);
    setDisplayStatusBar(false);
    setVisible(false);
    setAllowMove(true);

    setBordered(false);
    
    resize(160, 160);
    add(new MiniMap(1,1,158,158));
} // end MiniMapView::MiniMapView
// MiniMapView
//---------------------------------------------------------------------------
MiniMapView::MiniMapView() : GameTemplateView()
{
    assert(this != 0);

    setSearchName("MiniMapView");
    setTitle("MiniMapView");
    setSubTitle("");
    setAllowResize(false);
    setDisplayStatusBar(false);
    setVisible(false);

    setBordered(false);

    add(CLOSE_VIEW_BUTTON);
    add(MINMAX_VIEW_BUTTON);

} // end MiniMapView::MiniMapView
// init
//---------------------------------------------------------------------------
void AreYouSureResignView::init()
{
    setBordered(false);
    setDisplayStatusBar(false);

    resize(screen->getWidth(), screen->getHeight());
    moveTo(0,0);

    int x = (getClientRect().getSize().x - (141 * 2 + 20)) / 2;
    int y = getClientRect().getSize().y/2 + 30;

    iXY pos(x,y);
    add( Button::createSpecialButton("yes","Yes", pos, BTN_YES));

    pos.x += 141 + 10;
    add( Button::createSpecialButton("no","No", pos, BTN_NO));

} // end AreYouSureResignView::init
void
LoadingView::init()
{
    setSearchName("LoadingView");
    setTitle("Loading Progress");
    setSubTitle("");
    
    setAllowResize(false);
    setAllowMove(false);
    setDisplayStatusBar(false);
    setVisible(false);
    setBordered(false);

    resize(640, 480);
    
    addButtonCenterText(iXY(628 - 60, 302 - 15), 60, "Abort", "Cancel the joining of this game.", bAbort);
    
}
// GameInfoView
//--------------------------------------------------------------------------
GameInfoView::GameInfoView() : GameTemplateView()
{
    setSearchName("GameInfoView");
    setTitle("Information");
    setSubTitle("");

    setAllowResize(false);
    setAllowMove(false);
    setDisplayStatusBar(false);
    setVisible(false);
    setBordered(true);

    moveTo(iXY(0, 0));
    //resizeClientArea(iXY(100, 2 * 2 + 12 * 3 + 8));
    resizeClientArea(iXY(140, 2 * 2 + 12 * 5 + 8));

    // Start it in the top-left corner.
    moveTo(iXY(10000, 0));

} // end GameInfoView::GameInfoView
// GameView
//---------------------------------------------------------------------------
GameView::GameView() : View()
{
    setSearchName("GameView");
    setTitle("Game");
    setSubTitle("");

    setBordered(false);
    setAlwaysOnBottom(true);
    setAllowResize(false);
    setDisplayStatusBar(false);
    setVisible(false);

    resize(640,480);
    moveTo(iXY(0, 0));

    add(new InfoBar(0,0));
    // will add after input handling is done
    //add(new MiniMap(100,100));

} // end GameView::GameView
// MenuTemplateView
//---------------------------------------------------------------------------
MenuTemplateView::MenuTemplateView() : SpecialButtonView()
{
    setSearchName("MenuTemplateView");
    setTitle("MenuTemplate");
    setSubTitle("");

    setAllowResize(false);
    setVisible(false);
    setAllowMove(false);
    setDisplayStatusBar(false);
    setBordered(false);
    setAlwaysOnBottom(true);

    moveTo(iXY(0, 0));
    resize(iXY(640, 480));

    initButtons();

    curTitleFlashTime  = 0.0f;
    titleFlashTimeHalf = 0.5;
} // end MenuTemplateView constructor
// init
//---------------------------------------------------------------------------
void ProgressView::init()
{
	setSearchName("ProgressView");
	setTitle("Progress Update");
	setSubTitle("");

	setAllowResize(false);
    setAllowMove(false);
	setDisplayStatusBar(false);
	setVisible(false);
	setBordered(false);

	background.create(628 - 179, 302 - 153, 628 - 179, 1);
	background.fill(0);

	moveTo(0, 0);
	resize(640, 480);

	iXY size(getClientRect().getSize());

} // end ProgressView::init
// init
//---------------------------------------------------------------------------
void LobbyView::init()
{
    setSearchName("LobbyView");
    setTitle("Join Lobby");
    setSubTitle("");

    setAllowResize(false);
    setAllowMove(false);
    setDisplayStatusBar(false);
    setVisible(false);
    setBordered(false);

    background.create(628 - 179, 302 - 153, 1);
    background.fill(0);

    moveTo(0, 0);
    resize(640, 480);

    addButtonCenterText(iXY(628 - 60, 302 - 15), 60, "Abort", "Cancel the joining of this game.", bAbort);

    currentline = 0;
} // end LobbyView::init
// init
//---------------------------------------------------------------------------
void AreYouSureExitView::init()
{
    removeAllButtons();

    setBordered(false);
    setAllowResize(false);
    setDisplayStatusBar(false);

    moveTo(0, 0);
    resize(SCREEN_PIX);

    int x = (getClientRect().getSize().x - (141 * 2 + 20)) / 2;
    int y = SCREEN_YCENTER + 30;
    addSpecialButton(	iXY(x, y),
                      "YES",
                      bYES);

    x += 141 + 10;
    addSpecialButton(	iXY(x, y),
                      "NO",
                      bNO);

} // end AreYouSureExitView::init
// init
//---------------------------------------------------------------------------
void AreYouSureResignView::init()
{
    removeAllButtons();

    setBordered(false);
    setAllowResize(false);
    setDisplayStatusBar(false);

    resize(screen->getPix());
    moveTo(0,0);

    int x = (getClientRect().getSize().x - (141 * 2 + 20)) / 2;
    int y = getClientRect().getSize().y/2 + 30;
    addSpecialButton(	iXY(x, y),
                      "YES",
                      bYES);

    x += 141 + 10;
    addSpecialButton(	iXY(x, y),
                      "NO",
                      bNO);

} // end AreYouSureResignView::init
void
LoadingView::init()
{
    setSearchName("LoadingView");
    setTitle("Loading Progress");
    setSubTitle("");

    setAllowResize(false);
    setAllowMove(false);
    setDisplayStatusBar(false);
    setVisible(false);
    setBordered(false);
    need_password = false;
    password_str.init("", 31,31);

    resize(800, 600);

    addButtonCenterText(iXY(340, 15), 100, "Abort", "Cancel the joining of this game.", bAbort);


    okButton = Button::createTextButton("OK", "Enter", iXY(340,100), 100);
    passwordLabel = new Label(340, 68, "Game Password", Color::white);

}
CodeStatsView::CodeStatsView() : GameTemplateView()
{
    setSearchName("CodeStatsView");
    setTitle("CodeStatsView");
    setSubTitle(" - F4");

    setAllowResize(false);
    setAllowMove(true);
    setDisplayStatusBar(true);
    setVisible(false);

    moveTo(iXY(0, 0));

    iXY  area_size = iXY(280, 280) ;
    long bXOffset;
    INFO_AREA_Y_OFFSET = 2;

    resizeClientArea(area_size);

    bXOffset = area_size.x / 3;
    add( Button::createTextButton("Net",    iXY(0, INFO_AREA_Y_OFFSET),              bXOffset-3,    new SetDisplayModeAction(_display_mode_network_stats)));
    add( Button::createTextButton("Sprite", iXY(bXOffset+1, INFO_AREA_Y_OFFSET),     bXOffset-4,    new SetDisplayModeAction(_display_mode_sorter_stats)));
    add( Button::createTextButton("Unit",   iXY((bXOffset*2)+1, INFO_AREA_Y_OFFSET), bXOffset-2,    new SetDisplayModeAction(_display_mode_unit_stats)));

    INFO_AREA_Y_OFFSET += 18;
    add( Button::createTextButton("Path",   iXY(0, INFO_AREA_Y_OFFSET),              area_size.x-2, new SetDisplayModeAction(_display_mode_pathing_stats)));

    INFO_AREA_Y_OFFSET += 18;
    bXOffset = area_size.x / 3;
    add( Button::createTextButton("NetLog", iXY((bXOffset*2)+1, INFO_AREA_Y_OFFSET), bXOffset-2,    new UpdateNetworkStatsAction()));

    INFO_AREA_Y_OFFSET += 18;

    display_mode = _display_mode_network_stats;

} // end CodeStatsView::CodeStatsView
// GameToolbarView
//--------------------------------------------------------------------------
GameToolbarView::GameToolbarView() : GameTemplateView()
{
	setSearchName("GameToolbarView");
	setTitle("Toolbar - TAB");
	setSubTitle("");

	setAllowResize(false);
	setAllowMove(false);
	setDisplayStatusBar(false);
	setVisible(false);

	moveTo(iXY(0, 0));
	resizeClientArea(117, 100);

	iXY       pos(0, 0);
	const int yOffset     = 15;
	int       buttonSizeX = getClientRect().getSizeX();

	addButtonCenterText(pos, buttonSizeX - (15 + 1) * 2 - 1, "Mini Map", "Toggle the visibility of the mini map", bToggleMiniMap);
	pos.x = buttonSizeX - (15 + 1) * 2;
	addButton(pos, "-", "", bDecreaseMiniMapSize);
	pos.x += 15 + 1;
	addButton(pos, "+", "", bIncreaseMiniMapSize);
	pos.x += 15 + 1;

	pos.x = 0;
	pos.y += yOffset;
	buttonSizeX = getClientRect().getSizeX() / 2;
	addButtonCenterText(pos, buttonSizeX, "Info", "Toggle the visibility of the mini map", bToggleInfo);
	pos.x += buttonSizeX + 1;
	addButtonCenterText(pos, buttonSizeX, "Rank", "Toggle the visibility of the rank view", bToggleRankView);
	pos.y += yOffset;
	pos.x = 0;
	buttonSizeX = getClientRect().getSizeX();
	addButtonCenterText(pos, buttonSizeX, "MSG All", "", bSendMessageAll);
	pos.y += yOffset;
	addButtonCenterText(pos, buttonSizeX, "MSG Allies", "", bSendMessageAllies);
	pos.y += yOffset;
	addButtonCenterText(pos, buttonSizeX, "MSG Enemies", "", bSendMessageEnemies);
	pos.y += yOffset;

	pos.x = 0;
	addLabel(iXY(pos.x + 2, pos.y + 3), "Group", Color::white);
	pos.x += 48 + 1 + 4;

	addButton(pos, "1", "", bSetGroup1);
	pos.x += 15 + 1;
	addButton(pos, "2", "", bSetGroup2);
	pos.x += 15 + 1;
	addButton(pos, "3", "", bSetGroup3);
	pos.x += 15 + 1;
	addButton(pos, "4", "", bSetGroup4);
	pos.x += 15 + 1;

	pos.x = 0;
	pos.y += yOffset;
	addLabel(iXY(pos.x + 2, pos.y + 3), "Recall", Color::white);
	pos.x += 48 + 1 + 4;

	addButton(pos, "1", "", bRecallGroup1);
	pos.x += 15 + 1;
	addButton(pos, "2", "", bRecallGroup2);
	pos.x += 15 + 1;
	addButton(pos, "3", "", bRecallGroup3);
	pos.x += 15 + 1;
	addButton(pos, "4", "", bRecallGroup4);
	pos.x += 15 + 1;
	pos.y += yOffset;

	buttonSizeX = getClientRect().getSizeX() / 2;

	pos.x = 0;
	addButtonCenterText(pos, buttonSizeX, "Damage", "", bToggleDrawUnitDamage);
	pos.x += buttonSizeX + 1;
	addButtonCenterText(pos, buttonSizeX, "Flags", "", bToggleDrawUnitFlags);
	//pos.x += buttonSizeX + 1;
	//addButtonCenterText(pos, buttonSizeX, "RL", "", bToggleDrawUnitReload);

	pos.y += yOffset;

	resizeClientArea(iXY(117, pos.y));
	
	// Start it in the bottom-left corner.
	moveTo(iXY(10000, 10000));

} // end GameToolbarView::GameToolbarView
// VehicleSelectionView
//---------------------------------------------------------------------------
VehicleSelectionView::VehicleSelectionView() : GameTemplateView()
{
    setSearchName("VehicleSelectionView");
    setTitle("Unit Production");
    setSubTitle("");

    setAllowResize(false);
    setVisible(false);
    setBordered(true);
    setDisplayStatusBar(true);

    moveTo(iXY(0, 0));

    char      strBuf[256];
    int       unit_regen_time;
    const int yOffset  = 15;
    const int gapSpace =  1;

    resizeClientArea(48 * 5 + gapSpace * 4, 198 + 84);

    // Power status.
    iXY pos(0 ,0);

    pos.x = 0;
    addLabel(pos + iXY(2,2), "Static Display:", Color::white);

    pos.x = getClientRect().getSizeX() - 100;
    buttonStaticDisplay.setLabel("On");
    buttonStaticDisplay.setBounds(iRect(pos, pos + iXY(100, 15)));
    add(&buttonStaticDisplay);
    pos.y += yOffset;

    pos.x = 0;
    addLabel(pos + iXY(2,2) , "Power:", Color::white);

    pos.x = getClientRect().getSizeX() - 100;
    buttonPower.setLabel("Off");
    buttonPower.setBounds(iRect(pos, pos + iXY(100, 15)));
    add(&buttonPower);
    pos.y += yOffset;

    // XXX hardcoded for now
    int CHAR_XPIX = 8;
    
    pos.x = 0;
    addLabel(pos + iXY(2,2), "Production:", Color::white);
    productionUnitPos.x = (strlen("Current Unit:") + 1) * CHAR_XPIX + 2;
    productionUnitPos.y = pos.y + 2;
    pos.y += yOffset;

    pos.x = 0;
    addLabel(pos + iXY(2,2), "Time:        ", Color::white);
    timeRequiredPos.x = (strlen("Time:        ") + 1) * CHAR_XPIX + 2;
    timeRequiredPos.y = pos.y + 2;
    pos.y += yOffset;

    pos.x = 0;
    addLabel(pos + iXY(2,2), "Unit Built:   ", Color::white);
    unitsBuiltPos.x = (strlen("Time:        ") + 1) * CHAR_XPIX + 2;
    unitsBuiltPos.y = pos.y + 2;
    pos.y += yOffset;

    pos.x = 0;

    // Unit images.
    unit_regen_time = getUnitRegenTime(_unit_type_humvee);
    sprintf(strBuf, "SpahPanzer - Build Time: %01d:%02d", unit_regen_time / 60, unit_regen_time % 60);
    addButtonBMPBordered(pos, "pics/menus/vehicleSelectionView/scout.bmp", strBuf, bSelectScout);
    abstractButtonHumvee.setBounds(iRect(pos, pos + iXY(48,48)));
    add(&abstractButtonHumvee);

    pos.x += 48 + gapSpace;
    unit_regen_time = getUnitRegenTime(_unit_type_valentine);
    sprintf(strBuf, "Manta - Build Time: %01d:%02d", unit_regen_time / 60, unit_regen_time % 60);
    addButtonBMPBordered(pos, "pics/menus/vehicleSelectionView/manta.bmp", strBuf, bSelectManta);
    abstractButtonValentine.setBounds(iRect(pos, pos + iXY(48,48)));
    add(&abstractButtonValentine);

    pos.x += 48 + gapSpace;
    unit_regen_time = getUnitRegenTime(_unit_type_leopard);
    sprintf(strBuf, "Panther1 - Build Time: %01d:%02d", unit_regen_time / 60, unit_regen_time % 60);
    addButtonBMPBordered(pos, "pics/menus/vehicleSelectionView/panther1.bmp", strBuf, bSelectPanther1);
    abstractButtonLeopard.setBounds(iRect(pos, pos + iXY(48,48)));
    add(&abstractButtonLeopard);

    pos.x += 48 + gapSpace;
    unit_regen_time = getUnitRegenTime(_unit_type_abrams);
    sprintf(strBuf, "Titan - Build Time: %01d:%02d", unit_regen_time / 60, unit_regen_time % 60);
    addButtonBMPBordered(pos, "pics/menus/vehicleSelectionView/titan.bmp", strBuf, bSelectTitan);
    abstractButtonAbrams.setBounds(iRect(pos, pos + iXY(48,48)));
    add(&abstractButtonAbrams);

    pos.x += 48 + gapSpace;
    unit_regen_time = getUnitRegenTime(_unit_type_hammerhead);
    sprintf(strBuf, "Stinger - Build Time: %01d:%02d", unit_regen_time / 60, unit_regen_time % 60);
    addButtonBMPBordered(pos, "pics/menus/vehicleSelectionView/stinger.bmp", strBuf, bSelectStinger);
    abstractButtonHammerhead.setBounds(iRect(pos, pos + iXY(48,48)));
    add(&abstractButtonHammerhead);

    pos.x = 0;
    pos.y += 48 + gapSpace;
    unit_regen_time = getUnitRegenTime(_unit_type_lynx);
    sprintf(strBuf, "Bobcat - Build Time: %01d:%02d", unit_regen_time / 60, unit_regen_time % 60);
    addButtonBMPBordered(pos, "pics/menus/vehicleSelectionView/bobcat.bmp", strBuf, bSelectBobcat);
    abstractButtonLynx.setBounds(iRect(pos, pos + iXY(48,48)));
    add(&abstractButtonLynx);

    pos.x += 48 + gapSpace;
    unit_regen_time = getUnitRegenTime(_unit_type_scorpion);
    sprintf(strBuf, "Wolf - Build Time: %01d:%02d", unit_regen_time / 60, unit_regen_time % 60);
    addButtonBMPBordered(pos, "pics/menus/vehicleSelectionView/wolf.bmp", strBuf, bSelectWolf);
    abstractButtonScorpion.setBounds(iRect(pos, pos + iXY(48, 48)));
    add(&abstractButtonScorpion);

    pos.x += 48 + gapSpace;
    unit_regen_time = getUnitRegenTime(_unit_type_spahpanzer);
    sprintf(strBuf, "Bear - Build Time: %01d:%02d", unit_regen_time / 60, unit_regen_time % 60);
    addButtonBMPBordered(pos, "pics/menus/vehicleSelectionView/bear.bmp", strBuf, bSelectBear);
    abstractButtonSpahpanzer.setBounds(iRect(pos, pos + iXY(48, 48)));
    add(&abstractButtonSpahpanzer);

    pos.x += 48 + gapSpace;
    unit_regen_time = getUnitRegenTime(_unit_type_m109);
    sprintf(strBuf, "Drake - Build Time: %01d:%02d", unit_regen_time / 60, unit_regen_time % 60);
    addButtonBMPBordered(pos, "pics/menus/vehicleSelectionView/drake.bmp", strBuf, bSelectDrake);
    abstractButtonM109.setBounds(iRect(pos, pos + iXY(48, 48)));
    add(&abstractButtonM109);

    pos.x += 48 + gapSpace;
    unit_regen_time = getUnitRegenTime(_unit_type_archer);
    sprintf(strBuf, "Archer - Build Time: %01d:%02d", unit_regen_time / 60, unit_regen_time % 60);
    addButtonBMPBordered(pos, "pics/menus/vehicleSelectionView/archer.bmp", strBuf, bSelectArcher);
    abstractButtonArcher.setBounds(iRect(pos, pos + iXY(48, 48)));
    add(&abstractButtonArcher);

    pos.y += 48 + gapSpace * 4;
    pos.x = 0;

    unitProfileDataY = pos.y;
    pos.y += 74;

    //addLabel(pos + 2, "Time Remaining:", Color::white);
    //timeRemainingPos.x = (strlen("Time Remaining: ") + 1) * CHAR_XPIX + 2;
    //timeRemainingPos.y = pos.y + 2;
    //pos.y += yOffset;

    pos.x = (getClientRect().getSizeX() - 100) / 2;
    buttonOk.setLabel("Ok");
    buttonOk.setBounds(iRect(pos, pos + iXY(100, 15)));
    add(&buttonOk);

    unitImages.create(48, 48, _MAX_UNIT_TYPES);

    Surface tempSurface;
    int i = 0;

    tempSurface.loadBMP("pics/menus/vehicleSelectionView/manta.bmp");
    unitImages.setFrame(i++);
    tempSurface.blt(unitImages, 0, 0);
    tempSurface.loadBMP("pics/menus/vehicleSelectionView/panther1.bmp");
    unitImages.setFrame(i++);
    tempSurface.blt(unitImages, 0, 0);
    tempSurface.loadBMP("pics/menus/vehicleSelectionView/titan.bmp");
    unitImages.setFrame(i++);
    tempSurface.blt(unitImages, 0, 0);
    tempSurface.loadBMP("pics/menus/vehicleSelectionView/stinger.bmp");
    unitImages.setFrame(i++);
    tempSurface.blt(unitImages, 0, 0);
    tempSurface.loadBMP("pics/menus/vehicleSelectionView/bobcat.bmp");
    unitImages.setFrame(i++);
    tempSurface.blt(unitImages, 0, 0);
    tempSurface.loadBMP("pics/menus/vehicleSelectionView/bear.bmp");
    unitImages.setFrame(i++);
    tempSurface.blt(unitImages, 0, 0);
    tempSurface.loadBMP("pics/menus/vehicleSelectionView/archer.bmp");
    unitImages.setFrame(i++);
    tempSurface.blt(unitImages, 0, 0);
    tempSurface.loadBMP("pics/menus/vehicleSelectionView/wolf.bmp");
    unitImages.setFrame(i++);
    tempSurface.blt(unitImages, 0, 0);
    tempSurface.loadBMP("pics/menus/vehicleSelectionView/drake.bmp");
    unitImages.setFrame(i++);
    tempSurface.blt(unitImages, 0, 0);
    tempSurface.loadBMP("pics/menus/vehicleSelectionView/scout.bmp");
    unitImages.setFrame(i++);
    tempSurface.blt(unitImages, 0, 0);
    unitImages.setFrame(i++);
    unitImages.fill(Color::red);
    unitImages.setFrame(i++);
    unitImages.fill(Color::green);
    unitImages.setFrame(i++);
    unitImages.fill(Color::blue);

    maxHitPoints = 1;
    maxAttackFactor = 1;
    maxAttackRange = 1;
    maxDefendRange = 1;
    maxTotalSpeed = 1;
    maxReloadTime = 1;
    maxRegenTime = 1;
    getProfileData();

    highlightedUnitType = 0;

} // end VehicleSelectionView::VehicleSelectionView