X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Flabel.cc;h=16fa25a0b674f249c460091676a258b585b45437;hb=ef231de58a738c83bf505e184fbafa9077f7452e;hp=0c18b5d03cc001616f4d4a87c8ef65a9cd218713;hpb=99cd843fc6dc7a7f55b6c90fd1162f233853aad2;p=chaz%2Fopenbox diff --git a/otk/label.cc b/otk/label.cc index 0c18b5d0..16fa25a0 100644 --- a/otk/label.cc +++ b/otk/label.cc @@ -16,7 +16,8 @@ Label::Label(Widget *parent) : Widget(parent), _text(""), _justify_horz(RenderStyle::LeftTopJustify), - _justify_vert(RenderStyle::LeftTopJustify) + _justify_vert(RenderStyle::LeftTopJustify), + _highlight(false) { styleChanged(*RenderStyle::style(screen())); } @@ -37,6 +38,13 @@ void Label::setVerticalJustify(RenderStyle::Justify j) refresh(); } +void Label::setHighlighted(bool h) +{ + _highlight = h; + styleChanged(*RenderStyle::style(screen())); + refresh(); +} + void Label::setText(const ustring &text) { bool utf = text.utf8(); @@ -77,11 +85,17 @@ void Label::calcDefaultSizes() 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)