enforce a min size
This commit is contained in:
parent
9e6b0d5a8d
commit
b8735c759a
2 changed files with 18 additions and 2 deletions
|
@ -51,7 +51,15 @@ void FocusLabel::update()
|
||||||
w = ft->measureString(_text) + sidemargin * 2;
|
w = ft->measureString(_text) + sidemargin * 2;
|
||||||
if (!_fixed_height)
|
if (!_fixed_height)
|
||||||
h = ft->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
|
||||||
|
internalResize(_rect.width(), h);
|
||||||
}
|
}
|
||||||
FocusWidget::update();
|
FocusWidget::update();
|
||||||
}
|
}
|
||||||
|
|
10
otk/label.cc
10
otk/label.cc
|
@ -47,7 +47,15 @@ void Label::update()
|
||||||
w = ft->measureString(_text) + sidemargin * 2;
|
w = ft->measureString(_text) + sidemargin * 2;
|
||||||
if (!_fixed_height)
|
if (!_fixed_height)
|
||||||
h = ft->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
|
||||||
|
internalResize(_rect.width(), h);
|
||||||
}
|
}
|
||||||
Widget::update();
|
Widget::update();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue