]> Dogcows Code - chaz/openbox/blobdiff - src/backgroundwidget.cc
update children first
[chaz/openbox] / src / backgroundwidget.cc
index 7d715f55e336a89f9eb373a706ce1c12422cf39c..4d1a51d0644053f645a2bb5dbcd96cb45f66fcf3 100644 (file)
@@ -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
+}
+
 }
This page took 0.022786 seconds and 4 git commands to generate.