// Moves all children to be under control of the widget.
void ElementFormControlSelect::OnUpdate()
{
	ElementFormControl::OnUpdate();

	// Move any child elements into the widget (except for the three functional elements).
	for(int child_index = 0;child_index<GetNumChildren();++child_index)
	{
		Core::Element* child = GetChild(child_index);

		// Check for a value attribute.
		Rocket::Core::String attribute_value = child->GetAttribute<Rocket::Core::String>("value", "");

		// Pull the inner RML and add the option.
		Rocket::Core::String rml;
		child->GetInnerRML(rml);
		widget->AddOption(rml, attribute_value, -1, child->GetAttribute("selected") != NULL, child->GetAttribute("unselectable") == NULL);
	}
	
	RemoveAllChildren();
}
Exemple #2
0
void UiBase::RecursiveTranslate(Core::Element* root)
{
  unsigned short it;
  Core::Element* child;

  if (!root)
    return ;
  for (it = 0 ; (child = root->GetChild(it)) ; ++it)
  {
    Core::Variant* attr = child->GetAttribute("i18n");

    if (attr)
    {
      string key = attr->Get<Core::String>().CString();

      child->SetInnerRML(i18n::T(key).c_str());
    }
    else
      RecursiveTranslate(child);
  }
}