#include "Frm10.h"

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

Frm10::~Frm10() {
}

void Frm10::onInit() {

}

void Frm10::createParts() {
	setMainArg(0, 0, 1024, 420);
	setMainStyle(0, 0xa0, 0xffff, 2, 255, 0, 0xc0c0c0);

	/*----------------------------- Panel : wMPanel2                     -----------------------------*/
	wMPanel2 = new STTPanel(p_rt, this, "wMPanel2");
	wMPanel2->setMainArg(800, 0, 225, 420, 0);
	wMPanel2->setMainStyle(0, 0x8080c0, 0xffffff, GradDir::NONE, 255, 1, 0xc0c0c0);

	/*----------------------------- MSwitch : wMMSwitch5                 -----------------------------*/
	wMMSwitch5 = new STTButton(p_rt, wMPanel2, "wMMSwitch5", 2);
	wMMSwitch5->setMainArg(41, 42, 144, 52, false);
	wMMSwitch5->enStateLabel();
	wMMSwitch5->getStateLabel()->setMainArg(20, 13, 104, 26, "", TextAlign::CENTER, LabelLongMode::CLIP, 30);
	wMMSwitch5->getStateLabel()->setFonts(0x0, 16, "文泉驿微米黑", 0);
	wMMSwitch5->getStateLabel()->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMMSwitch5->getStateLabel()->setFormatText(TextAlign::CENTER, LabelLongMode::CLIP, 30);
	wMMSwitch5->setImg("1", "./images/button_6-1_144X52X808080.svg", "时间参数设置");
	wMMSwitch5->setImg("0", "./images/button_6-0_144X52Xc0c0c0.svg", "时间参数设置");
	wMMSwitch5->onEventHandler(Event::CLICKED, this, (EHandler) &Frm10::wMMSwitch5_clk_cb);

	/*----------------------------- MSwitch : wMMSwitch6                 -----------------------------*/
	wMMSwitch6 = new STTButton(p_rt, wMPanel2, "wMMSwitch6", 2);
	wMMSwitch6->setMainArg(41, 132, 144, 52, false);
	wMMSwitch6->enStateLabel();
	wMMSwitch6->getStateLabel()->setMainArg(26, 13, 91, 26, "", 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_6-1_144X52X808080.svg", "恒温箱设置");
	wMMSwitch6->setImg("0", "./images/button_6-0_144X52Xc0c0c0.svg", "恒温箱设置");
	wMMSwitch6->onEventHandler(Event::CLICKED, this, (EHandler) &Frm10::wMMSwitch6_clk_cb);

	/*----------------------------- MSwitch : wMMSwitch8                 -----------------------------*/
	wMMSwitch8 = new STTButton(p_rt, wMPanel2, "wMMSwitch8", 2);
	wMMSwitch8->setMainArg(41, 223, 144, 52, false);
	wMMSwitch8->enStateLabel();
	wMMSwitch8->getStateLabel()->setMainArg(22, 13, 100, 26, "", TextAlign::CENTER, LabelLongMode::CLIP, 30);
	wMMSwitch8->getStateLabel()->setFonts(0x0, 16, "文泉驿微米黑", 0);
	wMMSwitch8->getStateLabel()->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMMSwitch8->getStateLabel()->setFormatText(TextAlign::CENTER, LabelLongMode::CLIP, 30);
	wMMSwitch8->setImg("1", "./images/button_6-1_144X52X808080.svg", "报警参数设置");
	wMMSwitch8->setImg("0", "./images/button_6-0_144X52Xc0c0c0.svg", "报警参数设置");
	wMMSwitch8->onEventHandler(Event::CLICKED, this, (EHandler) &Frm10::wMMSwitch8_clk_cb);

	/*----------------------------- MSwitch : wMMSwitch9                 -----------------------------*/
	wMMSwitch9 = new STTButton(p_rt, wMPanel2, "wMMSwitch9", 2);
	wMMSwitch9->setMainArg(41, 310, 144, 52, false);
	wMMSwitch9->enStateLabel();
	wMMSwitch9->getStateLabel()->setMainArg(22, 13, 100, 26, "", TextAlign::CENTER, LabelLongMode::CLIP, 30);
	wMMSwitch9->getStateLabel()->setFonts(0x0, 16, "文泉驿微米黑", 0);
	wMMSwitch9->getStateLabel()->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMMSwitch9->getStateLabel()->setFormatText(TextAlign::CENTER, LabelLongMode::CLIP, 30);
	wMMSwitch9->setImg("1", "./images/button_6-1_144X52X808080.svg", "运行参数设置");
	wMMSwitch9->setImg("0", "./images/button_6-0_144X52Xc0c0c0.svg", "运行参数设置");
	wMMSwitch9->onEventHandler(Event::CLICKED, this, (EHandler) &Frm10::wMMSwitch9_clk_cb);

	/*----------------------------- Panel : wMPanel1                     -----------------------------*/
	wMPanel1 = new STTPanel(p_rt, this, "wMPanel1");
	wMPanel1->setMainArg(0, 0, 800, 420, 0);
	wMPanel1->setMainStyle(0, 0xa0, 0xfdfe, GradDir::HOR, 255, 1, 0xc0c0c0);

	/*called after widget created.*/

	return; //createParts END
}

void Frm10::onLoad() {
	pm->open("Frm04", PageMode::EMBEDDED, wMPanel1);

}

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

void Frm10::onDispose() {

}

void Frm10::wMMSwitch6_clk_cb(uint16_t code, LvEvent e) {
	pm->close("Frm04");
	pm->close("Frm15");
	pm->close("Frm17");
	pm->open("Frm11", PageMode::EMBEDDED, wMPanel1);
}

void Frm10::wMMSwitch5_clk_cb(uint16_t code, LvEvent e) {
        pm->close("Frm15");
	    pm->close("Frm11");
	    pm->close("Frm17");
		pm->open("Frm04", PageMode::EMBEDDED, wMPanel1);
}

void Frm10::wMMSwitch8_clk_cb(uint16_t code, LvEvent e) {
    pm->close("Frm04");
    pm->close("Frm11");
    pm->close("Frm17");
	pm->open("Frm15", PageMode::EMBEDDED, wMPanel1);
}

void Frm10::wMMSwitch9_clk_cb(uint16_t code, LvEvent e) {
	pm->close("Frm04");
	pm->close("Frm11");
	pm->close("Frm15");
	pm->open("Frm17", PageMode::EMBEDDED, wMPanel1);
}
