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 OtkBaseWidgetList::iterator it = _children.begin(), end = _children.end();
33 OtkFocusWidget *tmp = 0;
34 for (; it != end; ++it) {
35 tmp = dynamic_cast<OtkFocusWidget*>(*it);
36 if (tmp) tmp->focus();
40 void OtkFocusWidget::unfocus(void)
45 assert(_unfocus_texture);
46 OtkWidget::setTexture(_unfocus_texture);
49 OtkBaseWidgetList::iterator it = _children.begin(), end = _children.end();
50 OtkFocusWidget *tmp = 0;
51 for (; it != end; ++it) {
52 tmp = dynamic_cast<OtkFocusWidget*>(*it);
53 if (tmp) tmp->unfocus();
57 void OtkFocusWidget::setTexture(BTexture *texture)
59 OtkWidget::setTexture(texture);
60 _focus_texture = texture;