summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-02-04 15:07:39 +0000
committerDana Jansens <danakj@orodu.net>2003-02-04 15:07:39 +0000
commitb8735c759a0a638a1169089c310baf9de6414597 (patch)
treea0d84ec0e5c11751425f04b411035ae0704c807a
parent9e6b0d5a8d0226232802bdece77665b167f98dae (diff)
enforce a min size
-rw-r--r--otk/focuslabel.cc10
-rw-r--r--otk/label.cc10
2 files changed, 18 insertions, 2 deletions
diff --git a/otk/focuslabel.cc b/otk/focuslabel.cc
index 6d7d5c31..8ac328e7 100644
--- a/otk/focuslabel.cc
+++ b/otk/focuslabel.cc
@@ -51,7 +51,15 @@ void FocusLabel::update()
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
+ internalResize(_rect.width(), h);
}
FocusWidget::update();
}
diff --git a/otk/label.cc b/otk/label.cc
index fa5fefff..8352fb7a 100644
--- a/otk/label.cc
+++ b/otk/label.cc
@@ -47,7 +47,15 @@ void Label::update()
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
+ internalResize(_rect.width(), h);
}
Widget::update();
}