diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-01-20 06:11:12 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-01-20 06:11:12 +0000 |
| commit | d8d9b42777ace234f3471918e1210062578f8188 (patch) | |
| tree | 915e9aa986ba44dda4c357bc834c68b4dc550525 /otk/label.cc | |
| parent | 0ba441fe8f379ec506000f7fa29f867cb6bc0d51 (diff) | |
widegt using new render system
Diffstat (limited to 'otk/label.cc')
| -rw-r--r-- | otk/label.cc | 66 |
1 files changed, 31 insertions, 35 deletions
diff --git a/otk/label.cc b/otk/label.cc index 2d8b9442..8c429dba 100644 --- a/otk/label.cc +++ b/otk/label.cc @@ -21,51 +21,47 @@ void Label::setStyle(Style *style) { Widget::setStyle(style); - setTexture(style->getLabelUnfocus()); + // XXX: do this again + //setTexture(style->getLabelUnfocus()); } -void Label::update(void) +void Label::renderForeground(void) { - if (_dirty) { - const Font *ft = style()->getFont(); - unsigned int sidemargin = style()->getBevelWidth() * 2; + 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 + 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; + // 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 = ft->measureString(t); - } while (length > max_length && text_len-- > 0); + do { + t.resize(text_len); + length = ft->measureString(t); + } while (length > max_length && text_len-- > 0); - // justify the text - switch (style()->textJustify()) { - case Style::RightJustify: - x += max_length - length; - break; - case Style::CenterJustify: - x += (max_length - length) / 2; - break; - case Style::LeftJustify: - break; - } + // justify the text + switch (style()->textJustify()) { + case Style::RightJustify: + x += max_length - length; + break; + case Style::CenterJustify: + x += (max_length - length) / 2; + break; + case Style::LeftJustify: + break; } + } - Widget::update(); - - display->renderControl(_screen)-> - drawString(this, *ft, x, 0, *style()->getTextUnfocus(), t); - } else - Widget::update(); + display->renderControl(_screen)-> + drawString(_surface, *ft, x, 0, *style()->getTextUnfocus(), t); } } |
