/*
	
	HelloView.cpp
	
	Copyright 1995 Be Incorporated, All Rights Reserved.
	
*/

#ifndef HELLO_VIEW_H
#include "HelloView.h"
#endif

#include "README.h"

HelloView::HelloView(BRect rect, char *name)
	   	   : BView(rect, name, B_FOLLOW_ALL, B_WILL_DRAW)
	   	   	
{
	fStringView = new BMultiLineStringView(rect,
		"Text",kStartupText);
		
//	fScrollView = new BScrollView("scrolly",fStringView,
//				B_FOLLOW_LEFT | B_FOLLOW_TOP,0,true,false,B_FANCY_BORDER);
	AddChild(fStringView);
}


void
HelloView::MessageReceived(BMessage *message)
{
  if (message->WasDropped()) {
   
      char  *name = "<NO>";
   uint32  type;
   int32   count = 0;
   char fStr[999];
   char tmp[999];
   fStr[0] = 0;
   
//   strcpy(fStr,"Dropped Item:\n" );
   int32 i;
   
 //  status_t res =  message->GetInfo(B_ANY_TYPE,0,&name,&type,&count);
 
// 	printf("Res: %d, [%s]\n",res,name);
   
   for ( i = 0; 
         message->GetInfo(B_ANY_TYPE,i,&name,&type,&count) == 0;
         i++ ) {
         
         sprintf(tmp,"%s (%d)\n",name,count);
         
         strcat(fStr,name);
         strcat(fStr,"\n");
         
    }
    
    sprintf(tmp,"[%d]",i);
	strcat(fStr,tmp);
	
		fStringView->SetText(fStr);
      Invalidate();
      return;
    }
}


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


void HelloView::Draw(BRect)
{
//	MovePenTo(BPoint(10, 30));
//	DrawString(fStr);
}
