// TDR_about.cp
#define TDR_DABOUT_ID		180
#define TDR_APIC_BACK		1000
#define TDR_APIC_THANKSTO	1001

static pascal Boolean myAboutFilter(DialogPtr theDlg, EventRecord *getEv, short *item);
void TDR_About(void);

void TDR_About(void)
{
	PicHandle ph1,ph2;
	DialogPtr dlg;
	ModalFilterUPP myFilter;
	GrafPtr cptr;
	Handle itemH;
	short itemtype;
	short item;
	Rect box;
	
	GetPort(&cptr);
	
	/* get from resoyrce */
	ph1 = GetPicture(TDR_APIC_BACK);
	ph2 = GetPicture(TDR_APIC_THANKSTO);
	dlg = GetNewDialog(TDR_DABOUT_ID, nil, (WindowPtr)-1);

	myFilter = NewModalFilterProc(myAboutFilter);

	SetPort(dlg);

	GetDialogItem(dlg, 1, &itemtype, &itemH, &box);
	DrawPicture(ph1, &box);
	
	GetDialogItem(dlg, 3, &itemtype, &itemH, &box);
	DrawPicture(ph2, &box);

	while(1){
		ModalDialog(myFilter, &item);
		if(item == 1) break;
	}
	
	DisposeDialog(dlg);
	ReleaseResource((Handle)ph1);
	ReleaseResource((Handle)ph2);
	
}


// マウスクリックまたはキーダウンで終了する
static pascal Boolean myAboutFilter(DialogPtr theDlg, EventRecord *getEv, short *item)
{
	if(getEv->what == keyDown || getEv->what == mouseDown){
		*item = 1;
		return true;
	}
	return false;
}
