// BMultiLineStringView
// (c) 1997 Steven R. Loomis
// srl@monkey.sbay.org
// < http://www.monkey.sbay.org/~srl/ >
// do what you want with it but give me credit somewhere


#include "MultiLineStringView.h"

BMultiLineStringView::BMultiLineStringView
	(BRect frame, char *name, char *text)
	:BView(frame, name, B_FOLLOW_ALL, B_WILL_DRAW)
{
	strcpy(fText,text);		
}


void BMultiLineStringView::AttachedToWindow()
{
	SetFont(be_bold_font);
	SetFontSize(9);
}

void	BMultiLineStringView::Draw(BRect updateRect)
{
#pragma unused(updateRect)
	int h = 5;
	int v = 12;
	char *s;
	for(s=fText;*s;)
	{
		char *e = strchr(s,'\n');
		if(e)
			*e = 0;
	
		MovePenTo(BPoint(h, v));
		DrawString(s);
		
		if(!e)
			return;
	
		v += 12;		
		s = ++e;
	}
}

void	BMultiLineStringView::SetText(const char *text)
{
	strcpy(fText,text);
	Invalidate(); // ??
}
