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 // XXX: what about OtkWidget::focus()
25 assert(_focus_texture);
26 OtkWidget::setTexture(_focus_texture);
29 OtkWidget::OtkWidgetList children = OtkWidget::getChildren();
31 OtkWidget::OtkWidgetList::iterator it = children.begin(),
34 OtkFocusWidget *tmp = 0;
35 for (; it != end; ++it) {
36 tmp = dynamic_cast<OtkFocusWidget*>(*it);
37 if (tmp) tmp->focus();
41 void OtkFocusWidget::unfocus(void)
46 assert(_unfocus_texture);
47 OtkWidget::setTexture(_unfocus_texture);
50 OtkWidget::OtkWidgetList children = OtkWidget::getChildren();
52 OtkWidget::OtkWidgetList::iterator it = children.begin(),
55 OtkFocusWidget *tmp = 0;
56 for (; it != end; ++it) {
57 tmp = dynamic_cast<OtkFocusWidget*>(*it);
58 if (tmp) tmp->unfocus();
62 void OtkFocusWidget::setTexture(BTexture *texture)
64 OtkWidget::setTexture(texture);
65 _focus_texture = texture;