+ int longest = 0;
+ // find the longest line
+ std::vector<ustring>::iterator it, end = _parsedtext.end();
+ for (it = _parsedtext.begin(); it != end; ++it) {
+ int length = _font->measureString(*it);
+ if (length < 0) continue; // lines too long get skipped
+ if (length > longest) longest = length;
+ }
+ setMinSize(Size(longest + borderWidth() * 2 + bevel() * 4,
+ _parsedtext.size() * _font->height() + borderWidth() * 2 +
+ bevel() * 2));
+}
+
+void Label::styleChanged(const RenderStyle &style)
+{
+ if (_highlight) {
+ _texture = style.labelFocusBackground();
+ _forecolor = style.textFocusColor();
+ } else {
+ _texture = style.labelUnfocusBackground();
+ _forecolor = style.textUnfocusColor();
+ }
+ if (_font != style.labelFont()) {
+ _font = style.labelFont();
+ calcDefaultSizes();
+ }