⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fepcontrol.cpp

📁 Symbian平台 数字键盘手机输入法源码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
			break;
		case EAknEditorTextInputMode:
			nRespon = m_pEQTAPMultitap->OnKeyEventProc ((int)&aKeyEvent, aEventCode);
			if(nRespon<0)
			{
			}
			else
			{
				response =(TKeyResponse)nRespon;
			}
			break;

		case EAknEditorNumericInputMode:
			nRespon = m_pEQTAPNumberic->OnKeyEventProc ((int)&aKeyEvent, aEventCode);
			if(nRespon<0)
			{
			}
			else
			{
				response = (TKeyResponse)nRespon;
			}
			break;
		
		case EAknEditorSecretAlphaInputMode:
			response = OfferKeyEventInSecretAlphaModeL(aKeyEvent, aEventCode);
			break;
		
		default:
			break;
		}
	return response;
	}
	

/**
 * Handles keypresses when the fep is in secret alpha mode
 */
TKeyResponse CeQTapControl::OfferKeyEventInSecretAlphaModeL(const TKeyEvent& /*aKeyEvent*/, TEventCode /*aEventCode*/)
	{
	// No implementation yet, so just return key not consumed
	return EKeyWasNotConsumed;
	}

/**
 *
 */

/**
 * This method will place one key event defined by aKeyCode onto the control
 * stack to be handled as normal.
 */
void CeQTapControl::SimulateKeyEventL(TUint aKeyCode)
	{
	CArrayFix<TUint>* simCharArray=new(ELeave) CArrayFixFlat<TUint>(1);
	CleanupStack::PushL(simCharArray);
	simCharArray->AppendL(aKeyCode);
	iFep.SimulateKeyEventsL(simCharArray->Array());
	CleanupStack::PopAndDestroy(); // simCharArray
	}


void CeQTapControl::HandleChangeInFocus()
	{
	TRAPD(err, HandleChangeInFocusL());
	if (err != KErrNone)
		{
		ClearBuffer();
		m_pEQTAPMultitap->ClearEngineBuffer ();
		}
	}

void CeQTapControl::HandleChangeInFocusL()
	{
	// Commit the uncommitted inline editing, if any
	if ((iInputMode == EAknEditorTextInputMode || iInputMode == EAknEditorNumericInputMode ||
		iInputMode == EAknEditorSecretAlphaInputMode) && iInsideInlineEditingTransaction)
		{
//		CommitInlineEditL(*(iInputCapabilities.FepAwareTextEditor()), EFalse);
		// Next key is a new key press 
//		m_pEQTAPMultitap->SetPreviousKeyCode(EKeyNull);
		}

	// Get the newly focused control capability	
	iInputCapabilities = STATIC_CAST(const CCoeAppUi*, iCoeEnv->AppUi())->InputCapabilities();

	// check & process the current capability underneath
	if (iInputCapabilities.FepAwareTextEditor())
		{
		// Not all text editors are "fep aware". Fep somehow needs help from the editor window 
		// to determine the current editor capabilities.
		CAknEdwinState* editorState = EditorState();
		TUint editorMode = editorState->CurrentInputMode();
		if (editorMode == EAknEditorNullInputMode)
			editorMode = editorState->DefaultInputMode();

		SwitchInputModeL(editorMode);
		}
	else // no FepAwareTextEditor
		{ // Check for non Edwin derived editors (eg mfne, tel no editor etc)
		if (iInputCapabilities.SupportsWesternNumericIntegerPositive() || iInputCapabilities.SupportsWesternNumericIntegerNegative())
			{
			SwitchInputModeL(EAknEditorNumericInputMode);
			}
		else if (iInputCapabilities.SupportsSecretText())
			{
			SwitchInputModeL(EAknEditorSecretAlphaInputMode);
			}
		else if (iInputCapabilities.SupportsWesternAlphabetic())
			{
			SwitchInputModeL(EAknEditorTextInputMode);
			}
		else 
			{
			SwitchInputModeL(EAknEditorNullInputMode);
			}
		}
	}

CAknEdwinState* CeQTapControl::EditorState() const
	{
	return STATIC_CAST(CAknEdwinState*, iInputCapabilities.FepAwareTextEditor()->Extension1()->State(KNullUid));
	}

/*
 * This method switch and set the input mode of the Avkon editor state
 */
void CeQTapControl::SwitchInputModeL(TUint aInputMode)
	{
	iInputMode = aInputMode;

	switch(iInputMode)
	{
	case EAknEditorSmartEnglish:
		m_pEQTAPSmartEnglish->OnLostFocus();
		break;
	case EAKnEditorSmartChinese:
		m_pEQTAPSmartChinese->OnLostFocus();
		break;
	case EAknEditorBiHUa:
		m_pEQTAPStroke->OnLostFocus();
		break;
	}
	
	m_pEQTAPNumberic->Active(FALSE);
	m_pEQTAPMultitap->Active (FALSE);
	m_pEQTAPSmartEnglish->Active(FALSE);
	m_pEQTAPSmartChinese->Active(FALSE);
	m_pEQTAPStroke->Active(FALSE);

	/*becuase the system default value is EAknEditorTextInputMode, we exchange the multitap and the smartchinese using the following code*/
	if(aInputMode==EAknEditorTextInputMode)
	{
		iInputMode =EAKnEditorSmartChinese;
	}
	if(aInputMode == EAKnEditorSmartChinese)
	{
		iInputMode = EAknEditorTextInputMode;
	}
	
	switch(iInputMode)
		{
		case EAknEditorTextInputMode:			// Fall through
		case EAknEditorSecretAlphaInputMode:
			if(m_pEQTAPMultitap->IsUpper()==TRUE)
			{
				iIndicator->SetState(CFepIndicator::EStateUpperAlphabat); 
			}
			else
			{
				iIndicator->SetState(CFepIndicator::EStateAlphabat); 
			}
			m_pEQTAPMultitap->SwitchToMultiTap();
			m_pEQTAPMultitap->Active (TRUE);
			break;

		case EAknEditorNumericInputMode:
			iIndicator->SetState(CFepIndicator::EStateShuZi);
			m_pEQTAPNumberic->SwitchToNumeric();
			m_pEQTAPNumberic->Active(TRUE);
			break;

		case EAknEditorNullInputMode:
			iIndicator->SetState(CFepIndicator::EStateNone);
			Window().SetVisible(EFalse);
			m_bWindowVisible= FALSE;

			iInsideInlineEditingTransaction = EFalse;			// Update indicator on status pane
			break;

		case EAknEditorSmartEnglish:
			iIndicator->SetState(CFepIndicator::EStateEnglish); // Update indicator on status pane
			m_pEQTAPSmartEnglish->SwitchToSmartEnglish();
			m_pEQTAPSmartEnglish->Active(TRUE);
			FreshSEWindow();
			break;
		case EAKnEditorSmartChinese:
			iIndicator->SetState(CFepIndicator::EStatePinyin);
			m_pEQTAPSmartChinese->SwitchToSmartChinese();
			m_pEQTAPSmartChinese->Active(TRUE);
			FreshSCWindow();
			break;
		case EAknEditorBiHUa:
			iIndicator->SetState(CFepIndicator::EStateBihua); // Update indicator on status pane
			m_pEQTAPStroke->SwitchToStroke();
			m_pEQTAPStroke->Active(TRUE);
			FreshSTKWindow();
			break;
		default:
			break;
		}

	ClearBuffer();

	// ensure editor is aware of new fep mode
	if (iInputCapabilities.FepAwareTextEditor())
		EditorState()->SetCurrentInputMode(aInputMode);
	}

void CeQTapControl::ClearBuffer(void)
{
	iUncommittedText.iCursorPos = 0;
	iUncommittedText.iAnchorPos = 0;

	m_pEQTAPMultitap->ClearEngineBuffer ();
}

TKeyResponse CeQTapControl::OfferKeyEventInSwichModeL()
{	
	
	m_CurrentIMIndex++;


	m_CurrentIMIndex = m_CurrentIMIndex%TOTAL_IM_MODE;

	SwitchInputModeL(g_nIMModeArray[m_CurrentIMIndex]);
	TKeyResponse response = EKeyWasConsumed;
	return response;
}
void CeQTapControl::Draw(const TRect& aRect) const
{
	if(m_pEQTAPInterpunction->GetIpState ()==TRUE)
	{
		m_pEQTAPInterpunction->DrawBD();
		return ;
	}
	switch(iInputMode)
	{
	case EAknEditorSmartEnglish:
		m_pEQTAPSmartEnglish->DrawSmartEnglish ();
		break;
	case EAKnEditorSmartChinese:
		m_pEQTAPSmartChinese->DrawSmartChinese();
		break;
	case EAknEditorBiHUa:
		m_pEQTAPStroke->DrawStroke();
		break;
	}
}

void CeQTapControl::FreshFepWindow()
{
	switch(iInputMode)
	{
	case EAknEditorSmartEnglish:
		m_pEQTAPSmartEnglish->ActiveSEWindow(TRUE);
		FreshSEWindow();
		break;
	case EAKnEditorSmartChinese:
		m_pEQTAPSmartChinese->ActiveSCWindow(TRUE);
		FreshSCWindow();
		break;
	case EAknEditorBiHUa:
		m_pEQTAPStroke->ActiveSTKWindow(TRUE);
		FreshSTKWindow();
		break;
	default:
		Window().SetVisible(EFalse);
		m_bWindowVisible= FALSE;
	}
}

TKeyResponse CeQTapControl::DoFunctionKeys(TInt keycode)
{
	TKeyResponse response = EKeyWasNotConsumed;

	switch(iInputMode)
	{
	case EAknEditorSmartEnglish:
		response = m_pEQTAPSmartEnglish->DoFunctionKeys(keycode);
		break;
	case EAKnEditorSmartChinese:
		response = m_pEQTAPSmartChinese->DoFunctionKeys(keycode);
		break;
	case EAknEditorBiHUa:
		response = m_pEQTAPStroke->DoFunctionKeys(keycode);
		break;
	default:
		break;
	}

	return response;
}
// end of file

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -