#include "Frm03.h"

Frm03::Frm03(HmiApp* app, STTWidget *par, const string& id, const string& desc) : STTPage(app->getRuntime(), par, id, desc) {
	hmiApp = app;
}

Frm03::~Frm03() {
}

void Frm03::onInit() {

}

void Frm03::createParts() {
	setMainArg(0, 0, 1024, 600);
	setMainStyle(0, 0x2957ad, 0xffffff, 0, 255, 0, 0xc0c0c0);

	/*----------------------------- Button : wMButton1                   -----------------------------*/
	wMButton1 = new STTButton(p_rt, this, "wMButton1", 0);
	wMButton1->setMainArg(1, 530, 254, 69, false);
	wMButton1->setPressedArg("监 控 画 面", 0xffffff, "文泉驿微米黑", 22, 0);
	wMButton1->setPressedStyle(0, 255, 0x5990f6, 0x2957ad, 0, 0, 0x999999, 1, 0xebebeb);
	wMButton1->setReleasedArg("监 控 画 面", 0xffffff, "文泉驿微米黑", 24, 0);
	wMButton1->setReleasedStyle(0, 255, 0x5990f6, 0x2957ad, 0, 0, 0x999999, 1, 0xebebeb);
	wMButton1->onEventHandler(Event::CLICKED, this, (EHandler) &Frm03::wMButton1_clk_cb);

	/*----------------------------- Button : wMButton2                   -----------------------------*/
	wMButton2 = new STTButton(p_rt, this, "wMButton2", 0);
	wMButton2->setMainArg(257, 530, 254, 69, false);
	wMButton2->setPressedArg("项 目 介 绍", 0xffffff, "文泉驿微米黑", 22, 0);
	wMButton2->setPressedStyle(0, 255, 0x5990f6, 0x2957ad, 0, 0, 0x999999, 1, 0xebebeb);
	wMButton2->setReleasedArg("项 目 介 绍", 0xffffff, "文泉驿微米黑", 24, 0);
	wMButton2->setReleasedStyle(0, 255, 0x5990f6, 0x2957ad, 0, 0, 0x999999, 1, 0xebebeb);
	wMButton2->onEventHandler(Event::CLICKED, this, (EHandler) &Frm03::wMButton2_clk_cb);

	/*----------------------------- Button : wMButton3                   -----------------------------*/
	wMButton3 = new STTButton(p_rt, this, "wMButton3", 0);
	wMButton3->setMainArg(513, 530, 254, 69, false);
	wMButton3->setPressedArg("产 品 介 绍", 0xffffff, "文泉驿微米黑", 22, 0);
	wMButton3->setPressedStyle(0, 255, 0x2957ad, 0x2957ad, 0, 0, 0x999999, 1, 0xebebeb);
	wMButton3->setReleasedArg("产 品 介 绍", 0xffffff, "文泉驿微米黑", 24, 0);
	wMButton3->setReleasedStyle(0, 255, 0x2957ad, 0x2957ad, 0, 0, 0x999999, 1, 0xebebeb);
	/*----------------------------- Button : wMButton4                   -----------------------------*/
	wMButton4 = new STTButton(p_rt, this, "wMButton4", 0);
	wMButton4->setMainArg(769, 530, 254, 69, false);
	wMButton4->setPressedArg("设 备 信 息", 0xffffff, "文泉驿微米黑", 24, 0);
	wMButton4->setPressedStyle(0, 255, 0x5990f6, 0x2957ad, 0, 0, 0x999999, 1, 0xebebeb);
	wMButton4->setReleasedArg("设 备 信 息", 0xffffff, "文泉驿微米黑", 24, 0);
	wMButton4->setReleasedStyle(0, 255, 0x5990f6, 0x2957ad, 0, 0, 0x999999, 1, 0xebebeb);
	wMButton4->onEventHandler(Event::CLICKED, this, (EHandler) &Frm03::wMButton4_clk_cb);

	/*----------------------------- Label : wMLabel1                     -----------------------------*/
	wMLabel1 = new STTLabel(p_rt, this, "wMLabel1");
	wMLabel1->setMainArg(391, 6, 227, 60, "产 品 介 绍", TextAlign::CENTER, LabelLongMode::CLIP, 30);
	wMLabel1->setFonts(0xffffff, 30, "文泉驿微米黑", 0);
	wMLabel1->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel1->setFormatText(TextAlign::CENTER, LabelLongMode::CLIP, 30);

	/*----------------------------- Image : wMImage1                     -----------------------------*/
	wMImage1 = new STTImage(p_rt, this, "wMImage1");
	wMImage1->setMainArg(0, 0, 171, 76);
	wMImage1->addStateImg("0", "./images/img17435568919082_171X76R0.png");

	/*----------------------------- Label : wMLabel2                     -----------------------------*/
	wMLabel2 = new STTLabel(p_rt, this, "wMLabel2");
	wMLabel2->setMainArg(84, 91, 842, 109, "", TextAlign::LEFT, LabelLongMode::WRAP, 30);
	wMLabel2->setFonts(0xffffff, 22, "文泉驿微米黑", 0);
	wMLabel2->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel2->setFormatText(TextAlign::LEFT, LabelLongMode::WRAP, 30);

	/*----------------------------- Image : wMImage2                     -----------------------------*/
	wMImage2 = new STTImage(p_rt, this, "wMImage2");
	wMImage2->setMainArg(72, 352, 197, 129);
	wMImage2->addStateImg("0", "./images/img17435598527590_197X129R0.jpg");

	/*----------------------------- Image : wMImage3                     -----------------------------*/
	wMImage3 = new STTImage(p_rt, this, "wMImage3");
	wMImage3->setMainArg(360, 319, 276, 162);
	wMImage3->addStateImg("0", "./images/img17435598638460_276X162R0.png");

	/*----------------------------- Image : wMImage4                     -----------------------------*/
	wMImage4 = new STTImage(p_rt, this, "wMImage4");
	wMImage4->setMainArg(695, 281, 319, 200);
	wMImage4->addStateImg("0", "./images/img17435598725430_319X200R0.png");

	/*----------------------------- Label : wMLabel3                     -----------------------------*/
	wMLabel3 = new STTLabel(p_rt, this, "wMLabel3");
	wMLabel3->setMainArg(68, 229, 206, 45, "M4", TextAlign::CENTER, LabelLongMode::CLIP, 30);
	wMLabel3->setFonts(0xffffff, 22, "文泉驿微米黑", 0);
	wMLabel3->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel3->setFormatText(TextAlign::CENTER, LabelLongMode::CLIP, 30);

	/*----------------------------- Label : wMLabel4                     -----------------------------*/
	wMLabel4 = new STTLabel(p_rt, this, "wMLabel4");
	wMLabel4->setMainArg(395, 229, 206, 45, "M7/M7H", TextAlign::CENTER, LabelLongMode::CLIP, 30);
	wMLabel4->setFonts(0xffffff, 22, "文泉驿微米黑", 0);
	wMLabel4->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel4->setFormatText(TextAlign::CENTER, LabelLongMode::CLIP, 30);

	/*----------------------------- Label : wMLabel5                     -----------------------------*/
	wMLabel5 = new STTLabel(p_rt, this, "wMLabel5");
	wMLabel5->setMainArg(752, 221, 206, 45, "M10", TextAlign::CENTER, LabelLongMode::CLIP, 30);
	wMLabel5->setFonts(0xffffff, 22, "文泉驿微米黑", 0);
	wMLabel5->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel5->setFormatText(TextAlign::CENTER, LabelLongMode::CLIP, 30);

	/*called after widget created.*/

	return; //createParts END
}

void Frm03::onLoad() {
	string text = "本项目支持在任何M系列的屏幕上运行。\n"
			"M系列在C系列基础上提供更强的运算能力和存储空间，满足大多数对图片、字体资源要求不苛刻，动画效果要求适中的典型工业控制应用场合下使用。\n"
			"同时可以选配4G/WIFI模块，支持远程运维。";
	wMLabel2->setText(text);
}

bool Frm03::onClosing() {
	return true;
}

void Frm03::onDispose() {

}

void Frm03::wMButton1_clk_cb(uint16_t code, LvEvent e) {
	/*wMButton1（监 控 画 面）的点击事件*/
	pm->close("Frm03");
}

void Frm03::wMButton2_clk_cb(uint16_t code, LvEvent e) {
	/*wMButton2（项 目 介 绍）的点击事件*/
	pm->close("Frm03");
	pm->open("Frm02",PageMode::MODAL);
}

void Frm03::wMButton4_clk_cb(uint16_t code, LvEvent e) {
	/*wMButton4（设 备 信 息）的点击事件*/
	pm->close("Frm03");
	pm->open("Frm04",PageMode::MODAL);
}
