]> Dogcows Code - chaz/openbox/blobdiff - otk/label.cc
mad optimizations
[chaz/openbox] / otk / label.cc
index 0c18b5d03cc001616f4d4a87c8ef65a9cd218713..16fa25a0b674f249c460091676a258b585b45437 100644 (file)
@@ -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)
This page took 0.021791 seconds and 4 git commands to generate.