Fixed the drawing functions
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1337 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -188,62 +188,51 @@ void BTab::DrawLabel(BView *owner, BRect frame)
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void BTab::DrawTab(BView *owner, BRect frame, tab_position position, bool full)
|
void BTab::DrawTab(BView *owner, BRect frame, tab_position position, bool full)
|
||||||
{
|
{
|
||||||
// TODO: write a decent DrawTab method, this one is from the Be Book
|
rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||||
|
lightenmax = tint_color(no_tint, B_LIGHTEN_MAX_TINT),
|
||||||
// Save the original colors
|
darken2 = tint_color(no_tint, B_DARKEN_2_TINT),
|
||||||
rgb_color hi = owner->HighColor();
|
darkenmax = tint_color(no_tint, B_DARKEN_MAX_TINT);
|
||||||
rgb_color lo = owner->LowColor();
|
|
||||||
|
|
||||||
rgb_color kGray = ui_color(B_PANEL_BACKGROUND_COLOR),
|
owner->SetHighColor(darkenmax);
|
||||||
kBlack = tint_color(kGray, B_DARKEN_MAX_TINT),
|
owner->SetLowColor(no_tint);
|
||||||
kDarkGray = tint_color(kGray, B_DARKEN_4_TINT),
|
DrawLabel(owner, frame);
|
||||||
kMedGray = tint_color(kGray, B_DARKEN_2_TINT),
|
|
||||||
kWhite = tint_color(kGray, B_LIGHTEN_MAX_TINT);
|
|
||||||
|
|
||||||
// Draw the label by calling DrawLabel()
|
owner->BeginLineArray(12);
|
||||||
owner->SetHighColor(kBlack);
|
|
||||||
owner->SetLowColor(kGray);
|
|
||||||
DrawLabel(owner, frame);
|
|
||||||
|
|
||||||
// Start a line array to draw the tab --
|
if (position != B_TAB_ANY)
|
||||||
// this is faster than drawing the lines
|
{
|
||||||
// one by one.
|
owner->AddLine(BPoint(frame.left - 3.0f, frame.bottom),
|
||||||
owner->BeginLineArray(7);
|
BPoint(frame.left - 2.0f, frame.bottom - 1.0f), lightenmax);
|
||||||
|
owner->AddLine(BPoint(frame.left - 1.0f, frame.bottom - 2.0f),
|
||||||
|
BPoint(frame.left - 1.0f, frame.bottom - 3.0f), lightenmax);
|
||||||
|
}
|
||||||
|
|
||||||
// Do the bottom left corner, visible
|
owner->AddLine(BPoint(frame.left, frame.bottom - 4.0f),
|
||||||
// only on the frontmost tab.
|
BPoint(frame.left, frame.top + 4.0f), lightenmax);
|
||||||
if (position != B_TAB_ANY) {
|
owner->AddLine(BPoint(frame.left + 1.0f, frame.top + 3.0f),
|
||||||
owner->AddLine(BPoint(frame.left, frame.bottom),
|
BPoint(frame.left + 1.0f, frame.top + 2.0f), lightenmax);
|
||||||
BPoint(frame.left+3, frame.bottom-3), kWhite);
|
owner->AddLine(BPoint(frame.left + 2.0f, frame.top + 1.0f),
|
||||||
}
|
BPoint(frame.left + 3.0f, frame.top + 1.0f), lightenmax);
|
||||||
|
owner->AddLine(BPoint(frame.left + 4.0f, frame.top),
|
||||||
|
BPoint(frame.right - 5.0f, frame.top), lightenmax);
|
||||||
|
|
||||||
// Left wall -- always drawn
|
owner->AddLine(BPoint(frame.right - 4.0f, frame.top + 1.0f),
|
||||||
owner->AddLine(BPoint(frame.left+4, frame.bottom-4),
|
BPoint(frame.right - 3.0f, frame.top + 1.0f), lightenmax);
|
||||||
BPoint(frame.left+4, frame.top), kWhite);
|
|
||||||
|
|
||||||
// Top -- always drawn
|
owner->AddLine(BPoint(frame.right - 2.0f, frame.top + 2.0f),
|
||||||
owner->AddLine(BPoint(frame.left+5, frame.top),
|
BPoint(frame.right - 2.0f, frame.top + 3.0f), darken2);
|
||||||
BPoint(frame.right-5, frame.top), kWhite);
|
owner->AddLine(BPoint(frame.right - 1.0f, frame.top + 4.0f),
|
||||||
|
BPoint(frame.right - 1.0f, frame.bottom - 4.0f), darken2);
|
||||||
|
|
||||||
// Right wall -- always drawn. Has a nice bevel.
|
if (full)
|
||||||
owner->AddLine(BPoint(frame.right-4, frame.top),
|
{
|
||||||
BPoint(frame.right-4, frame.bottom-4), kDarkGray);
|
owner->AddLine(BPoint(frame.right, frame.bottom - 3.0f),
|
||||||
owner->AddLine(BPoint(frame.right-5, frame.top),
|
BPoint(frame.right, frame.bottom - 2.0f), darken2);
|
||||||
BPoint(frame.right-5, frame.bottom-4), kMedGray);
|
owner->AddLine(BPoint(frame.right + 1.0f, frame.bottom - 1.0f),
|
||||||
|
BPoint(frame.right + 2.0f, frame.bottom), darken2);
|
||||||
|
}
|
||||||
|
|
||||||
// Bottom-right corner, only visible if the tab
|
owner->EndLineArray();
|
||||||
// is either frontmost or the rightmost tab.
|
|
||||||
if (full) {
|
|
||||||
owner->AddLine(BPoint(frame.right-3, frame.bottom-3),
|
|
||||||
BPoint(frame.right, frame.bottom), kDarkGray);
|
|
||||||
owner->AddLine(BPoint(frame.right-4, frame.bottom-3),
|
|
||||||
BPoint(frame.right-1, frame.bottom), kMedGray);
|
|
||||||
}
|
|
||||||
|
|
||||||
owner->EndLineArray();
|
|
||||||
|
|
||||||
owner->SetHighColor(hi);
|
|
||||||
owner->SetLowColor(lo);
|
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void BTab::_ReservedTab1() {}
|
void BTab::_ReservedTab1() {}
|
||||||
@@ -409,8 +398,9 @@ void BTabView::AttachedToWindow()
|
|||||||
BView::AttachedToWindow();
|
BView::AttachedToWindow();
|
||||||
|
|
||||||
// TODO: check if this color is set in the BeOS implementation
|
// TODO: check if this color is set in the BeOS implementation
|
||||||
if (Parent())
|
//if (Parent())
|
||||||
SetViewColor(Parent()->ViewColor ());
|
// SetViewColor(Parent()->ViewColor ());
|
||||||
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
Select(0);
|
Select(0);
|
||||||
}
|
}
|
||||||
@@ -590,39 +580,23 @@ void BTabView::DrawBox(BRect selTabRect)
|
|||||||
SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||||
B_LIGHTEN_MAX_TINT));
|
B_LIGHTEN_MAX_TINT));
|
||||||
|
|
||||||
StrokeLine(BPoint(0, selTabRect.bottom + 1), BPoint(0, rect.bottom));
|
StrokeLine(BPoint(0.0f, rect.bottom), BPoint(0.0f, selTabRect.bottom));
|
||||||
|
StrokeLine(BPoint(selTabRect.left - 4.0f, selTabRect.bottom));
|
||||||
if (selTabRect.left > 0.0f)
|
StrokeLine(BPoint(selTabRect.right + 3.0f, selTabRect.bottom),
|
||||||
StrokeLine(BPoint ( 0, selTabRect.bottom + 1),
|
BPoint(rect.right - 1.0f, selTabRect.bottom));
|
||||||
BPoint(selTabRect.left, selTabRect.bottom + 1));
|
|
||||||
|
|
||||||
if (selTabRect.right < rect.right - 2.0f)
|
|
||||||
StrokeLine(BPoint(selTabRect.right, selTabRect.bottom + 1),
|
|
||||||
BPoint(rect.right - 2, selTabRect.bottom + 1 ));
|
|
||||||
|
|
||||||
SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
|
||||||
B_DARKEN_2_TINT));
|
|
||||||
|
|
||||||
StrokeLine(BPoint(rect.left + 1, rect.bottom - 1),
|
|
||||||
BPoint(rect.right - 1, rect.bottom - 1));
|
|
||||||
|
|
||||||
StrokeLine(BPoint(rect.right - 1, selTabRect.bottom + 1),
|
|
||||||
BPoint(rect.right - 1, rect.bottom - 2));
|
|
||||||
|
|
||||||
SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||||
B_DARKEN_4_TINT));
|
B_DARKEN_4_TINT));
|
||||||
|
|
||||||
StrokeLine(BPoint ( rect.left + 1, rect.bottom ),
|
StrokeLine(BPoint(rect.right, selTabRect.bottom + 1.0f),
|
||||||
BPoint(rect.right - 1, rect.bottom ) );
|
|
||||||
|
|
||||||
StrokeLine(BPoint(rect.right, selTabRect.bottom + 1),
|
|
||||||
BPoint(rect.right, rect.bottom));
|
BPoint(rect.right, rect.bottom));
|
||||||
|
StrokeLine(BPoint(rect.left + 1.0f, rect.bottom));
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
BRect BTabView::TabFrame(int32 tab_index) const
|
BRect BTabView::TabFrame(int32 tab_index) const
|
||||||
{
|
{
|
||||||
return BRect((float)(tab_index * 94), 0, (float)(tab_index * 94 + 100),
|
return BRect((float)(7 + tab_index * 100), 0,
|
||||||
fTabHeight);
|
(float)(7 + tab_index * 100 + 99), fTabHeight);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void BTabView::SetFlags(uint32 flags)
|
void BTabView::SetFlags(uint32 flags)
|
||||||
|
|||||||
Reference in New Issue
Block a user