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(OtkApplication *app, Direction direction,
12 Cursor cursor, int bevel_width)
13 : OtkWidget(app, direction, cursor, bevel_width),
14 _unfocus_texture(0), _focused(true)
18 OtkFocusWidget::OtkFocusWidget(Style *style, Direction direction,
19 Cursor cursor, int bevel_width)
20 : OtkWidget(style, direction, cursor, bevel_width),
21 _unfocus_texture(0), _focused(true)
25 OtkFocusWidget::~OtkFocusWidget()
29 void OtkFocusWidget::focus(void)
34 // XXX: what about OtkWidget::focus()
36 assert(_focus_texture);
37 OtkWidget::setTexture(_focus_texture);
40 OtkWidget::OtkWidgetList children = OtkWidget::getChildren();
42 OtkWidget::OtkWidgetList::iterator it = children.begin(),
45 OtkFocusWidget *tmp = 0;
46 for (; it != end; ++it) {
47 tmp = dynamic_cast<OtkFocusWidget*>(*it);
48 if (tmp) tmp->focus();
52 void OtkFocusWidget::unfocus(void)
57 assert(_unfocus_texture);
58 OtkWidget::setTexture(_unfocus_texture);
61 OtkWidget::OtkWidgetList children = OtkWidget::getChildren();
63 OtkWidget::OtkWidgetList::iterator it = children.begin(),
66 OtkFocusWidget *tmp = 0;
67 for (; it != end; ++it) {
68 tmp = dynamic_cast<OtkFocusWidget*>(*it);
69 if (tmp) tmp->unfocus();
73 void OtkFocusWidget::setTexture(BTexture *texture)
75 OtkWidget::setTexture(texture);
76 _focus_texture = texture;