X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fbackgroundwidget.cc;h=9d660a7939c75cc7fcd8a7332f6586fcf9dba93a;hb=0348a2f3abd2334f5f5812c5fb45c1b4fffb46a5;hp=7d715f55e336a89f9eb373a706ce1c12422cf39c;hpb=70eb03ad50e1a71fd64c8cb1ebabbff311850553;p=chaz%2Fopenbox diff --git a/src/backgroundwidget.cc b/src/backgroundwidget.cc index 7d715f55..9d660a79 100644 --- a/src/backgroundwidget.cc +++ b/src/backgroundwidget.cc @@ -8,50 +8,80 @@ namespace ob { -OBBackgroundWidget::OBBackgroundWidget(otk::OtkWidget *parent, - OBWidget::WidgetType type) - : otk::OtkFocusWidget(parent), - OBWidget(type) +BackgroundWidget::BackgroundWidget(otk::Widget *parent, + WidgetBase::WidgetType type) + : otk::Widget(parent), + WidgetBase(type) { } -OBBackgroundWidget::~OBBackgroundWidget() +BackgroundWidget::~BackgroundWidget() { } -void OBBackgroundWidget::setStyle(otk::Style *style) +void BackgroundWidget::setTextures() { switch (type()) { case Type_Titlebar: - setTexture(style->getTitleFocus()); - setUnfocusTexture(style->getTitleUnfocus()); - setBorderColor(style->getBorderColor()); + if (_focused) + setTexture(_style->getTitleFocus()); + else + setTexture(_style->getTitleUnfocus()); break; case Type_Handle: - setTexture(style->getHandleFocus()); - setUnfocusTexture(style->getHandleUnfocus()); - setBorderColor(style->getBorderColor()); + if (_focused) + setTexture(_style->getHandleFocus()); + else + setTexture(_style->getHandleUnfocus()); break; case Type_Plate: - setBorderColor(&style->getFrameFocus()->color()); - setUnfocusBorderColor(&style->getFrameUnfocus()->color()); + if (_focused) + setBorderColor(&_style->getFrameFocus()->color()); + else + setBorderColor(&_style->getFrameUnfocus()->color()); break; default: assert(false); // there's no other background widgets! } +} + - otk::OtkFocusWidget::setStyle(style); +void BackgroundWidget::setStyle(otk::Style *style) +{ + Widget::setStyle(style); + setTextures(); + switch (type()) { + case Type_Titlebar: + case Type_Handle: + setBorderColor(_style->getBorderColor()); + break; + case Type_Plate: + break; + default: + assert(false); // there's no other background widgets! + } } -void OBBackgroundWidget::adjust() +void BackgroundWidget::focus() { - otk::OtkFocusWidget::adjust(); + otk::Widget::focus(); + setTextures(); +} + - // XXX: adjust shit +void BackgroundWidget::unfocus() +{ + otk::Widget::unfocus(); + setTextures(); } +void BackgroundWidget::adjust() +{ + // nothing to adjust here. its done in Frame::adjustSize +} + }