2002-12-18 02:28:44 +00:00
|
|
|
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "../config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "backgroundwidget.hh"
|
|
|
|
|
|
|
|
namespace ob {
|
|
|
|
|
|
|
|
OBBackgroundWidget::OBBackgroundWidget(otk::OtkWidget *parent,
|
|
|
|
OBWidget::WidgetType type)
|
2002-12-25 22:02:34 +00:00
|
|
|
: otk::OtkWidget(parent),
|
2002-12-18 02:28:44 +00:00
|
|
|
OBWidget(type)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
OBBackgroundWidget::~OBBackgroundWidget()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-12-25 22:02:34 +00:00
|
|
|
void OBBackgroundWidget::setTextures()
|
2002-12-18 02:28:44 +00:00
|
|
|
{
|
|
|
|
switch (type()) {
|
|
|
|
case Type_Titlebar:
|
2002-12-25 22:02:34 +00:00
|
|
|
if (_focused)
|
|
|
|
setTexture(_style->getTitleFocus());
|
|
|
|
else
|
|
|
|
setTexture(_style->getTitleUnfocus());
|
|
|
|
break;
|
|
|
|
case Type_Handle:
|
|
|
|
if (_focused)
|
|
|
|
setTexture(_style->getHandleFocus());
|
|
|
|
else
|
|
|
|
setTexture(_style->getHandleUnfocus());
|
2002-12-18 02:28:44 +00:00
|
|
|
break;
|
2002-12-25 22:02:34 +00:00
|
|
|
case Type_Plate:
|
|
|
|
if (_focused)
|
|
|
|
setBorderColor(&_style->getFrameFocus()->color());
|
|
|
|
else
|
|
|
|
setBorderColor(&_style->getFrameUnfocus()->color());
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
assert(false); // there's no other background widgets!
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OBBackgroundWidget::setStyle(otk::Style *style)
|
|
|
|
{
|
|
|
|
OtkWidget::setStyle(style);
|
|
|
|
setTextures();
|
|
|
|
switch (type()) {
|
|
|
|
case Type_Titlebar:
|
2002-12-18 02:28:44 +00:00
|
|
|
case Type_Handle:
|
2002-12-25 22:02:34 +00:00
|
|
|
setBorderColor(_style->getBorderColor());
|
2002-12-18 02:28:44 +00:00
|
|
|
break;
|
|
|
|
case Type_Plate:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
assert(false); // there's no other background widgets!
|
|
|
|
}
|
2002-12-25 22:02:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OBBackgroundWidget::focus()
|
|
|
|
{
|
|
|
|
otk::OtkWidget::focus();
|
|
|
|
setTextures();
|
|
|
|
}
|
|
|
|
|
2002-12-18 02:28:44 +00:00
|
|
|
|
2002-12-25 22:02:34 +00:00
|
|
|
void OBBackgroundWidget::unfocus()
|
|
|
|
{
|
|
|
|
otk::OtkWidget::unfocus();
|
|
|
|
setTextures();
|
2002-12-18 02:28:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OBBackgroundWidget::adjust()
|
|
|
|
{
|
2002-12-28 19:03:05 +00:00
|
|
|
// nothing to adjust here. its done in OBFrame::adjustSize
|
2002-12-18 02:28:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|