#include "Frm01.h"


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

Frm01::~Frm01() {
}

void Frm01::onInit(){
}

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

	/*----------------------------- Label : wMLabel1                     -----------------------------*/
	wMLabel1 = new STTLabel(p_rt, this, "wMLabel1");
	wMLabel1->setMainArg(398, 132, 182, 126, "客户端程序", TextAlign::LEFT, LabelLongMode::CLIP, 30);
	wMLabel1->setFonts(0x0, 30, "文泉驿微米黑", 0);
	wMLabel1->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel1->setFormatText(TextAlign::LEFT, LabelLongMode::CLIP, 30);

	/*----------------------------- Button : wMButton2                   -----------------------------*/
	wMButton2 = new STTButton(p_rt, this, "wMButton2", 0);
	wMButton2->setMainArg(181, 349, 168, 82, false);
	wMButton2->setPressedArg("功能键", 0x0, "文泉驿微米黑", 16, 0);
	wMButton2->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton2->setReleasedArg("功能键", 0x0, "文泉驿微米黑", 16, 0);
	wMButton2->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton2->onEventHandler(Event::CLICKED, this, (EHandler) &Frm01::wMButton2_clk_cb);

	/*called after widget created.*/

	return; //createParts END
}

void Frm01::onLoad(){
}

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

void Frm01::onDispose(){
}

void Frm01::wMButton2_clk_cb(uint16_t code, LvEvent e) {
	/*wMButton2（功能键）的点击事件*/
	vm->setFloat("温度",25.14);
	hmiApp->isWrite = true;
}
