/*====================================================
                      ARTemis
                   (version 1.3)
             FM-TOWNS 用ペイントツール

                 by 松内 良介 1994
====================================================*/
/*
	wakebtn.c  :  ウェイクボタン型部品・実現モジュール
	
	外部関数:
		int MMI_initWakeBtn(void)
*/

#define	MODULE_WAKEBTN

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winb.h>
#include <te.h>
#include <fntb.h>
#include <gui.h>
#include "art.h"
#include "wakebtn.h"

int		MJ_WAKEBTN = -1;

/*	マウスにタッチされたときの処理  */

	static int ML_WAKEBTNtouch(kobj, messId, argc, pev)
	int		kobj ;
	int		messId ;
	int		argc ;
	EVENT	*pev;
	{
		int base;
		EVENT evbuf;
		base = TL_getObjectPtr(kobj)->base;
	  /* いま起こったイベントをそのままキューに戻す */
		evbuf = *pev;
		MMI_SetEvnt(evbuf);
		return NOERR ;
	}
	
/* メッセージに対する関数の対応 */

	#define	NMET_WAKEBTN	1
	
	static int (*MF_WAKEBTNmethod[NMET_WAKEBTN])() = {
		ML_WAKEBTNtouch
	} ;
	
	static char *MM_WAKEBTNmessage[NMET_WAKEBTN] = {
		MT_MOUSEON
	};

/* 初期化関数 */

	int MMI_initWakeBtn(void)
	{
		MJ_WAKEBTN = MMI_AddType(MJ_HYPER, NMET_WAKEBTN,
								 sizeof(WAKEBTN),
								 MF_WAKEBTNmethod,
								 MM_WAKEBTNmessage) ;
		if (MJ_WAKEBTN < NOERR)
			return MJ_WAKEBTN ;
		return NOERR ;
	}
