X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Flabel.cc;h=da9edfd179708c591b30b6fbbe2e6f4ff6ceed59;hb=0dcbf985c11c850b30b2983e1e20cd8cf033f054;hp=cc67a31611a813c4343f22246daf9b09255cca5f;hpb=06de24ec6666578759eff2b348e50f5e8e20f3bd;p=chaz%2Fopenbox diff --git a/otk/label.cc b/otk/label.cc index cc67a316..da9edfd1 100644 --- a/otk/label.cc +++ b/otk/label.cc @@ -8,34 +8,34 @@ namespace otk { -OtkLabel::OtkLabel(OtkWidget *parent) - : OtkWidget(parent), _text("") +Label::Label(Widget *parent) + : Widget(parent), _text("") { - const ScreenInfo *info = OBDisplay::screenInfo(screen()); - _xftdraw = XftDrawCreate(OBDisplay::display, window(), info->visual(), + const ScreenInfo *info = display->screenInfo(screen()); + _xftdraw = XftDrawCreate(**display, window(), info->visual(), info->colormap()); } -OtkLabel::~OtkLabel() +Label::~Label() { XftDrawDestroy(_xftdraw); } -void OtkLabel::setStyle(Style *style) +void Label::setStyle(Style *style) { - OtkWidget::setStyle(style); + Widget::setStyle(style); setTexture(style->getLabelUnfocus()); } -void OtkLabel::update(void) +void Label::update(void) { if (_dirty) { - const BFont &ft = style()->getFont(); + const Font *ft = style()->getFont(); unsigned int sidemargin = style()->getBevelWidth() * 2; - std::string t = _text; // the actual text to draw + 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 @@ -48,7 +48,7 @@ void OtkLabel::update(void) do { t.resize(text_len); - length = ft.measureString(t); + length = ft->measureString(t); } while (length > max_length && text_len-- > 0); // justify the text @@ -64,11 +64,11 @@ void OtkLabel::update(void) } } - OtkWidget::update(); + Widget::update(); - ft.drawString(_xftdraw, x, 0, *style()->getTextUnfocus(), t); + ft->drawString(_xftdraw, x, 0, *style()->getTextUnfocus(), t); } else - OtkWidget::update(); + Widget::update(); } }