eqtapnumeric.cpp

来自「Symbian平台 数字键盘手机输入法源码」· C++ 代码 · 共 109 行

CPP
109
字号
// eQTapNumeric.cpp: implementation of the CeQTapNumeric class.
//
//////////////////////////////////////////////////////////////////////

#include "eQTapNumeric.h"
#include "FepControl.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CeQTapNumeric::CeQTapNumeric()
{

}

CeQTapNumeric::~CeQTapNumeric()
{

}
int CeQTapNumeric::OnKeyEventProc(int nParameter1, int nParameter2)
{
	int nReturn = KEY_RESULT_NOTPROCESSED;
	TKeyEvent* aKeyEvent = (TKeyEvent*)nParameter1;
	if((m_bIsIMActive == FALSE)||(aKeyEvent==NULL))
	{
		goto FuncExit;
	}
	
	nReturn = EKeyWasNotConsumed;

	if (aKeyEvent->iCode == '*')
	{
		// Just place a key event ('+') to the application underneath the FEP 
		if (m_peQTapCtrl->IsInlineEditTrans()==FALSE)
		{ 
			m_peQTapCtrl->StartInlineEdit(KNullDesC, 0, ETrue);
		}
		m_peQTapCtrl->SimulateKeyEventL('+');
		nReturn = EKeyWasConsumed;
	}
	else
	{
		if((aKeyEvent->iCode>='0')&&(aKeyEvent->iCode<='9'))
		{
			if (m_peQTapCtrl->IsInlineEditTrans()==FALSE)
			{ 
				m_peQTapCtrl->StartInlineEdit(KNullDesC, 0, ETrue);
			}
			TBuf<1> buffer = KNullDesC();
			buffer.Append(aKeyEvent->iCode);
			m_peQTapCtrl->UpdateInlineEditL(buffer, 1);						
			m_peQTapCtrl->CommitInlineEdit(ETrue);
			nReturn = EKeyWasConsumed;
		}
		/*
		*/
	}

FuncExit:
	return nReturn;
}
int CeQTapNumeric::OnDrawIMWindow()
{
	int nReturn = 0;

	return nReturn;
}

CeQTapNumeric* CeQTapNumeric::NewL(CeQTapControl* pControl)
{
	CeQTapNumeric* self = new(ELeave)CeQTapNumeric(pControl);
	CleanupStack::PushL(self);
	self->ConstructL();
	CleanupStack::Pop();	// self
	return self;
}

CeQTapNumeric::CeQTapNumeric(CeQTapControl* pControl)
{
	m_peQTapCtrl = pControl;
	m_bIsIMActive = FALSE;
}

void CeQTapNumeric::ConstructL()
{
}

void CeQTapNumeric::SwitchToNumeric()
{
	ActiveNMWindow(FALSE);
}

void CeQTapNumeric::ActiveNMWindow(TBool bActive)
{
	TPoint fepControlPos;
	RWindow& window = m_peQTapCtrl->GetRWindow();

	if (bActive == TRUE)  //打开输入法窗口	
	{
		window.SetVisible(ETrue);
		m_peQTapCtrl->SetWindowVisibleState(TRUE);
	}
	else                 //关闭输入法窗口
	{
		window.SetVisible(EFalse);
		m_peQTapCtrl->SetWindowVisibleState(FALSE);
	}
}

⌨️ 快捷键说明

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