#include "Frm19.h"

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

Frm19::~Frm19() {
}

void Frm19::onInit() {

}

void Frm19::createParts() {
	setMainArg(0, 0, 800, 420);
	setMainStyle(0, 0xffffff, 0xffff, 0, 255, 0, 0xc0c0c0);

	/*----------------------------- HistoryTrend : wMHistoryTrend1       -----------------------------*/
	wMHistoryTrend1 = new STTHistoryTrend(p_rt, this, "wMHistoryTrend1");
	wMHistoryTrend1->setMainArg(6, 44, 788, 274, 1, 301, 4, 5, 12, "文泉驿微米黑", 0x0, 0);
	wMHistoryTrend1->setMainStyle(0, 0xffffff, 0xffff, 0, 0, 0xc0c0c0, 0, 0x0, 50, 50, 20, 50);
	wMHistoryTrend1->setFractionLen(0, 0, 0);
	wMHistoryTrend1->setXAxis(0, 0, 7, 1, true, "\n\n\n\n\n\n\n");
	wMHistoryTrend1->setYAxis(0, 0, 6, 1, true, "100\n80\n60\n40\n20\n0", 0, 100);
	wMHistoryTrend1->setY2Axis(0, 0, 2, 1, true, "\n", 0, 100);
	wMHistoryTrend1->setChartBgStyle(0, 0xf0f0f0, 0xffffff, 0, 1, 0xc0c0c0, 2, 2, 1, 0xc0c0c0, 5, 0);
	wMHistoryTrend1->setTickStyle(1, 0xc0c0c0);
	wMHistoryTrend1->hideSeries(wMHistoryTrend1->setAddSeries(0, 0x0, NULL, 0, 100), false);
	wMHistoryTrend1->hideSeries(wMHistoryTrend1->setAddSeries(0, 0xff, NULL, 0, 100), false);
	wMHistoryTrend1->hideSeries(wMHistoryTrend1->setAddSeries(0, 0xffff, NULL, 0, 100), false);
	wMHistoryTrend1->hideSeries(wMHistoryTrend1->setAddSeries(0, 0xff00, NULL, 0, 100), false);
	wMHistoryTrend1->hideSeries(wMHistoryTrend1->setAddSeries(0, 0xffc400, NULL, 0, 100), false);
	wMHistoryTrend1->hideSeries(wMHistoryTrend1->setAddSeries(0, 0xff0000, NULL, 0, 100), false);
	wMHistoryTrend1->hideSeries(wMHistoryTrend1->setAddSeries(0, 0xffff00, NULL, 0, 100), false);
	wMHistoryTrend1->setDataSource("1", "", true, "样气压力;载气压力;CO2浓度;可燃气体浓度;进样压力;环境温度;环境湿度", "{\"m\":\"0\",\"mv\":\"\",\"xu\":\"63\",\"xs\":\"12\",\"xsu\":\"2\",\"xsv\":\"\",\"y2n\":\"\",\"y2m\":\"\"}");
	wMHistoryTrend1->startCollect();
	wMHistoryTrend1->enableCusror(true);

	/*----------------------------- Label : wMLabel3                     -----------------------------*/
	wMLabel3 = new STTLabel(p_rt, this, "wMLabel3");
	wMLabel3->setMainArg(347, 7, 105, 38, "实时曲线", TextAlign::LEFT, LabelLongMode::CLIP, 30);
	wMLabel3->setFonts(0x0, 25, "文泉驿微米黑", 0);
	wMLabel3->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel3->setFormatText(TextAlign::LEFT, LabelLongMode::CLIP, 30);

	/*----------------------------- SqliteTable : wMSqliteTable1         -----------------------------*/
	wMSqliteTable1 = new STTTable(p_rt, this, "wMSqliteTable1");
	wMSqliteTable1->setMainArg(36, 337, 727, 72, "TID,TID,82;TDATE,TDATE,82;TTIME,TTIME,82;CLSS,CLSS,82;WLVL,WLVL,82;MSGS,MSGS,82;CFMTIME,CFMTIME,104;RESETTIME,RESETTIME,118", 1, true, 6);
	wMSqliteTable1->setHeadCellStyle(0xf0f0f0, 0xffffff, 0, 1, 0xd0d0d0, 5, 5, 0, 0, 0x0, 16, "文泉驿微米黑", 0);
	wMSqliteTable1->setSelCellStyle(0x1a2b3, 0xffffff, 0, 1, 0xd0d0d0, 5, 5, 0, 0, 0x0, 16, "文泉驿微米黑", 0);
	wMSqliteTable1->setDataCellStyle(0xffffff, 0xffffff, 0, 1, 0xd0d0d0, 5, 5, 0, 0, 0x0, 16, "文泉驿微米黑", 0);
	tv_wMSqliteTable1 = new TTableView("tv_wMSqliteTable1", "S_EVENT", "TID", "TID", nullptr, "", false);
	wMSqliteTable1->bindData(tv_wMSqliteTable1);
	/*called after widget created.*/
	wMHistoryTrend1->setCursorTable(wMSqliteTable1);
	wMHistoryTrend1->setCursorStyle(0x00ff80, 1, 1, "时间轴");

	return; //createParts END
}

void Frm19::onLoad() {

}

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

void Frm19::onDispose() {

}
