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(Style *style, Direction direction,
12 Cursor cursor, int bevel_width)
13 : OtkWidget(style, direction, cursor, bevel_width),
14 _unfocus_texture(0), _focused(true)
18 void OtkFocusWidget::focus(void)
23 assert(_focus_texture);
24 OtkWidget::setTexture(_focus_texture);
27 OtkWidget::OtkWidgetList children = OtkWidget::getChildren();
29 OtkWidget::OtkWidgetList::iterator it = children.begin(),
32 OtkFocusWidget *tmp = 0;
33 for (; it != end; ++it) {
34 tmp = dynamic_cast<OtkFocusWidget*>(*it);
35 if (tmp) tmp->focus();
39 void OtkFocusWidget::unfocus(void)
44 assert(_unfocus_texture);
45 OtkWidget::setTexture(_unfocus_texture);
48 OtkWidget::OtkWidgetList children = OtkWidget::getChildren();
50 OtkWidget::OtkWidgetList::iterator it = children.begin(),
53 OtkFocusWidget *tmp = 0;
54 for (; it != end; ++it) {
55 tmp = dynamic_cast<OtkFocusWidget*>(*it);
56 if (tmp) tmp->unfocus();
60 void OtkFocusWidget::setTexture(BTexture *texture)
62 OtkWidget::setTexture(texture);
63 _focus_texture = texture;