f0d95841ee
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27811 a95241bf-73f2-0310-859d-f6bbb57e9c96
94 lines
1.2 KiB
C++
94 lines
1.2 KiB
C++
/*
|
|
* Copyright 2000-2008, François Revol, <revol@free.fr>. All rights reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
|
|
#include "ThemeItem.h"
|
|
#include <View.h>
|
|
#include <Font.h>
|
|
#include <stdio.h>
|
|
|
|
|
|
// #pragma mark -
|
|
|
|
|
|
ThemeItem::ThemeItem(int32 id, const char *name, bool ro)
|
|
: BStringItem(name)
|
|
{
|
|
fCurrent = false;
|
|
fId = id;
|
|
fRo = ro;
|
|
}
|
|
|
|
|
|
ThemeItem::~ThemeItem()
|
|
{
|
|
}
|
|
|
|
|
|
void
|
|
ThemeItem::DrawItem(BView *owner, BRect frame, bool complete)
|
|
{
|
|
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();
|
|
}
|
|
|
|
|
|
int32
|
|
ThemeItem::ThemeId()
|
|
{
|
|
return fId;
|
|
}
|
|
|
|
|
|
bool
|
|
ThemeItem::IsCurrent()
|
|
{
|
|
return fCurrent;
|
|
}
|
|
|
|
|
|
void
|
|
ThemeItem::SetCurrent(bool set)
|
|
{
|
|
fCurrent = set;
|
|
}
|
|
|
|
|
|
bool
|
|
ThemeItem::IsReadOnly()
|
|
{
|
|
return fRo;
|
|
}
|
|
|
|
|
|
void
|
|
ThemeItem::SetReadOnly(bool set)
|
|
{
|
|
fRo = set;
|
|
}
|
|
|