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

Screen1ViewBase::Screen1ViewBase() :
    buttonCallback(this, &Screen1ViewBase::buttonCallbackHandler)
{
    __background.setPosition(0, 0, 480, 272);
    __background.setColor(touchgfx::Color::getColorFromRGB(0, 0, 0));
    add(__background);

    box1.setPosition(1, 0, 480, 272);
    box1.setColor(touchgfx::Color::getColorFromRGB(255, 255, 255));
    add(box1);

    Light_OFF.setBitmap(touchgfx::Bitmap(BITMAP_LIGHT_BULB_ICON_ID));
    Light_OFF.setPosition(0, 147, 129, 125);
    Light_OFF.setScalingAlgorithm(touchgfx::ScalableImage::NEAREST_NEIGHBOR);
    add(Light_OFF);

    Light_ON.setBitmap(touchgfx::Bitmap(BITMAP_PNGTREE_WARM_WHITE_LIGHT_LINE_ICON_PNG_IMAGE_9065223_ID));
    Light_ON.setPosition(311, 108, 170, 164);
    Light_ON.setScalingAlgorithm(touchgfx::ScalableImage::NEAREST_NEIGHBOR);
    add(Light_ON);

    textArea1.setXY(130, 67);
    textArea1.setColor(touchgfx::Color::getColorFromRGB(0, 0, 0));
    textArea1.setLinespacing(0);
    textArea1.setWildcard(touchgfx::TypedText(T___SINGLEUSE_JUHA).getText());
    textArea1.resizeToCurrentText();
    textArea1.setTypedText(touchgfx::TypedText(T___SINGLEUSE_5LF6));
    add(textArea1);

    button1.setXY(9, 11);
    button1.setBitmaps(touchgfx::Bitmap(BITMAP_ALTERNATE_THEME_IMAGES_WIDGETS_BUTTON_REGULAR_HEIGHT_50_MEDIUM_ROUNDED_NORMAL_ID), touchgfx::Bitmap(BITMAP_ALTERNATE_THEME_IMAGES_WIDGETS_BUTTON_REGULAR_HEIGHT_50_MEDIUM_ROUNDED_PRESSED_ID));
    button1.setAction(buttonCallback);
    add(button1);

    button2.setXY(232, 97);
    button2.setBitmaps(touchgfx::Bitmap(BITMAP_ALTERNATE_THEME_IMAGES_WIDGETS_BUTTON_REGULAR_HEIGHT_50_MEDIUM_ROUNDED_NORMAL_ID), touchgfx::Bitmap(BITMAP_ALTERNATE_THEME_IMAGES_WIDGETS_BUTTON_REGULAR_HEIGHT_50_MEDIUM_ROUNDED_PRESSED_ID));
    button2.setAction(buttonCallback);
    add(button2);
}

Screen1ViewBase::~Screen1ViewBase()
{

}

void Screen1ViewBase::setupScreen()
{

}

void Screen1ViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)
{
    if (&src == &button1)
    {
        //Interaction1
        //When button1 clicked execute C++ code
        //Execute C++ code
        Light_ON.setVisible(false);
        	Light_OFF.setVisible(!false);
        	Light_ON.invalidate();
        	Light_OFF.invalidate();
    }
    if (&src == &button2)
    {
        //Interaction2
        //When button2 clicked execute C++ code
        //Execute C++ code
        Light_ON.setVisible(true);
        	Light_OFF.setVisible(false);
        	Light_ON.invalidate();
        	Light_OFF.invalidate();
    }
}
