#include "Frm04.h"

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

Frm04::~Frm04() {
}

void Frm04::onInit() {

}

void Frm04::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) &Frm04::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) &Frm04::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, 0x5990f6, 0x2957ad, 0, 0, 0x999999, 1, 0xebebeb);
	wMButton3->setReleasedArg("产 品 介 绍", 0xffffff, "文泉驿微米黑", 24, 0);
	wMButton3->setReleasedStyle(0, 255, 0x5990f6, 0x2957ad, 0, 0, 0x999999, 1, 0xebebeb);
	wMButton3->onEventHandler(Event::CLICKED, this, (EHandler) &Frm04::wMButton3_clk_cb);

	/*----------------------------- Button : wMButton4                   -----------------------------*/
	wMButton4 = new STTButton(p_rt, this, "wMButton4", 0);
	wMButton4->setMainArg(769, 530, 254, 69, false);
	wMButton4->setPressedArg("设 备 信 息", 0xffffff, "文泉驿微米黑", 22, 0);
	wMButton4->setPressedStyle(0, 255, 0x2957ad, 0x2957ad, 0, 0, 0x999999, 1, 0xebebeb);
	wMButton4->setReleasedArg("设 备 信 息", 0xffffff, "文泉驿微米黑", 24, 0);
	wMButton4->setReleasedStyle(0, 255, 0x2957ad, 0x2957ad, 0, 0, 0x999999, 1, 0xebebeb);
	/*----------------------------- 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(317, 101, 124, 62, "设备型号：", TextAlign::LEFT, LabelLongMode::CLIP, 30);
	wMLabel2->setFonts(0xffffff, 24, "文泉驿微米黑", 0);
	wMLabel2->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel2->setFormatText(TextAlign::LEFT, LabelLongMode::CLIP, 30);

	/*----------------------------- Label : wMLabel3                     -----------------------------*/
	wMLabel3 = new STTLabel(p_rt, this, "wMLabel3");
	wMLabel3->setMainArg(317, 166, 124, 62, "操作环境：", TextAlign::LEFT, LabelLongMode::CLIP, 30);
	wMLabel3->setFonts(0xffffff, 24, "文泉驿微米黑", 0);
	wMLabel3->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel3->setFormatText(TextAlign::LEFT, LabelLongMode::CLIP, 30);

	/*----------------------------- Label : wMLabel4                     -----------------------------*/
	wMLabel4 = new STTLabel(p_rt, this, "wMLabel4");
	wMLabel4->setMainArg(317, 231, 124, 62, "固件版本：", TextAlign::LEFT, LabelLongMode::CLIP, 30);
	wMLabel4->setFonts(0xffffff, 24, "文泉驿微米黑", 0);
	wMLabel4->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel4->setFormatText(TextAlign::LEFT, LabelLongMode::CLIP, 30);

	/*----------------------------- Label : wMLabel5                     -----------------------------*/
	wMLabel5 = new STTLabel(p_rt, this, "wMLabel5");
	wMLabel5->setMainArg(317, 296, 124, 62, "发布时间：", TextAlign::LEFT, LabelLongMode::CLIP, 30);
	wMLabel5->setFonts(0xffffff, 24, "文泉驿微米黑", 0);
	wMLabel5->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel5->setFormatText(TextAlign::LEFT, LabelLongMode::CLIP, 30);

	/*----------------------------- Label : wMLabel6                     -----------------------------*/
	wMLabel6 = new STTLabel(p_rt, this, "wMLabel6");
	wMLabel6->setMainArg(452, 101, 254, 62, "", TextAlign::LEFT, LabelLongMode::CLIP, 30);
	wMLabel6->setFonts(0xffffff, 24, "文泉驿微米黑", 0);
	wMLabel6->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel6->setFormatText(TextAlign::LEFT, LabelLongMode::CLIP, 30);

	/*----------------------------- Label : wMLabel7                     -----------------------------*/
	wMLabel7 = new STTLabel(p_rt, this, "wMLabel7");
	wMLabel7->setMainArg(452, 166, 254, 62, "Linux", TextAlign::LEFT, LabelLongMode::CLIP, 30);
	wMLabel7->setFonts(0xffffff, 24, "文泉驿微米黑", 0);
	wMLabel7->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel7->setFormatText(TextAlign::LEFT, LabelLongMode::CLIP, 30);

	/*----------------------------- Label : wMLabel8                     -----------------------------*/
	wMLabel8 = new STTLabel(p_rt, this, "wMLabel8");
	wMLabel8->setMainArg(452, 231, 254, 62, "", TextAlign::LEFT, LabelLongMode::CLIP, 30);
	wMLabel8->setFonts(0xffffff, 24, "文泉驿微米黑", 0);
	wMLabel8->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel8->setFormatText(TextAlign::LEFT, LabelLongMode::CLIP, 30);

	/*----------------------------- Label : wMLabel9                     -----------------------------*/
	wMLabel9 = new STTLabel(p_rt, this, "wMLabel9");
	wMLabel9->setMainArg(452, 296, 254, 62, "", TextAlign::LEFT, LabelLongMode::CLIP, 30);
	wMLabel9->setFonts(0xffffff, 24, "文泉驿微米黑", 0);
	wMLabel9->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel9->setFormatText(TextAlign::LEFT, LabelLongMode::CLIP, 30);

	/*called after widget created.*/

	return; //createParts END
}

void Frm04::onLoad() {
	string hmiModel = SysInfo::getHMIModel();
	string fv = SysInfo::getFwVersion();
	string fd = SysInfo::getFwDay();
	wMLabel6->setText(hmiModel);
	wMLabel8->setText(fv);
	wMLabel9->setText(fd);

}

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

void Frm04::onDispose() {

}

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

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

void Frm04::wMButton3_clk_cb(uint16_t code, LvEvent e) {
	/*wMButton3（产 品 介 绍）的点击事件*/
	pm->close("Frm04");
	pm->open("Frm03",PageMode::MODAL);
}
