: Widget(parent),
_text(""),
_justify_horz(RenderStyle::LeftTopJustify),
- _justify_vert(RenderStyle::LeftTopJustify)
+ _justify_vert(RenderStyle::LeftTopJustify),
+ _highlight(false)
{
styleChanged(*RenderStyle::style(screen()));
}
refresh();
}
+void Label::setHighlighted(bool h)
+{
+ _highlight = h;
+ styleChanged(*RenderStyle::style(screen()));
+ refresh();
+}
+
void Label::setText(const ustring &text)
{
bool utf = text.utf8();
void Label::styleChanged(const RenderStyle &style)
{
- _texture = style.labelFocusBackground();
- _forecolor = style.textFocusColor();
- _font = style.labelFont();
- Widget::styleChanged(style);
- calcDefaultSizes();
+ if (_highlight) {
+ _texture = style.labelFocusBackground();
+ _forecolor = style.textFocusColor();
+ } else {
+ _texture = style.labelUnfocusBackground();
+ _forecolor = style.textUnfocusColor();
+ }
+ if (_font != style.labelFont()) {
+ _font = style.labelFont();
+ calcDefaultSizes();
+ }
}
void Label::renderForeground(Surface &surface)