void VisualColorControl::AttachedToWindow()
{
	BPoint *points = new BPoint[3];
	points[0] = BPoint(0,0);
	points[1] = BPoint(-4,-4);
	points[2] = BPoint(4,-4);

	// calculate the initial ramps
	CalcRamps();

	// create the arrow-pictures
	BeginPicture(new BPicture());
		SetHighColor(100,100,255);
		FillPolygon(points,3);
		SetHighColor(0,0,0);
		StrokePolygon(points,3);
	down_arrow = EndPicture();

	if (Parent() != NULL)
		SetViewColor(Parent()->ViewColor());

	BStringView *sv = new BStringView(BRect(0,COLOR_HEIGHT/2,1,COLOR_HEIGHT/2),"label view",label1);
	AddChild(sv);
	float sv_width = sv->StringWidth(label1);
	sv_width = max_c(sv_width,sv->StringWidth(label2));
	sv_width = max_c(sv_width,sv->StringWidth(label3));
	font_height fHeight;
	sv->GetFontHeight(&fHeight);
	sv->ResizeTo(sv_width,fHeight.ascent+fHeight.descent);
	sv->MoveBy(0,-(fHeight.ascent+fHeight.descent)/2.0);
	BRect sv_frame = sv->Frame();
	sv_frame.OffsetBy(0,COLOR_HEIGHT);
	sv->SetAlignment(B_ALIGN_CENTER);
	sv = new BStringView(sv_frame,"label view",label2);
	AddChild(sv);
	sv->SetAlignment(B_ALIGN_CENTER);
	sv_frame.OffsetBy(0,COLOR_HEIGHT);
	sv = new BStringView(sv_frame,"label view",label3);
	AddChild(sv);
	sv->SetAlignment(B_ALIGN_CENTER);
	sv_frame.OffsetBy(0,COLOR_HEIGHT);
	sv = new BStringView(sv_frame,"label view",label4);
	AddChild(sv);
	sv->SetAlignment(B_ALIGN_CENTER);

	ramp_left_edge = sv->Bounds().IntegerWidth()+2;

	ResizeBy(ramp_left_edge,0);

	delete[] points;
}