Exemplo n.º 1
0
int DeliverEvent(
	PWINDOW pWindow,
	int nEventCode,
	int x,int y,
	int bSendDirect,
	LPVOID lParameter
	){

	PLIST_ENTRY pEntry;

	if( bSendDirect){
		if(pWindow->mhFunctions[nEventCode]){
			return pWindow->mhFunctions[nEventCode]
				(pWindow,lParameter,pWindow->lpFunctionContext[nEventCode]);
		}
	}else{

		if(!IsInRect(x,y,pWindow->rAbsolute)){
			return 0;
		}else {
			if(pWindow->mhFunctions[nEventCode]){
				if(pWindow->mhFunctions[nEventCode](pWindow,lParameter,pWindow->lpFunctionContext[nEventCode])){
					return 1;
				}
			}
			if(pWindow->wChildrenHead){

				if(DeliverEvent(pWindow->wChildrenHead,nEventCode,x,y,bSendDirect,lParameter) == 1){
					return 1;
				}

				pEntry = pWindow->wChildrenHead->leEntry.pFlink;

				while(pEntry!=&pWindow->wChildrenHead->leEntry){

					if(DeliverEvent((PWINDOW)pEntry,
						nEventCode,
						x,y,
						bSendDirect,
						lParameter
						) == 1){
						return 1;
					}

					pEntry = pEntry->pFlink;
				}
			}
		}
	}
	return 0;
}
Exemplo n.º 2
0
/* SwCARDイベントハンドラ群 */
static
_ioe_handler()
{
	if(st==0) return;
	_clear_event();
	switch(st) {
	case 2: 	if(_card_load(chan)==0) goto eoj;
			break;
	case 1: 	DeliverEvent(DescUEV|0x0001, MyEvSpREADY|chan);
			goto eoj;
	case 3:	DeliverEvent(DescUEV|0x0001, MyEvSpNEW|chan);
			return;	/* stop server during main flow ope. */
eoj:
	default:	return ReEntry();
	}		
	st++; 
	return;
}
Exemplo n.º 3
0
int ShowBoxOnKey(LPVOID lpWindow, LPVOID lParameter, LPVOID lpContext)
{
	int nCharactersEachLine;
	int x,y;
	PWINDOW_SHOW_BOX pShowBox;
	char cKey = *(char *)lParameter;
	pShowBox = (PWINDOW_SHOW_BOX)lpWindow;

	//out_ttf_text_xy(x, y, "ÏÄÌìµÄ·ÉÄñ,·Éµ½ÎÒ´°Ç°³ª¸è,ÓÖ·ÉÈ¥ÁË¡£", "simyahei.ttf", 40);

	if(!pShowBox->bEnableEdit){
		return 1;
	}

	if(pShowBox->bUseHZK){//ʹÓúº×Ö¼´bUseHZKΪ1
		nCharactersEachLine = GetCharacterCountEachLine(
			pShowBox->nFrontSize,pShowBox->wBasic.rAbsolute.nWidth);
	}else{
		nCharactersEachLine = GetCharacterCountEachLine(
			pShowBox->nFrontSize/2,pShowBox->wBasic.rAbsolute.nWidth);

	}

	if(cKey == _LEFT ||cKey == _RIGHT||cKey == _UP ||cKey == _DOWN){

		RenderCursurInPosition(
			pShowBox->nFrontSize,
			pShowBox->bUseHZK,
			pShowBox -> nCursurPosition,
			pShowBox->wBasic.rAbsolute.nLeft,
			pShowBox->wBasic.rAbsolute.nTop ,
			pShowBox->wBasic.rAbsolute.nWidth ,
			pShowBox->wBasic.rAbsolute.nHeight,
			0
			);

		switch(cKey){
			case _LEFT	:pShowBox->nCursurPosition --;  break;
			case _UP	:pShowBox->nCursurPosition -= nCharactersEachLine; break;
			case _RIGHT	:pShowBox->nCursurPosition ++;  break;
			case _DOWN	:pShowBox->nCursurPosition += nCharactersEachLine; break;
		}
	}else{
		DeliverEvent((PWINDOW)&wIMEWindow,EVENT_ON_KEY,0,0,1,lParameter);
	}

	pShowBox->bCursurVisualNow = 0;

	return 1;
}
Exemplo n.º 4
0
static
_new_handler()
{
	if(st==0) return;
	_clear_event();
	switch(st) {
	case 1:	if(_card_clear(chan)==0) goto error;
			hw = 1;
			break;
	case 3:	DeliverEvent(DescUEV|0x0001, MyEvSpUNF|chan); 
			return;	/* stop server during main flow ope. */
	default:		
error:		return ReEntry();
	}
	st++; 
	return;
}
Exemplo n.º 5
0
void CEntityManager::SendEvents(float _fDeltaTime)
{
  for(uint32 i = 0; i < m_vEvents.size();)
  {
    m_vEvents[i].DispatchTime -= _fDeltaTime;
    if(m_vEvents[i].DispatchTime <= 0)
    {
      DeliverEvent(m_vEvents[i]);

      m_vEvents[i] = m_vEvents[m_vEvents.size() - 1];

      m_vEvents.pop_back();
    }
    else
    {
      ++i;
    }
  }
}
Exemplo n.º 6
0
int IMEWindowOnKey(LPVOID lpWindow, LPVOID lParameter, LPVOID lpContext)
{
	int  bUpdateWindow;

	char cKey;
	char cKeyString[2];

	int nSelect;
	int nLength;

	char * szDeliverHZ;

	PWINDOW_SHOW_BOX pShowBox;
	PWINDOW_IME pIME = (PWINDOW_IME)lpWindow;
	cKey = *(char *)lParameter;

	pShowBox = (PWINDOW_SHOW_BOX)pIME->wBasic.wChildrenHead;

	nSelect = 0;
	szDeliverHZ = 0;
	cKey = *((char *)lParameter);

	cKeyString[0] = cKey;
	cKeyString[1] = '\0';

	bUpdateWindow = 0;

	if(!(pIME->bShow)){
		pIME->bShow = 1;
		bUpdateWindow = 1;
	}

	if(pIME->bShowHZ){

		//			ESC 			Backspace
		if(cKey == 0x1B || cKey == '\b'){

			pIME->bShowHZ = 0;
			bUpdateWindow = 1;

			pShowBox->bUseHZK  = 0;
			pShowBox->szBuffer = pIME->szKeys;

		}else if(cKey == ' '){
			szDeliverHZ   = pIME->szHz;
			pIME->szKeys[0] = '\0';
			pIME->szKeys[1] = '\0';
		}else if( cKey < 10 && cKey > 0 ){
			nSelect = cKey;
			szDeliverHZ   = &pIME->szHz[2*(nSelect -1)];
			pIME->szKeys[0] = '\0';
			pIME->szKeys[1] = '\0';
		}
		if(szDeliverHZ){
			pIME->bShow   = 0;
			pIME->bShowHZ = 0;

			pShowBox->bUseHZK  = 0;
			pShowBox->szBuffer = pIME->szKeys;

			//rectangle(200,300,100,100);//´Ë´¦²»Ö´ÐÐ
			pIME->szKeys[0] = '\0';
			DeliverEvent(
				pwFoucus,
				EVENT_ON_HZ,
				0,0,
				1,
				szDeliverHZ
				);
			bUpdateWindow = 1;
		}
	}else{

		if(cKey == 0x1B){

			pIME->bShow = 0;
			*(pIME->szKeys)='\0';
			bUpdateWindow = 1;

		}else if(cKey == '\b'){

			pIME->szKeys[0] = '\0';
			pIME->szKeys[1] = '\0';
			if(strlen(pIME->szKeys) == 0){
				DeliverEvent(
					pwFoucus,
					EVENT_ON_HZ,
					0,0,
					1,
					"\b"
					);
			}
			// pIME->szKeys[strlen(pIME->szKeys)] = '\0';
			bUpdateWindow = 1;
		}else if(cKey == ' '){

			pIME->szHz = py_ime(pIME->szKeys);
			if(pIME->szHz){
				pIME->bShowHZ = 1;
				pShowBox->szBuffer = pIME->szHz;
				pShowBox->bUseHZK  = 1;
				bUpdateWindow = 1;
			}

		}else if(cKey >= 'a' && cKey <= 'z' ){
		//rectangle(100,100,
		//cKey%100,cKey%100);¿ÉÒÔÖ´Ðе½´Ë
			nLength = strlen(pIME->szKeys);
			pIME->szKeys[nLength] = cKey;
			pIME->szKeys[nLength +1 ] = '\0';
			bUpdateWindow = 1;
		}
	}

	if(bUpdateWindow){
		//pShowBox->szBuffer = "test";
		RenderWindowAndSubwindow((PWINDOW)pIME);
		//rectangle(500,400,100,100);¿ÉÒÔÖ´Ðе½´Ë
	}
	return 1;
}
Exemplo n.º 7
0
static
_deliver_sw2()
{
	if(hw==0) return;
	DeliverEvent(SwCARD,EvSpTIMOUT);
}
Exemplo n.º 8
0
static
_deliver_sw1()
{
	if(hw==0) return;
	DeliverEvent(SwCARD,EvSpERROR);
}
Exemplo n.º 9
0
/* HwCARDイベントハンドラ群 */
static
_deliver_sw0()
{
	if(hw==0) return;
	DeliverEvent(SwCARD,EvSpIOE);
}