]> Dogcows Code - chaz/openbox/blobdiff - otk/focuswidget.cc
add the swig generated files
[chaz/openbox] / otk / focuswidget.cc
index e956561e2224fc94a78eb38f5754e23b86dbfe78..a5d2696d6036dd1caeb4c7ed1a685da33fbcba66 100644 (file)
@@ -9,44 +9,52 @@
 namespace otk {
 
 OtkFocusWidget::OtkFocusWidget(OtkWidget *parent, Direction direction)
-  : OtkWidget(parent, direction), _unfocus_texture(0), _focused(true)
+  : OtkWidget(parent, direction), _unfocus_texture(0), _unfocus_bcolor(0)
 {
-  _focus_texture = parent->getTexture();
+  _focused = true;
+  _focus_texture = parent->texture();
+  _focus_bcolor = parent->borderColor();
 }
 
 OtkFocusWidget::~OtkFocusWidget()
 {
 }
 
+#include <stdio.h>
 void OtkFocusWidget::focus(void)
 {
-  if (_focused)
+  if (!isVisible() || _focused)
     return;
 
-  // XXX: what about OtkWidget::focus()
+  printf("FOCUS\n");
+  OtkWidget::focus();
+
+  if (_focus_bcolor)
+    OtkWidget::setBorderColor(_focus_bcolor);
 
-  assert(_focus_texture);
   OtkWidget::setTexture(_focus_texture);
   OtkWidget::update();
-
-  OtkBaseWidgetList::iterator it = _children.begin(), end = _children.end();
-  OtkFocusWidget *tmp = 0;
-  for (; it != end; ++it) {
-    tmp = dynamic_cast<OtkFocusWidget*>(*it);
-    if (tmp) tmp->focus();
-  }
 }
 
 void OtkFocusWidget::unfocus(void)
 {
-  if (! _focused)
+  if (!isVisible() || !_focused)
     return;
 
-  assert(_unfocus_texture);
+  printf("UNFOCUS\n");
+  OtkWidget::unfocus();
+
+  if (_unfocus_bcolor)
+    OtkWidget::setBorderColor(_unfocus_bcolor);
+
   OtkWidget::setTexture(_unfocus_texture);
   OtkWidget::update();
 
-  OtkBaseWidgetList::iterator it = _children.begin(), end = _children.end();
+  OtkWidget::OtkWidgetList children = OtkWidget::children();
+
+  OtkWidget::OtkWidgetList::iterator it = children.begin(),
+    end = children.end();
+
   OtkFocusWidget *tmp = 0;
   for (; it != end; ++it) {
     tmp = dynamic_cast<OtkFocusWidget*>(*it);
@@ -60,4 +68,10 @@ void OtkFocusWidget::setTexture(BTexture *texture)
   _focus_texture = texture;
 }
 
+void OtkFocusWidget::setBorderColor(const BColor *color)
+{
+  OtkWidget::setBorderColor(color);
+  _focus_bcolor = color;
+}
+
 }
This page took 0.023328 seconds and 4 git commands to generate.