Ejemplo n.º 1
0
Button* CreateButtonFromXML(ticpp::Element* elem, Dialog* /*dlg*/){
	int tmpInt;
	Button* btn = new Button();

	btn->SetName(elem->GetAttribute("NAME").c_str());
	btn->SetNormalGID(elem->GetAttribute("NORMALGID").c_str());
	btn->SetOverGID(elem->GetAttribute("OVERGID").c_str());
	btn->SetDownGID(elem->GetAttribute("DOWNGID").c_str());
	btn->SetBlinkGID(elem->GetAttribute("BLINKGID").c_str());
	btn->SetDisableGID(elem->GetAttribute("DISABLEGID").c_str());

	if(elem->GetAttribute("ID", &tmpInt))		btn->SetID(tmpInt);
	if(elem->GetAttribute("X", &tmpInt))		btn->SetPositionX(tmpInt);
	if(elem->GetAttribute("Y", &tmpInt))		btn->SetPositionY(tmpInt);
	if(elem->GetAttribute("WIDTH", &tmpInt))	btn->SetSizeX(tmpInt);
	if(elem->GetAttribute("HEIGHT", &tmpInt))	btn->SetSizeY(tmpInt);
	if(elem->GetAttribute("OFFSETX", &tmpInt))	btn->AddOffsetX(tmpInt);
	if(elem->GetAttribute("OFFSETY", &tmpInt))	btn->AddOffsetY(tmpInt);
	if(elem->GetAttribute("OVERSID", &tmpInt))	btn->SetOverSoundID(tmpInt);
	if(elem->GetAttribute("CLICKSID", &tmpInt))	btn->SetClickSoundID(tmpInt);
	if(elem->GetAttribute("NOIMAGE", &tmpInt))	btn->SetNoImage(tmpInt);

	btn->SetNormalGraphic(ImageRes::Instance().GetGraphic(btn->NormalGID()));
	btn->SetOverGraphic(ImageRes::Instance().GetGraphic(btn->OverGID()));
	btn->SetDownGraphic(ImageRes::Instance().GetGraphic(btn->DownGID()));
	btn->SetBlinkGraphic(ImageRes::Instance().GetGraphic(btn->BlinkGID()));
	btn->SetDisableGraphic(ImageRes::Instance().GetGraphic(btn->DisableGID()));

	return btn;
}