1/*
2 * Copyright 2006, Haiku.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Stephan Aßmus <superstippi@gmx.de>
7 */
8
9#include "SwatchValueView.h"
10
11#include <stdio.h>
12
13// constructor
14SwatchValueView::SwatchValueView(const char* name,
15								 BMessage* message,
16								 BHandler* target,
17								 rgb_color color,
18								 float width,
19								 float height)
20	: SwatchView(name, message, target, color, width, height)
21{
22	uint32 flags = Flags();
23	flags |= B_NAVIGABLE;
24	SetFlags(flags);
25}
26
27// destructor
28SwatchValueView::~SwatchValueView()
29{
30}
31
32// MakeFocus
33void
34SwatchValueView::MakeFocus(bool focused)
35{
36	BView::MakeFocus(focused);
37	if (BView* parent = Parent())
38		parent->Invalidate();
39}
40
41// Draw
42void
43SwatchValueView::Draw(BRect updateRect)
44{
45	BRect b(Bounds());
46	if (BView* parent = Parent()) {
47		SetLowColor(tint_color(parent->LowColor(), B_DARKEN_1_TINT));
48		StrokeRect(b, B_SOLID_LOW);
49		b.InsetBy(1.0, 1.0);
50	}
51	FillRect(b);
52}
53
54// MouseDown
55void
56SwatchValueView::MouseDown(BPoint where)
57{
58	// forward click
59	if (BView* parent = Parent())
60		parent->MouseDown(ConvertToParent(where));
61
62	SwatchView::MouseDown(where);
63}
64