diff options
| author | Dana Jansens <danakj@orodu.net> | 2002-12-27 10:07:57 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2002-12-27 10:07:57 +0000 |
| commit | 5fdd493d0d2255f134114e69f028371366f4dfd3 (patch) | |
| tree | 661a83f7b9369d95d29ed2bb88e4ce6d621a36d0 /src/labelwidget.cc | |
| parent | 8bae1352cb401b71575106051a35a9535db1a7cd (diff) | |
buttons have their pixmaps!
Diffstat (limited to 'src/labelwidget.cc')
| -rw-r--r-- | src/labelwidget.cc | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/src/labelwidget.cc b/src/labelwidget.cc index 5a33cf3d..491deadc 100644 --- a/src/labelwidget.cc +++ b/src/labelwidget.cc @@ -72,41 +72,38 @@ void OBLabelWidget::unfocus() void OBLabelWidget::update() { - if (_dirty) { - std::string t = _text; - 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; + OtkWidget::update(); + + std::string t = _text; + 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; - do { - t.resize(text_len); - length = _font->measureString(t); - } while (length > max_length && text_len-- > 0); - - // justify the text - switch (_justify) { - case otk::Style::RightJustify: - x += max_length - length; - break; - case otk::Style::CenterJustify: - x += (max_length - length) / 2; - break; - case otk::Style::LeftJustify: - break; - } + do { + t.resize(text_len); + length = _font->measureString(t); + } while (length > max_length && text_len-- > 0); + + // justify the text + switch (_justify) { + case otk::Style::RightJustify: + x += max_length - length; + break; + case otk::Style::CenterJustify: + x += (max_length - length) / 2; + break; + case otk::Style::LeftJustify: + break; } + } - OtkWidget::update(); - - _font->drawString(_xftdraw, x, 0, *_text_color, t); - } else - OtkWidget::update(); + _font->drawString(_xftdraw, x, 0, *_text_color, t); } |
