#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winb.h>
#include <te.h>
#include <fntb.h>
#include <gui.h>
#include "sftlib.h"

int	DB_YESNO_ALERT = -1 ;
int	DB_YESNO_TEXT = -1 ;
int	DB_YESNO_DBUTTON[2] = -1 ;
int	DB_YESNO_MESSAGE[4] = -1 ;

int YESNO_RET=0;  /* return value */

/*	initDataMESAG:DB_YESNO_DBUTTON[0]:MJ_DBUTTONL40の呼び出し関数	*/
/*	initDataMESAG:DB_YESNO_DBUTTON[1]:MJ_DBUTTONL40の呼び出し関数	*/
int	DB_YESNOFunc(kobj, messId, argc, pev, trigger)
int		kobj ;
int		messId ;
int		argc ;
EVENT	*pev ;
int		trigger ;
{


	if( kobj==DB_YESNO_DBUTTON[0] ) YESNO_RET=0; else YESNO_RET=1;
	MMI_SendMessage( DB_YESNO_ALERT, MM_ERASE, 0);
	MMI_SendMessage( DB_YESNO_ALERT, MM_DETACH, 0);
	MMI_SetHaltFlag(True);
	return NOERR ;
}

int DB_YESNO_ALERTCall( char *text )
{
	MMI_SendMessage( DB_YESNO_MESSAGE[0], MM_SETMSG, 1, "システムメッセージ" );
	MMI_SendMessage( DB_YESNO_MESSAGE[1], MM_SETMSG, 1, "" );
	MMI_SendMessage( DB_YESNO_MESSAGE[2], MM_SETMSG, 1, "はい" );
	MMI_SendMessage( DB_YESNO_MESSAGE[3], MM_SETMSG, 1, "いいえ" );
	MMI_SendMessage( DB_YESNO_TEXT,  MM_SETTEXT, 3, text, strlen(text), FALSE);
	MMI_SendMessage( DB_YESNO_ALERT, MM_ATTACH, 1, DB_base);
	MMI_SendMessage( DB_YESNO_ALERT, MM_SHOW, 0);
	MMI_ExecSystem();
	MMI_SendMessage( DB_YESNO_TEXT,  MM_SETTEXT, 3, NULL, 0, FALSE);
	return YESNO_RET; /* おされたボタンのばんごう */
}

