2002-11-17 09:41:58 +00:00
|
|
|
// -*- 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)
|
2002-12-18 02:28:44 +00:00
|
|
|
: OtkWidget(parent, direction), _unfocus_texture(0), _unfocus_bcolor(0)
|
2002-11-13 10:19:28 +00:00
|
|
|
{
|
2002-12-18 02:28:44 +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
|
|
|
}
|
|
|
|
|
2002-11-16 02:15:49 +00:00
|
|
|
OtkFocusWidget::~OtkFocusWidget()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-12-18 02:28:44 +00:00
|
|
|
#include <stdio.h>
|
2002-11-13 10:19:28 +00:00
|
|
|
void OtkFocusWidget::focus(void)
|
|
|
|
{
|
2002-12-25 22:02:34 +00:00
|
|
|
if (_focused)
|
2002-11-13 10:19:28 +00:00
|
|
|
return;
|
|
|
|
|
2002-12-18 02:28:44 +00:00
|
|
|
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);
|
2002-12-25 22:02:34 +00:00
|
|
|
update();
|
2002-11-13 10:19:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OtkFocusWidget::unfocus(void)
|
|
|
|
{
|
2002-12-25 22:02:34 +00:00
|
|
|
if (!_focused)
|
2002-11-13 10:19:28 +00:00
|
|
|
return;
|
|
|
|
|
2002-12-18 02:28:44 +00:00
|
|
|
OtkWidget::unfocus();
|
|
|
|
|
|
|
|
if (_unfocus_bcolor)
|
|
|
|
OtkWidget::setBorderColor(_unfocus_bcolor);
|
|
|
|
|
2002-11-13 10:19:28 +00:00
|
|
|
OtkWidget::setTexture(_unfocus_texture);
|
2002-12-25 22:02:34 +00:00
|
|
|
update();
|
2002-11-13 10:19:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void OtkFocusWidget::setTexture(BTexture *texture)
|
|
|
|
{
|
|
|
|
OtkWidget::setTexture(texture);
|
|
|
|
_focus_texture = texture;
|
|
|
|
}
|
|
|
|
|
2002-12-18 02:28:44 +00:00
|
|
|
void OtkFocusWidget::setBorderColor(const BColor *color)
|
|
|
|
{
|
|
|
|
OtkWidget::setBorderColor(color);
|
|
|
|
_focus_bcolor = color;
|
|
|
|
}
|
|
|
|
|
2002-11-13 10:19:28 +00:00
|
|
|
}
|