]> Dogcows Code - chaz/openbox/blobdiff - otk/focuslabel.cc
dont make wrap a subdir of otk
[chaz/openbox] / otk / focuslabel.cc
index 6d7d5c314cf6d12a21bf7e402e5ccfe1c6ec5c90..846d035ebb78de0317161796e1009535b505db32 100644 (file)
@@ -37,8 +37,8 @@ void FocusLabel::fitString(const std::string &str)
 
 void FocusLabel::fitSize(int w, int h)
 {
-  unsigned int sidemargin = style()->bevelWidth() * 2;
-  resize(w + sidemargin * 2, h);
+  unsigned int sidemargin = _bevel_width * 2;
+  resize(w + sidemargin * 2, h + _bevel_width * 2);
 }
 
 void FocusLabel::update()
@@ -46,12 +46,20 @@ void FocusLabel::update()
   if (_dirty) {
     int w = _rect.width(), h = _rect.height();
     const Font *ft = style()->labelFont();
-    unsigned int sidemargin = style()->bevelWidth() * 2;
+    unsigned int sidemargin = _bevel_width * 2;
     if (!_fixed_width)
       w = ft->measureString(_text) + sidemargin * 2;
     if (!_fixed_height)
       h = ft->height();
-    internalResize(w, h);
+
+    // enforce a minimum size
+    if (w > _rect.width()) {
+      if (h > _rect.height())
+        internalResize(w, h);
+      else
+        internalResize(w, _rect.height());
+    } else if (h > _rect.height())
+      internalResize(_rect.width(), h);
   }
   FocusWidget::update();
 }
@@ -64,7 +72,7 @@ void FocusLabel::renderForeground()
   const Font *ft = style()->labelFont();
   RenderColor *text_color = (isFocused() ? style()->textFocusColor()
                              : style()->textUnfocusColor());
-  unsigned int sidemargin = style()->bevelWidth() * 2;
+  unsigned int sidemargin = _bevel_width * 2;
 
   ustring t = _text; // the actual text to draw
   int x = sidemargin;    // x coord for the text
@@ -96,7 +104,7 @@ void FocusLabel::renderForeground()
   }
 
   display->renderControl(_screen)->
-    drawString(*_surface, *ft, x, 0, *text_color, t);
+    drawString(*_surface, *ft, x, _bevel_width, *text_color, t);
 }
 
 }
This page took 0.021394 seconds and 4 git commands to generate.