1 #include "focuswidget.hh"
5 OtkFocusWidget::OtkFocusWidget(OtkWidget *parent, Direction direction)
6 : OtkWidget(parent, direction), _unfocus_texture(0), _focused(true)
8 _focus_texture = parent->getTexture();
11 OtkFocusWidget::~OtkFocusWidget()
15 void OtkFocusWidget::focus(void)
20 // XXX: what about OtkWidget::focus()
22 assert(_focus_texture);
23 OtkWidget::setTexture(_focus_texture);
26 OtkWidget::OtkWidgetList children = OtkWidget::getChildren();
28 OtkWidget::OtkWidgetList::iterator it = children.begin(),
31 OtkFocusWidget *tmp = 0;
32 for (; it != end; ++it) {
33 tmp = dynamic_cast<OtkFocusWidget*>(*it);
34 if (tmp) tmp->focus();
38 void OtkFocusWidget::unfocus(void)
43 assert(_unfocus_texture);
44 OtkWidget::setTexture(_unfocus_texture);
47 OtkWidget::OtkWidgetList children = OtkWidget::getChildren();
49 OtkWidget::OtkWidgetList::iterator it = children.begin(),
52 OtkFocusWidget *tmp = 0;
53 for (; it != end; ++it) {
54 tmp = dynamic_cast<OtkFocusWidget*>(*it);
55 if (tmp) tmp->unfocus();
59 void OtkFocusWidget::setTexture(BTexture *texture)
61 OtkWidget::setTexture(texture);
62 _focus_texture = texture;