Beispiel #1
0
EditBox* CreateEditBoxFromXML(ticpp::Element* elem, Dialog* /*dlg*/){
	int tmpInt;
	EditBox* box = new EditBox();

	box->SetName(elem->GetAttribute("NAME").c_str());
	if(elem->GetAttribute("ID", &tmpInt))			box->SetID(tmpInt);
	if(elem->GetAttribute("X", &tmpInt))			box->SetPositionX(tmpInt);
	if(elem->GetAttribute("Y", &tmpInt))			box->SetPositionY(tmpInt);
	if(elem->GetAttribute("WIDTH", &tmpInt))		box->SetSizeX(tmpInt);
	if(elem->GetAttribute("HEIGHT", &tmpInt))		box->SetSizeY(tmpInt);
	if(elem->GetAttribute("CHARWIDTH", &tmpInt))	box->SetCharWidth(tmpInt);
	if(elem->GetAttribute("CHARHEIGHT", &tmpInt))	box->SetCharHeight(tmpInt);
	if(elem->GetAttribute("NUMBER", &tmpInt))		box->SetNumber(tmpInt);
	if(elem->GetAttribute("LIMITTEXT", &tmpInt))	box->SetLimitText(tmpInt);
	if(elem->GetAttribute("PASSWORD", &tmpInt))		box->SetPassword(tmpInt);
	if(elem->GetAttribute("HIDECURSOR", &tmpInt))	box->SetHideCursor(tmpInt);
	if(elem->GetAttribute("TEXTALIGN", &tmpInt))	box->SetTextAlign(tmpInt);
	if(elem->GetAttribute("MULTILINE", &tmpInt))	box->SetMultiline(tmpInt);
	if(elem->GetAttribute("TEXTCOLOR", &tmpInt))	box->SetTextColour(tmpInt);
	if(elem->GetAttribute("FONT", &tmpInt))			box->SetFont(tmpInt);
	
	box->SetTextElement(gUiRender->CreateTextWithFont(box->Font()));

	return box;
}
void
FormWindow::CreateDefEdit(CtrlDef& def)
{
	EditBox* ctrl = CreateEditBox(def.GetText(),
	def.GetX(),
	def.GetY(),
	def.GetW(),
	def.GetH(),
	def.GetID(),
	def.GetParentID());

	ctrl->SetAltText(def.GetAltText());
	ctrl->SetEnabled(def.IsEnabled());
	ctrl->SetBackColor(def.GetBackColor());
	ctrl->SetForeColor(def.GetForeColor());
	ctrl->SetStyle(def.GetStyle());
	ctrl->SetSingleLine(def.GetSingleLine());
	ctrl->SetTextAlign(def.GetTextAlign());
	ctrl->SetTransparent(def.GetTransparent());
	ctrl->SetHidePartial(def.GetHidePartial());
	ctrl->SetPasswordChar(def.GetPasswordChar());

	ctrl->SetMargins(def.GetMargins());
	ctrl->SetTextInsets(def.GetTextInsets());
	ctrl->SetCellInsets(def.GetCellInsets());
	ctrl->SetCells(def.GetCells());
	ctrl->SetFixedWidth(def.GetFixedWidth());
	ctrl->SetFixedHeight(def.GetFixedHeight());

	ctrl->SetLineHeight(def.GetLineHeight());
	ctrl->SetScrollBarVisible(def.GetScrollBarVisible());
	ctrl->SetSmoothScroll(def.GetSmoothScroll());

	if (def.GetTexture().length() > 0) {
		Bitmap*     ctrl_tex = 0;
		DataLoader* loader   = DataLoader::GetLoader();
		loader->SetDataPath("Screens/");
		loader->LoadTexture(def.GetTexture(), ctrl_tex);
		loader->SetDataPath("");

		ctrl->SetTexture(ctrl_tex);
	}

	Font* f = FontMgr::Find(def.GetFont());
	if (f) ctrl->SetFont(f);
}