X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fbackgroundwidget.cc;h=4d1a51d0644053f645a2bb5dbcd96cb45f66fcf3;hb=747c089ae1c7df345c7ad98f833e8640ab0bc851;hp=7d715f55e336a89f9eb373a706ce1c12422cf39c;hpb=70eb03ad50e1a71fd64c8cb1ebabbff311850553;p=chaz%2Fopenbox diff --git a/src/backgroundwidget.cc b/src/backgroundwidget.cc index 7d715f55..4d1a51d0 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->titlebarFocusBackground()); + else + setTexture(_style->titlebarUnfocusBackground()); break; case Type_Handle: - setTexture(style->getHandleFocus()); - setUnfocusTexture(style->getHandleUnfocus()); - setBorderColor(style->getBorderColor()); + if (_focused) + setTexture(_style->handleFocusBackground()); + else + setTexture(_style->handleUnfocusBackground()); break; case Type_Plate: - setBorderColor(&style->getFrameFocus()->color()); - setUnfocusBorderColor(&style->getFrameUnfocus()->color()); + if (_focused) + setBorderColor(_style->clientBorderFocusColor()); + else + setBorderColor(_style->clientBorderUnfocusColor()); break; default: assert(false); // there's no other background widgets! } +} + - otk::OtkFocusWidget::setStyle(style); +void BackgroundWidget::setStyle(otk::RenderStyle *style) +{ + Widget::setStyle(style); + setTextures(); + switch (type()) { + case Type_Titlebar: + case Type_Handle: + setBorderColor(_style->frameBorderColor()); + 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 +} + }