Set the preferred height of the separator to be always even, since, and center
the horizontal lines which represents it to the actual bounds. Should fix #5440. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35856 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b0ec5aef02
commit
8074fdceb9
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2006, Haiku, Inc.
|
||||
* Copyright (c) 2001-2010, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT license.
|
||||
*
|
||||
* Authors:
|
||||
@ -68,7 +68,8 @@ BSeparatorItem::GetContentSize(float* _width, float* _height)
|
||||
BFont font(be_plain_font);
|
||||
if (Menu())
|
||||
Menu()->GetFont(&font);
|
||||
*_height = floorf(font.Size() * 0.8);
|
||||
const float height = floorf((font.Size() * 0.8) / 2) * 2;
|
||||
*_height = max_c(4, height);
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,12 +85,13 @@ BSeparatorItem::Draw()
|
||||
rgb_color oldColor = menu->HighColor();
|
||||
rgb_color lowColor = menu->LowColor();
|
||||
|
||||
const float startTop = bounds.top + (floor(bounds.Height())) / 2;
|
||||
menu->SetHighColor(tint_color(lowColor, B_DARKEN_1_TINT));
|
||||
menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 4.0f),
|
||||
BPoint(bounds.right - 1.0f, bounds.top + 4.0f));
|
||||
menu->StrokeLine(BPoint(bounds.left + 1.0f, startTop),
|
||||
BPoint(bounds.right - 1.0f, startTop));
|
||||
menu->SetHighColor(tint_color(lowColor, B_LIGHTEN_2_TINT));
|
||||
menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 5.0f),
|
||||
BPoint(bounds.right - 1.0f, bounds.top + 5.0f));
|
||||
menu->StrokeLine(BPoint(bounds.left + 1.0f, startTop + 1.0f),
|
||||
BPoint(bounds.right - 1.0f, startTop + 1.0f));
|
||||
|
||||
menu->SetHighColor(oldColor);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user