- const Font *ft = style()->getFont();
- unsigned int sidemargin = style()->getBevelWidth() * 2;
-
- ustring t = _text; // the actual text to draw
- int x = sidemargin; // x coord for the text
-
- // find a string that will fit inside the area for text
- int max_length = width() - sidemargin * 2;
- if (max_length <= 0) {
- t = ""; // can't fit anything
- } else {
- size_t text_len = t.size();
- int length;
+ int w = _rect.width(), h = _rect.height();
+ const Font *ft = style()->labelFont();
+ unsigned int sidemargin = style()->bevelWidth() * 2;
+ if (!_fixed_width)
+ w = ft->measureString(_text) + sidemargin * 2;
+ if (!_fixed_height)
+ h = ft->height();
+ internalResize(w, h);
+ }
+ Widget::update();
+}
+
+
+void Label::renderForeground(void)
+{
+ Widget::renderForeground();
+
+ const Font *ft = style()->labelFont();
+ unsigned int sidemargin = style()->bevelWidth() * 2;
+
+ ustring t = _text; // the actual text to draw
+ int x = sidemargin; // x coord for the text
+
+ // find a string that will fit inside the area for text
+ int max_length = width() - sidemargin * 2;
+ if (max_length <= 0) {
+ t = ""; // can't fit anything
+ } else {
+ size_t text_len = t.size();
+ int length;