/*********************************************************************************/
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
/*********************************************************************************/
#include <gui_generated/mainpage_screen/MainPageViewBase.hpp>
#include "BitmapDatabase.hpp"
#include <texts/TextKeysAndLanguages.hpp>
#include <touchgfx/Color.hpp>

MainPageViewBase::MainPageViewBase() :
    buttonCallback(this, &MainPageViewBase::buttonCallbackHandler)
{

    Sfondo.setBitmap(touchgfx::Bitmap(BITMAP_SFONDO_ID));
    Sfondo.setPosition(0, 0, 480, 272);
    Sfondo.setOffset(0, 0);

    logo.setXY(17, 62);
    logo.setBitmap(touchgfx::Bitmap(BITMAP_EMCULOGOP_ID));

    textArea1.setXY(57, 0);
    textArea1.setColor(touchgfx::Color::getColorFrom24BitRGB(0, 0, 0));
    textArea1.setLinespacing(0);
    textArea1.setTypedText(touchgfx::TypedText(T_SINGLEUSEID1));

    Start.setXY(254, 106);
    Start.setBitmaps(touchgfx::Bitmap(BITMAP_BLUE_BUTTONS_ROUND_EDGE_SMALL_ID), touchgfx::Bitmap(BITMAP_BLUE_BUTTONS_ROUND_EDGE_SMALL_PRESSED_ID));
    Start.setLabelText(touchgfx::TypedText(T_SINGLEUSEID2));
    Start.setLabelColor(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255));
    Start.setLabelColorPressed(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255));
    Start.setAction(buttonCallback);

    Help.setXY(254, 192);
    Help.setBitmaps(touchgfx::Bitmap(BITMAP_BLUE_BUTTONS_ROUND_EDGE_SMALL_ID), touchgfx::Bitmap(BITMAP_BLUE_BUTTONS_ROUND_EDGE_SMALL_PRESSED_ID));
    Help.setLabelText(touchgfx::TypedText(T_SINGLEUSEID3));
    Help.setLabelColor(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255));
    Help.setLabelColorPressed(touchgfx::Color::getColorFrom24BitRGB(255, 255, 255));
    Help.setAction(buttonCallback);

    add(Sfondo);
    add(logo);
    add(textArea1);
    add(Start);
    add(Help);
}

void MainPageViewBase::setupScreen()
{

}

void MainPageViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)
{
    if (&src == &Start)
    {
        //Interaction2
        //When Start clicked change screen to RunPage
        //Go to RunPage with no screen transition
        application().gotoRunPageScreenNoTransition();
    }
    else if (&src == &Help)
    {
        //Interaction1
        //When Help clicked change screen to HelpPage
        //Go to HelpPage with no screen transition
        application().gotoHelpPageScreenNoTransition();
    }
}
