namespace ob {
-OBLabelWidget::OBLabelWidget(otk::OtkWidget *parent, OBWidget::WidgetType type)
- : otk::OtkWidget(parent),
- OBWidget(type)
+LabelWidget::LabelWidget(otk::Widget *parent, WidgetBase::WidgetType type)
+ : otk::Widget(parent),
+ WidgetBase(type)
{
- const otk::ScreenInfo *info = otk::OBDisplay::screenInfo(_screen);
- _xftdraw = XftDrawCreate(otk::OBDisplay::display, _window, info->visual(),
+ const otk::ScreenInfo *info = otk::Display::screenInfo(_screen);
+ _xftdraw = XftDrawCreate(otk::Display::display, _window, info->visual(),
info->colormap());
}
-OBLabelWidget::~OBLabelWidget()
+LabelWidget::~LabelWidget()
{
XftDrawDestroy(_xftdraw);
}
-void OBLabelWidget::setText(const std::string &text)
+void LabelWidget::setText(const std::string &text)
{
_text = text;
_dirty = true;
}
-void OBLabelWidget::setTextures()
+void LabelWidget::setTextures()
{
if (_focused) {
setTexture(_style->getLabelFocus());
}
-void OBLabelWidget::setStyle(otk::Style *style)
+void LabelWidget::setStyle(otk::Style *style)
{
- OtkWidget::setStyle(style);
+ otk::Widget::setStyle(style);
setTextures();
_font = style->getFont();
assert(_font);
}
-void OBLabelWidget::focus()
+void LabelWidget::focus()
{
- otk::OtkWidget::focus();
+ otk::Widget::focus();
setTextures();
}
-void OBLabelWidget::unfocus()
+void LabelWidget::unfocus()
{
- otk::OtkWidget::unfocus();
+ otk::Widget::unfocus();
setTextures();
}
-void OBLabelWidget::update()
+void LabelWidget::update()
{
- if (_dirty) {
+ bool draw = _dirty;
+
+ otk::Widget::update();
+
+ if (draw) {
std::string t = _text;
int x = _sidemargin; // x coord for the text
}
}
- OtkWidget::update();
-
_font->drawString(_xftdraw, x, 0, *_text_color, t);
- } else
- OtkWidget::update();
+ }
}
-void OBLabelWidget::adjust()
+void LabelWidget::adjust()
{
- // XXX: adjust shit
+ // nothing to adjust. no children.
}
}