1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
4 # include "../config.h"
7 #include "focuswidget.hh"
11 OtkFocusWidget::OtkFocusWidget(OtkWidget *parent, Direction direction)
12 : OtkWidget(parent, direction), _unfocus_texture(0), _focused(true)
14 _focus_texture = parent->getTexture();
17 OtkFocusWidget::~OtkFocusWidget()
21 void OtkFocusWidget::focus(void)
26 // XXX: what about OtkWidget::focus()
28 assert(_focus_texture);
29 OtkWidget::setTexture(_focus_texture);
32 OtkWidget::OtkWidgetList children = OtkWidget::getChildren();
34 OtkWidget::OtkWidgetList::iterator it = children.begin(),
37 OtkFocusWidget *tmp = 0;
38 for (; it != end; ++it) {
39 tmp = dynamic_cast<OtkFocusWidget*>(*it);
40 if (tmp) tmp->focus();
44 void OtkFocusWidget::unfocus(void)
49 assert(_unfocus_texture);
50 OtkWidget::setTexture(_unfocus_texture);
53 OtkWidget::OtkWidgetList children = OtkWidget::getChildren();
55 OtkWidget::OtkWidgetList::iterator it = children.begin(),
58 OtkFocusWidget *tmp = 0;
59 for (; it != end; ++it) {
60 tmp = dynamic_cast<OtkFocusWidget*>(*it);
61 if (tmp) tmp->unfocus();
65 void OtkFocusWidget::setTexture(BTexture *texture)
67 OtkWidget::setTexture(texture);
68 _focus_texture = texture;