#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, 0xffffff, 0xffff, 0, 255, 0, 0xc0c0c0);

	/*----------------------------- Panel : wMPanel2                     -----------------------------*/
	wMPanel2 = new STTPanel(p_rt, this, "wMPanel2");
	wMPanel2->setMainArg(0, 510, 1024, 90, 0);
	wMPanel2->setMainStyle(0, 0x8080c0, 0xffffff, GradDir::NONE, 255, 0, 0xc0c0c0);

	/*----------------------------- MSwitch : wMMSwitch6                 -----------------------------*/
	wMMSwitch6 = new STTButton(p_rt, wMPanel2, "wMMSwitch6", 2);
	wMMSwitch6->setMainArg(81, 19, 147, 53, false);
	wMMSwitch6->enStateLabel();
	wMMSwitch6->getStateLabel()->setMainArg(34, 16, 80, 22, "", TextAlign::CENTER, LabelLongMode::CLIP, 30);
	wMMSwitch6->getStateLabel()->setFonts(0x0, 16, "文泉驿微米黑", 0);
	wMMSwitch6->getStateLabel()->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMMSwitch6->getStateLabel()->setFormatText(TextAlign::CENTER, LabelLongMode::CLIP, 30);
	wMMSwitch6->setImg("1", "./images/button_1-1_147X53Xc0c0c0.svg", "数据曲线");
	wMMSwitch6->setImg("0", "./images/button_1-0_147X53Xc0c0c0.svg", "数据曲线");
	wMMSwitch6->onEventHandler(Event::CLICKED, this, (EHandler) &Frm03::wMMSwitch6_clk_cb);

	/*----------------------------- MSwitch : wMMSwitch11                -----------------------------*/
	wMMSwitch11 = new STTButton(p_rt, wMPanel2, "wMMSwitch11", 2);
	wMMSwitch11->setMainArg(426, 19, 147, 53, false);
	wMMSwitch11->enStateLabel();
	wMMSwitch11->getStateLabel()->setMainArg(34, 16, 80, 22, "", TextAlign::CENTER, LabelLongMode::CLIP, 30);
	wMMSwitch11->getStateLabel()->setFonts(0x0, 16, "文泉驿微米黑", 0);
	wMMSwitch11->getStateLabel()->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMMSwitch11->getStateLabel()->setFormatText(TextAlign::CENTER, LabelLongMode::CLIP, 30);
	wMMSwitch11->setImg("1", "./images/button_1-1_147X53Xc0c0c0.svg", "历史记录");
	wMMSwitch11->setImg("0", "./images/button_1-0_147X53Xc0c0c0.svg", "历史记录");
	wMMSwitch11->onEventHandler(Event::CLICKED, this, (EHandler) &Frm03::wMMSwitch11_clk_cb);

	/*----------------------------- MSwitch : wMMSwitch12                -----------------------------*/
	wMMSwitch12 = new STTButton(p_rt, wMPanel2, "wMMSwitch12", 2);
	wMMSwitch12->setMainArg(803, 19, 147, 53, false);
	wMMSwitch12->enStateLabel();
	wMMSwitch12->getStateLabel()->setMainArg(34, 16, 80, 22, "", TextAlign::CENTER, LabelLongMode::CLIP, 30);
	wMMSwitch12->getStateLabel()->setFonts(0x0, 16, "文泉驿微米黑", 0);
	wMMSwitch12->getStateLabel()->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMMSwitch12->getStateLabel()->setFormatText(TextAlign::CENTER, LabelLongMode::CLIP, 30);
	wMMSwitch12->setImg("1", "./images/button_1-1_147X53Xc0c0c0.svg", "报警记录");
	wMMSwitch12->setImg("0", "./images/button_1-0_147X53Xc0c0c0.svg", "报警记录");
	wMMSwitch12->onEventHandler(Event::CLICKED, this, (EHandler) &Frm03::wMMSwitch12_clk_cb);

	/*----------------------------- Panel : wMPanel13                    -----------------------------*/
	wMPanel13 = new STTPanel(p_rt, this, "wMPanel13");
	wMPanel13->setMainArg(0, 85, 1024, 420, 2);
	wMPanel13->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 255, 0, 0xc0c0c0);

	/*----------------------------- Panel : wMPanel3                     -----------------------------*/
	wMPanel3 = new STTPanel(p_rt, this, "wMPanel3");
	wMPanel3->setMainArg(0, 0, 1024, 80, 0);
	wMPanel3->setMainStyle(0, 0x8080c0, 0xffffff, GradDir::NONE, 255, 0, 0xffffff);

	/*----------------------------- Label : wMLabel2                     -----------------------------*/
	wMLabel2 = new STTLabel(p_rt, wMPanel3, "wMLabel2");
	wMLabel2->setMainArg(349, 11, 284, 68, "在线分析系统", TextAlign::LEFT, LabelLongMode::CLIP, 30);
	wMLabel2->setFonts(0x0, 45, "文泉驿微米黑", 2);
	wMLabel2->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel2->setFormatText(TextAlign::LEFT, LabelLongMode::CLIP, 30);

	/*----------------------------- Panel : wMPanel4                     -----------------------------*/
	wMPanel4 = new STTPanel(p_rt, wMPanel3, "wMPanel4");
	wMPanel4->setMainArg(3, 86, 1023, 423, 0);
	wMPanel4->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 255, 1, 0xc0c0c0);

	/*----------------------------- Label : wMLabel47                    -----------------------------*/
	wMLabel47 = new STTLabel(p_rt, wMPanel3, "wMLabel47");
	wMLabel47->setMainArg(767, 25, 239, 40, "", TextAlign::CENTER, LabelLongMode::CLIP, 30);
	wMLabel47->setFonts(0xffffff, 24, "文泉驿微米黑", 0);
	wMLabel47->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel47->setFormatDate("-", ":", true, true, true, true, true, true, false);
	wMLabel47->bindData(_V("$time"));

	/*called after widget created.*/

	return; //createParts END
}

void Frm03::onLoad() {
	pm->open("Frm12", PageMode::EMBEDDED, wMPanel13);
}

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

void Frm03::onDispose() {

}

void Frm03::wMMSwitch6_clk_cb(uint16_t code, LvEvent e) {
	pm->open("Frm12", PageMode::EMBEDDED, wMPanel13);
}

void Frm03::wMMSwitch11_clk_cb(uint16_t code, LvEvent e) {
	pm->open("Frm06", PageMode::EMBEDDED, wMPanel13);
}

void Frm03::wMMSwitch12_clk_cb(uint16_t code, LvEvent e) {
	pm->open("Frm07", PageMode::EMBEDDED, wMPanel13);
}
