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/focuslabel.cc | |
| parent | 0ba441fe8f379ec506000f7fa29f867cb6bc0d51 (diff) | |
widegt using new render system
Diffstat (limited to 'otk/focuslabel.cc')
| -rw-r--r-- | otk/focuslabel.cc | 74 |
1 files changed, 35 insertions, 39 deletions
diff --git a/otk/focuslabel.cc b/otk/focuslabel.cc index eed535c3..79d68b09 100644 --- a/otk/focuslabel.cc +++ b/otk/focuslabel.cc @@ -23,55 +23,51 @@ FocusLabel::~FocusLabel() void FocusLabel::setStyle(Style *style) { FocusWidget::setStyle(style); - - setTexture(style->getLabelFocus()); - setUnfocusTexture(style->getLabelUnfocus()); + + // XXX: do this again + //setTexture(style->getLabelFocus()); + //setUnfocusTexture(style->getLabelUnfocus()); } -void FocusLabel::update(void) +void FocusLabel::renderForeground(void) { - if (_dirty) { - const Font *ft = style()->getFont(); - Color *text_color = (isFocused() ? style()->getTextFocus() - : style()->getTextUnfocus()); - unsigned int sidemargin = style()->getBevelWidth() * 2; + const Font *ft = style()->getFont(); + Color *text_color = (isFocused() ? style()->getTextFocus() + : style()->getTextUnfocus()); + 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; } + } - FocusWidget::update(); - - display->renderControl(_screen)-> - drawString(this, *ft, x, 0, *text_color, t); - } else - FocusWidget::update(); + display->renderControl(_screen)-> + drawString(_surface, *ft, x, 0, *text_color, t); } } |
