X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Ffocuswidget.cc;h=a5d2696d6036dd1caeb4c7ed1a685da33fbcba66;hb=5a139f7263e33b499836f5df9ac37400e02c32f9;hp=22a6100ba4d4db3d4717841bbcff72e9586e358d;hpb=1d897f432e54400cb2a0e1499712782b336fd728;p=chaz%2Fopenbox diff --git a/otk/focuswidget.cc b/otk/focuswidget.cc index 22a6100b..a5d2696d 100644 --- a/otk/focuswidget.cc +++ b/otk/focuswidget.cc @@ -9,48 +9,48 @@ namespace otk { OtkFocusWidget::OtkFocusWidget(OtkWidget *parent, Direction direction) - : OtkWidget(parent, direction), _unfocus_texture(0), _focused(true) + : OtkWidget(parent, direction), _unfocus_texture(0), _unfocus_bcolor(0) { - _focus_texture = parent->getTexture(); + _focused = true; + _focus_texture = parent->texture(); + _focus_bcolor = parent->borderColor(); } OtkFocusWidget::~OtkFocusWidget() { } +#include void OtkFocusWidget::focus(void) { - if (_focused) + if (!isVisible() || _focused) return; - // XXX: what about OtkWidget::focus() + printf("FOCUS\n"); + OtkWidget::focus(); + + if (_focus_bcolor) + OtkWidget::setBorderColor(_focus_bcolor); - assert(_focus_texture); OtkWidget::setTexture(_focus_texture); OtkWidget::update(); - - OtkWidget::OtkWidgetList children = OtkWidget::getChildren(); - - OtkWidget::OtkWidgetList::iterator it = children.begin(), - end = children.end(); - - OtkFocusWidget *tmp = 0; - for (; it != end; ++it) { - tmp = dynamic_cast(*it); - if (tmp) tmp->focus(); - } } void OtkFocusWidget::unfocus(void) { - if (! _focused) + if (!isVisible() || !_focused) return; - assert(_unfocus_texture); + printf("UNFOCUS\n"); + OtkWidget::unfocus(); + + if (_unfocus_bcolor) + OtkWidget::setBorderColor(_unfocus_bcolor); + OtkWidget::setTexture(_unfocus_texture); OtkWidget::update(); - OtkWidget::OtkWidgetList children = OtkWidget::getChildren(); + OtkWidget::OtkWidgetList children = OtkWidget::children(); OtkWidget::OtkWidgetList::iterator it = children.begin(), end = children.end(); @@ -68,4 +68,10 @@ void OtkFocusWidget::setTexture(BTexture *texture) _focus_texture = texture; } +void OtkFocusWidget::setBorderColor(const BColor *color) +{ + OtkWidget::setBorderColor(color); + _focus_bcolor = color; +} + }