void TextField::deserialize(const deserializedata* data) { _VStyleActor::deserialize(data); pugi::xml_node node = data->node; TextStyle def; _style.vAlign = (TextStyle::VerticalAlign)node.attribute("valign").as_int(def.vAlign); _style.hAlign = (TextStyle::HorizontalAlign)node.attribute("halign").as_int(def.hAlign); _style.multiline = node.attribute("multiline").as_bool(def.multiline); _style.breakLongWords = node.attribute("breakLongWords").as_bool(def.breakLongWords); _style.fontSize = node.attribute("fontsize2scale").as_int(def.fontSize); _style.linesOffset = node.attribute("linesOffset").as_int(def.linesOffset); _style.kerning = node.attribute("kerning").as_int(def.kerning); const char* fnt = node.attribute("font").as_string(0); if (fnt && *fnt) { ResFont* font = data->factory->getResFont(fnt); if (font) _style.font = font->getFont(); } needRebuild(); setText(node.attribute("text").as_string()); }
void TextField::setHtmlText(const std::string& str) { _flags |= flag_html; if (_text != str) { _text = str; needRebuild(); } }
void Model::setPosition(float x, float y, float z) { GfxMan.lockFrame(); _position[0] = x / _modelScale[0]; _position[1] = y / _modelScale[1]; _position[2] = z / _modelScale[2]; createAbsolutePosition(); calculateDistance(); needRebuild(); resort(); GfxMan.unlockFrame(); }
void Model::setRotation(float x, float y, float z) { GfxMan.lockFrame(); _rotation[0] = x; _rotation[1] = y; _rotation[2] = z; createAbsolutePosition(); calculateDistance(); needRebuild(); resort(); GfxMan.unlockFrame(); }
void Model::finalize() { _currentState = 0; createStateNamesList(); setState(); createBound(); // Order all node children lists for (StateList::iterator s = _stateList.begin(); s != _stateList.end(); ++s) for (NodeList::iterator n = (*s)->rootNodes.begin(); n != (*s)->rootNodes.end(); ++n) (*n)->orderChildren(); needRebuild(); }
void TextField::setStyle(const TextStyle& st) { TextStyle::HorizontalAlign halign = _style.hAlign; TextStyle::VerticalAlign valign = _style.vAlign; int size = _style.fontSize; _style = st; if (st.hAlign == TextStyle::HALIGN_DEFAULT) _style.hAlign = halign; if (st.vAlign == TextStyle::VALIGN_DEFAULT) _style.vAlign = valign; if (st.fontSize == 0) _style.fontSize = size; needRebuild(); }
void Model::setState(const Common::UString &name) { if (_stateList.empty()) return; State *state = 0; StateMap::iterator s = _stateMap.find(name); if (s == _stateMap.end()) s = _stateMap.find(""); if (s != _stateMap.end()) state = s->second; else state = _stateList.front(); assert(state); if (state == _currentState) return; GfxMan.lockFrame(); bool visible = isVisible(); if (visible) hide(); _currentState = state; // TODO: Do we need to recreate the bounding box on a state change? // createBound(); if (visible) show(); needRebuild(); GfxMan.unlockFrame(); }
void TextField::setMultiline(bool multiline) { _style.multiline = multiline; needRebuild(); }
void TextField::sizeChanged(const Vector2& size) { needRebuild(); }
void TextField::setAlign(TextStyle::VerticalAlign vAlign, TextStyle::HorizontalAlign hAlign) { _style.vAlign = vAlign; _style.hAlign = hAlign; needRebuild(); }
void TextField::setFontSize(int size) { _style.fontSize = size; needRebuild(); }
void Model::drawBound(bool enabled) { _drawBound = enabled; needRebuild(); }
void TextField::setKerning(int kerning) { _style.kerning = kerning; needRebuild(); }
void TextField::setLinesOffset(int offset) { _style.linesOffset = offset; needRebuild(); }
void TextField::setHAlign(TextStyle::HorizontalAlign align) { _style.hAlign = align; needRebuild(); }
void Model::doRebuild() { needRebuild(); }
void TextField::setVAlign(TextStyle::VerticalAlign align) { _style.vAlign = align; needRebuild(); }
void TextField::setBreakLongWords(bool val) { _style.breakLongWords = val; needRebuild(); }
void TextField::setFont(const Font* font) { _style.font = font; needRebuild(); }