]> Dogcows Code - chaz/openbox/blobdiff - src/backgroundwidget.cc
no more gloabsl
[chaz/openbox] / src / backgroundwidget.cc
index 7d715f55e336a89f9eb373a706ce1c12422cf39c..e7f7e732086f185843b4215528cae5a8322af46f 100644 (file)
@@ -10,7 +10,7 @@ namespace ob {
 
 OBBackgroundWidget::OBBackgroundWidget(otk::OtkWidget *parent,
                                        OBWidget::WidgetType type)
-  : otk::OtkFocusWidget(parent),
+  : otk::OtkWidget(parent),
     OBWidget(type)
 {
 }
@@ -21,37 +21,67 @@ OBBackgroundWidget::~OBBackgroundWidget()
 }
 
 
-void OBBackgroundWidget::setStyle(otk::Style *style)
+void OBBackgroundWidget::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 OBBackgroundWidget::setStyle(otk::Style *style)
+{
+  OtkWidget::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 OBBackgroundWidget::focus()
 {
-  otk::OtkFocusWidget::adjust();
+  otk::OtkWidget::focus();
+  setTextures();
+}
+
 
-  // XXX: adjust shit
+void OBBackgroundWidget::unfocus()
+{
+  otk::OtkWidget::unfocus();
+  setTextures();
 }
 
 
+void OBBackgroundWidget::adjust()
+{
+  // nothing to adjust here. its done in OBFrame::adjustSize
+}
+
 }
This page took 0.023685 seconds and 4 git commands to generate.