openbox/otk/focuswidget.cc

65 lines
1.1 KiB
C++
Raw Normal View History

// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifdef HAVE_CONFIG_H
# include "../config.h"
#endif
2002-11-13 10:19:28 +00:00
#include "focuswidget.hh"
namespace otk {
OtkFocusWidget::OtkFocusWidget(OtkWidget *parent, Direction direction)
: OtkWidget(parent, direction), _unfocus_texture(0), _unfocus_bcolor(0)
2002-11-13 10:19:28 +00:00
{
_focused = true;
2002-12-20 15:26:34 +00:00
_focus_texture = parent->texture();
_focus_bcolor = parent->borderColor();
2002-11-13 10:19:28 +00:00
}
OtkFocusWidget::~OtkFocusWidget()
{
}
#include <stdio.h>
2002-11-13 10:19:28 +00:00
void OtkFocusWidget::focus(void)
{
if (_focused)
2002-11-13 10:19:28 +00:00
return;
OtkWidget::focus();
if (_focus_bcolor)
OtkWidget::setBorderColor(_focus_bcolor);
2002-11-14 11:43:39 +00:00
2002-11-13 10:19:28 +00:00
OtkWidget::setTexture(_focus_texture);
update();
2002-11-13 10:19:28 +00:00
}
void OtkFocusWidget::unfocus(void)
{
if (!_focused)
2002-11-13 10:19:28 +00:00
return;
OtkWidget::unfocus();
if (_unfocus_bcolor)
OtkWidget::setBorderColor(_unfocus_bcolor);
2002-11-13 10:19:28 +00:00
OtkWidget::setTexture(_unfocus_texture);
update();
2002-11-13 10:19:28 +00:00
}
void OtkFocusWidget::setTexture(BTexture *texture)
{
OtkWidget::setTexture(texture);
_focus_texture = texture;
}
void OtkFocusWidget::setBorderColor(const BColor *color)
{
OtkWidget::setBorderColor(color);
_focus_bcolor = color;
}
2002-11-13 10:19:28 +00:00
}