fixed border style not applied in constructor, changed drawing to use line arrays
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12490 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+43
-17
@@ -45,7 +45,8 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
BBox::BBox(BRect frame, const char *name, uint32 resizingMode, uint32 flags,
|
BBox::BBox(BRect frame, const char *name, uint32 resizingMode, uint32 flags,
|
||||||
border_style border)
|
border_style border)
|
||||||
: BView(frame, name, resizingMode, flags)
|
: BView(frame, name, resizingMode, flags),
|
||||||
|
fStyle(border)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
@@ -230,6 +231,8 @@ void BBox::FrameResized(float width, float height)
|
|||||||
{
|
{
|
||||||
BRect bounds(Bounds());
|
BRect bounds(Bounds());
|
||||||
|
|
||||||
|
// TODO: only invalidate the part that really need redrawing!
|
||||||
|
|
||||||
fBounds.right = bounds.right;
|
fBounds.right = bounds.right;
|
||||||
fBounds.bottom = bounds.bottom;
|
fBounds.bottom = bounds.bottom;
|
||||||
|
|
||||||
@@ -321,7 +324,6 @@ void BBox::InitObject(BMessage *data)
|
|||||||
{
|
{
|
||||||
fLabel = NULL;
|
fLabel = NULL;
|
||||||
fBounds = Bounds();
|
fBounds = Bounds();
|
||||||
fStyle = B_FANCY_BORDER;
|
|
||||||
fLabelView = NULL;
|
fLabelView = NULL;
|
||||||
|
|
||||||
int32 flags = 0;
|
int32 flags = 0;
|
||||||
@@ -340,27 +342,51 @@ void BBox::InitObject(BMessage *data)
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void BBox::DrawPlain()
|
void BBox::DrawPlain()
|
||||||
{
|
{
|
||||||
BRect rect = fBounds;
|
BRect r = fBounds;
|
||||||
|
|
||||||
SetHighColor(tint_color(ViewColor(), B_LIGHTEN_MAX_TINT));
|
rgb_color light = tint_color(ViewColor(), B_LIGHTEN_MAX_TINT);
|
||||||
StrokeLine(BPoint(rect.left, rect.bottom), BPoint(rect.left, rect.top));
|
rgb_color shadow = tint_color(ViewColor(), B_DARKEN_3_TINT);
|
||||||
StrokeLine(BPoint(rect.left+1.0f, rect.top), BPoint(rect.right, rect.top));
|
|
||||||
SetHighColor(tint_color(ViewColor(), B_DARKEN_3_TINT));
|
BeginLineArray(4);
|
||||||
StrokeLine(BPoint(rect.left+1.0f, rect.bottom), BPoint(rect.right, rect.bottom));
|
AddLine(BPoint(r.left, r.bottom),
|
||||||
StrokeLine(BPoint(rect.right, rect.bottom), BPoint(rect.right, rect.top+1.0f));
|
BPoint(r.left, r.top), light);
|
||||||
|
AddLine(BPoint(r.left + 1.0f, r.top),
|
||||||
|
BPoint(r.right, r.top), light);
|
||||||
|
AddLine(BPoint(r.left + 1.0f, r.bottom),
|
||||||
|
BPoint(r.right, r.bottom), shadow);
|
||||||
|
AddLine(BPoint(r.right, r.bottom - 1.0f),
|
||||||
|
BPoint(r.right, r.top + 1.0f), shadow);
|
||||||
|
EndLineArray();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void BBox::DrawFancy()
|
void BBox::DrawFancy()
|
||||||
{
|
{
|
||||||
BRect rect = fBounds;
|
BRect r = fBounds;
|
||||||
|
|
||||||
SetHighColor(tint_color(ViewColor(), B_LIGHTEN_MAX_TINT));
|
rgb_color light = tint_color(ViewColor(), B_LIGHTEN_MAX_TINT);
|
||||||
rect.left++;
|
rgb_color shadow = tint_color(ViewColor(), B_DARKEN_3_TINT);
|
||||||
rect.top++;
|
|
||||||
StrokeRect(rect);
|
BeginLineArray(8);
|
||||||
SetHighColor(tint_color(ViewColor(), B_DARKEN_3_TINT));
|
AddLine(BPoint(r.left, r.bottom),
|
||||||
rect.OffsetBy(-1,-1);
|
BPoint(r.left, r.top), shadow);
|
||||||
StrokeRect(rect);
|
AddLine(BPoint(r.left + 1.0f, r.top),
|
||||||
|
BPoint(r.right, r.top), shadow);
|
||||||
|
AddLine(BPoint(r.left + 1.0f, r.bottom),
|
||||||
|
BPoint(r.right, r.bottom), light);
|
||||||
|
AddLine(BPoint(r.right, r.bottom - 1.0f),
|
||||||
|
BPoint(r.right, r.top + 1.0f), light);
|
||||||
|
|
||||||
|
r.InsetBy(1.0, 1.0);
|
||||||
|
|
||||||
|
AddLine(BPoint(r.left, r.bottom),
|
||||||
|
BPoint(r.left, r.top), light);
|
||||||
|
AddLine(BPoint(r.left + 1.0f, r.top),
|
||||||
|
BPoint(r.right, r.top), light);
|
||||||
|
AddLine(BPoint(r.left + 1.0f, r.bottom),
|
||||||
|
BPoint(r.right, r.bottom), shadow);
|
||||||
|
AddLine(BPoint(r.right, r.bottom - 1.0f),
|
||||||
|
BPoint(r.right, r.top + 1.0f), shadow);
|
||||||
|
EndLineArray();
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void BBox::ClearAnyLabel()
|
void BBox::ClearAnyLabel()
|
||||||
|
|||||||
Reference in New Issue
Block a user