2008-01-11 21:06:15 +03:00
|
|
|
#include "ThemeItem.h"
|
|
|
|
#include <View.h>
|
|
|
|
#include <Font.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2008-10-01 07:37:33 +04:00
|
|
|
|
|
|
|
// #pragma mark -
|
|
|
|
|
|
|
|
|
2008-01-11 21:06:15 +03:00
|
|
|
ThemeItem::ThemeItem(int32 id, const char *name, bool ro)
|
|
|
|
: BStringItem(name)
|
|
|
|
{
|
|
|
|
fCurrent = false;
|
|
|
|
fId = id;
|
|
|
|
fRo = ro;
|
|
|
|
}
|
|
|
|
|
2008-10-01 07:37:33 +04:00
|
|
|
|
2008-01-11 21:06:15 +03:00
|
|
|
ThemeItem::~ThemeItem()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-10-01 07:37:33 +04:00
|
|
|
|
|
|
|
void
|
|
|
|
ThemeItem::DrawItem(BView *owner, BRect frame, bool complete)
|
2008-01-11 21:06:15 +03:00
|
|
|
{
|
|
|
|
rgb_color col;
|
|
|
|
if (fCurrent || fRo)
|
|
|
|
owner->PushState();
|
|
|
|
if (fCurrent) {
|
|
|
|
BFont f;
|
|
|
|
owner->GetFont(&f);
|
|
|
|
f.SetFace(B_BOLD_FACE);
|
|
|
|
owner->SetFont(&f);
|
|
|
|
}
|
|
|
|
if (fRo) {
|
|
|
|
col = owner->LowColor();
|
|
|
|
if (col.red < 220)
|
|
|
|
col.red += 15;
|
|
|
|
else {
|
|
|
|
if (col.green > 20)
|
|
|
|
col.green -= 10;
|
|
|
|
if (col.blue > 20)
|
|
|
|
col.blue -= 10;
|
|
|
|
}
|
|
|
|
owner->SetLowColor(col);
|
|
|
|
owner->FillRect(frame, B_SOLID_LOW);
|
|
|
|
}
|
|
|
|
BStringItem::DrawItem(owner, frame, complete);
|
|
|
|
if (fCurrent || fRo)
|
|
|
|
owner->PopState();
|
|
|
|
}
|
|
|
|
|
2008-10-01 07:37:33 +04:00
|
|
|
|
|
|
|
int32
|
|
|
|
ThemeItem::ThemeId()
|
2008-01-11 21:06:15 +03:00
|
|
|
{
|
|
|
|
return fId;
|
|
|
|
}
|
|
|
|
|
2008-10-01 07:37:33 +04:00
|
|
|
|
|
|
|
bool
|
|
|
|
ThemeItem::IsCurrent()
|
2008-01-11 21:06:15 +03:00
|
|
|
{
|
|
|
|
return fCurrent;
|
|
|
|
}
|
|
|
|
|
2008-10-01 07:37:33 +04:00
|
|
|
|
|
|
|
void
|
|
|
|
ThemeItem::SetCurrent(bool set)
|
2008-01-11 21:06:15 +03:00
|
|
|
{
|
|
|
|
fCurrent = set;
|
|
|
|
}
|
|
|
|
|
2008-10-01 07:37:33 +04:00
|
|
|
|
|
|
|
bool
|
|
|
|
ThemeItem::IsReadOnly()
|
2008-01-11 21:06:15 +03:00
|
|
|
{
|
|
|
|
return fRo;
|
|
|
|
}
|
|
|
|
|
2008-10-01 07:37:33 +04:00
|
|
|
|
|
|
|
void
|
|
|
|
ThemeItem::SetReadOnly(bool set)
|
2008-01-11 21:06:15 +03:00
|
|
|
{
|
|
|
|
fRo = set;
|
|
|
|
}
|
|
|
|
|