diff -r 000000000000 -r eb1f2e154e89 textinput/peninputsplititut/src/peninputsplititutwindowmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/textinput/peninputsplititut/src/peninputsplititutwindowmanager.cpp Tue Feb 02 01:02:04 2010 +0200 @@ -0,0 +1,467 @@ +/* +* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: drop-down list control +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include +#include +#include +//#include +#include + +#include "peninputsplititutwindowmanager.h" +#include "peninputsplititutwindow.h" +#include "peninputsplititutdatamgr.h" +#include "peninputsplititutuimgrbase.h" +#include "peninputsplititutuistatebase.h" +#include "peninputsplititutconverter.h" + + +// ============================ MEMBER FUNCTIONS ============================= + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::NewL +// --------------------------------------------------------------------------- +// +CSplitItutWindowManager* CSplitItutWindowManager::NewL(CSplitItutUiLayout* aLayoutOwner, + CSplitItutDataMgr* aDataMgr) + { + CSplitItutWindowManager* layout = new (ELeave) + CSplitItutWindowManager(aLayoutOwner,aDataMgr); + CleanupStack::PushL(layout); + layout->ConstructL(); + CleanupStack::Pop(layout); + return layout; + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::CSplitItutWindowManager +// --------------------------------------------------------------------------- +// +CSplitItutWindowManager::CSplitItutWindowManager(CSplitItutUiLayout* aLayoutOwner, + CSplitItutDataMgr* aDataMgr) + :iLayoutOwner(aLayoutOwner), + iDataMgr(aDataMgr), + iLastRawKeyDown(EStdKeyNull) + + { + iInEditWordQueryDlg = EFalse; + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::CSplitItutWindowManager +// --------------------------------------------------------------------------- +// +CSplitItutWindowManager::~CSplitItutWindowManager() + { + delete iWindow; + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::SetPropertyL +// --------------------------------------------------------------------------- +// +void CSplitItutWindowManager::SetPropertyL(MItutPropertySubscriber::TItutProperty aPropertyName, + const TDesC& aPropertyValue) + { + iWindow->SetPropertyL(aPropertyName, aPropertyValue); + + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::ConstructL +// --------------------------------------------------------------------------- +// +void CSplitItutWindowManager::ConstructL() + { + iWindow = CSplitItutWindow::NewL(this, iLayoutOwner,iDataMgr); + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::SimulateRawEvent +// --------------------------------------------------------------------------- +// +void CSplitItutWindowManager::SimulateRawEvent(TInt aScanCode, TRawEvent::TType aType) + { + iLayoutOwner->SimulateRawEvent(aScanCode, aType); + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::HandleCtrlEventL +// --------------------------------------------------------------------------- +// +void CSplitItutWindowManager::HandleCtrlEventL(TInt aEventType, + CFepUiBaseCtrl* aCtrl, + const TDesC& aEventData) + { + switch(aEventType) + { + case EEventRawKeyDownEvent: + { + const TKeyEvent *key = reinterpret_cast(aEventData.Ptr()); + SimulateRawEvent(key->iScanCode,TRawEvent::EKeyDown); + SetLastRawKeyDown(key->iScanCode, ETrue, aCtrl); + } + break; + case EEventRawKeyUpEvent: + { + const TKeyEvent *key = reinterpret_cast(aEventData.Ptr()); + SimulateRawEvent(key->iScanCode,TRawEvent::EKeyUp); + SetLastRawKeyDown(key->iScanCode, EFalse, aCtrl); + } + break; + case EEventButtonUp: + { +/* else if (aCtrl->ControlId() == ECtrlIdArrowUp) + { + TRAP_IGNORE(iWindow->Icf()->HandleArrowBtnEventL( + CFepLayoutMultiLineIcf::EArrowUp)); + } + else if (aCtrl->ControlId() == ECtrlIdArrowDown) + { + TRAP_IGNORE(iWindow->Icf()->HandleArrowBtnEventL( + CFepLayoutMultiLineIcf::EArrowDown)); + }*/ + if (aCtrl->ControlId() == ECtrlIdClose) + { + iLayoutOwner->SignalOwner(ESignalLayoutClosed); + } + else if (aCtrl->ControlId() == ECtrlIdOptions) + { + iLayoutOwner->SignalOwner(ESignalLaunchOptionsMenu); + } + } + break; + + /* case EItutCmdArrowUp: + { + if (aCtrl->ControlId() == ECtrlIdArrowUp) + { + TRAP_IGNORE(iWindow->Icf()->HandleArrowBtnEventL( + CFepLayoutMultiLineIcf::EArrowUp)); + } + } + break; + case EItutCmdArrowDown: + { + if (aCtrl->ControlId() == ECtrlIdArrowDown) + { + TRAP_IGNORE(iWindow->Icf()->HandleArrowBtnEventL( + CFepLayoutMultiLineIcf::EArrowDown)); + } + } + break;*/ + case EEventCapturePointer: + { + if (iRawKeyDown) + { + SimulateRawEvent(iLastRawKeyDown, TRawEvent::EKeyUp); + iRawKeyCtrl->CancelPointerDownL(); + SetLastRawKeyDown(iLastRawKeyDown, EFalse, NULL); + } + } + break; + default: + break; + }; + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::HandleCtrlEventL +// --------------------------------------------------------------------------- +// +TBool CSplitItutWindowManager::HandleCommandL(TInt aCmd, TUint8* aData) + { + TBool handle = EFalse; + TInt* data = (TInt*) aData; + switch (aCmd) + { + case ECmdPenInputDimArrowKeys: + { + TBool IsDimArrowKeys = *aData; + DimArrowKeys( IsDimArrowKeys ); + } + break; + case ECmdPenInputEnableSettingBtn: + { + CAknFepCtrlCommonButton * optionsbtn; + TBool enable = *data; + optionsbtn = static_cast(iWindow->Control(ECtrlIdOptions)); + if(optionsbtn && !enable) + { + optionsbtn->SetDimmed(ETrue); + handle = ETrue; + iDimOperationBtn = ETrue; + } + else if(optionsbtn && enable) + { + optionsbtn->SetDimmed(EFalse); + handle = ETrue; + iDimOperationBtn = EFalse; + } + break; + } + case ECmdPenInputSymbolOfHardKeyOne: + { + iWindow->SetHardKeyOneSymbol(aData); + handle = ETrue; + } + break; + + case ECmdPenInputInEditWordQueryDlg: + { + iInEditWordQueryDlg = *data; + } + break; + default: + break; + + }; + return handle; + } + + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::SizeChanged +// --------------------------------------------------------------------------- +// +TInt CSplitItutWindowManager::SizeChanged() + { + return iWindow->SizeChanged(); + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::SubmitText +// --------------------------------------------------------------------------- +// +void CSplitItutWindowManager::SubmitText(const TDesC& aEventData) + { + iLayoutOwner->SignalOwner(ESignalKeyEvent, aEventData); + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::OnSkinChange +// --------------------------------------------------------------------------- +// +TInt CSplitItutWindowManager::OnSkinChange() + { + TRAPD(err, + iWindow->ConstructSpellCtrlFromResourceL(); + iWindow->ConstructItutKeypadFromResourceL(iWindow->ItutKeypad()->ResourceId())); + + iWindow->OnSkinChange(); + return err; + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::OnSkinChange +// --------------------------------------------------------------------------- +// +void CSplitItutWindowManager::ShowArrowBtn(TInt aShowFlag) + { + iWindow->Control(ECtrlIdArrowLeft)->Hide(!(EBtnArrowLeft & aShowFlag)); + iWindow->Control(ECtrlIdArrowRight)->Hide(!(EBtnArrowRight & aShowFlag)); +// iWindow->Control(ECtrlIdArrowUp)->Hide(!(EBtnArrowUp & aShowFlag)); +// iWindow->Control(ECtrlIdArrowDown)->Hide(!(EBtnArrowDown & aShowFlag)); + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::UiLayout +// --------------------------------------------------------------------------- +// +CFepUiLayout* CSplitItutWindowManager::UiLayout() + { + return iLayoutOwner; + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::HandleAppInfoChangeL +// --------------------------------------------------------------------------- +// +void CSplitItutWindowManager::HandleAppInfoChangeL(const TDesC& /*aInfo*/) + { + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::ApplyVariantLafDataL +// --------------------------------------------------------------------------- +// +void CSplitItutWindowManager::ApplyVariantLafDataL(TBool aResolutionChange) + { + iWindow->ApplyVariantLafDataL(aResolutionChange); + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::CreateChineseSpecificCtrlsIfNeededL +// --------------------------------------------------------------------------- +// +void CSplitItutWindowManager::CreateChineseSpecificCtrlsIfNeededL() + { + iWindow->CreateChineseSpecificCtrlsIfNeededL(); + } + + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::SetLastRawKeyDown +// --------------------------------------------------------------------------- +// +void CSplitItutWindowManager::SetLastRawKeyDown(TInt aScanCode, TBool aKeyDown, + CFepUiBaseCtrl* aCtrl) + { + !aKeyDown ? iLastRawKeyDown = EStdKeyNull : iLastRawKeyDown = aScanCode; + iRawKeyDown = aKeyDown; + iRawKeyCtrl = aCtrl; + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::Control +// --------------------------------------------------------------------------- +// +CFepUiBaseCtrl* CSplitItutWindowManager::Control(TInt aCtrlId) + { + return iWindow->Control(aCtrlId); + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::OnActivate +// --------------------------------------------------------------------------- +// +void CSplitItutWindowManager::OnActivate() + { + if (iDimOperationBtn) + { + static_cast(Control(ECtrlIdOptions))->SetDimmed(ETrue); + } + else + { + static_cast(Control(ECtrlIdOptions))->SetDimmed(EFalse); + } + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::DimArrowKeys +// --------------------------------------------------------------------------- +// +void CSplitItutWindowManager::DimArrowKeys( TBool aDimArrow ) + { + if (iDataMgr->IsChinese()) + { + CAknFepCtrlRawKeyButton * leftbtn; + CAknFepCtrlRawKeyButton * rightbtn; +// CAknFepCtrlRawKeyButton * upbtn; +// CAknFepCtrlRawKeyButton * downbtn; + leftbtn = static_cast(iWindow->Control(ECtrlIdArrowLeft)); + rightbtn = static_cast(iWindow->Control(ECtrlIdArrowRight)); +// upbtn = static_cast(iWindow->Control(ECtrlIdArrowUp)); +// downbtn = static_cast(iWindow->Control(ECtrlIdArrowDown)); + + leftbtn->SetDimmed(aDimArrow); + rightbtn->SetDimmed(aDimArrow); +// upbtn->SetDimmed(aDimArrow); +// downbtn->SetDimmed(aDimArrow); + + } + else + { + CAknFepCtrlRawKeyButton * leftbtn; + CAknFepCtrlRawKeyButton * rightbtn; + leftbtn = static_cast(iWindow->Control(ECtrlIdArrowLeft)); + rightbtn = static_cast(iWindow->Control(ECtrlIdArrowRight)); + + leftbtn->SetDimmed(aDimArrow); + rightbtn->SetDimmed(aDimArrow); + } + } + +// --------------------------------------------------------------------------- +// CSplitItutWindowManager::ShowBubble +// --------------------------------------------------------------------------- +// +void CSplitItutWindowManager::ShowBubble(TInt /*aShow*/) + { + /* + CFepCtrlDropdownList* spell = + static_cast(iWindow->Control(ECtrlIdSpellCandsList)); + CFepCtrlDropdownList* standard = + static_cast(iWindow->Control(ECtrlIdStdCandsList)); + CFepCtrlDropdownList* punctuation = + static_cast(iWindow->Control(ECtrlIdPuncCandsList)); + + if (aShow > 0) + { + TRect outrect,innerrect; + outrect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(EPreviewBubbleRect)); + innerrect = TItutDataConverter::AnyToRect(iDataMgr->RequestData(EPreviewBubbleInnerRect)); + TAknTextLineLayout bubbleTextLayout = + TItutDataConverter::AnyToTextLine(iDataMgr->RequestData(EPreviewBubbleTextlayout)); + CFont* bubbleFont = TItutDataConverter::AnyToFont(iDataMgr->RequestData(EPreviewBubbleFont)); + + spell->ShowBubble(ETrue); + standard->ShowBubble(ETrue); + punctuation->ShowBubble(ETrue); + + spell->SetBubbleBitmapParam(NULL,NULL,KAknsIIDQsnFrInputCharPreview); + + spell->SetTextFormat(bubbleTextLayout); + spell->SetBubbleTextFont(bubbleFont); + spell->SetBubbleSize(TSize(outrect.Width(),outrect.Height())); // Read laf + spell->SetFrameDiff(innerrect.iTl.iX - outrect.iTl.iX, + innerrect.iTl.iY - outrect.iTl.iY, + outrect.iBr.iX - innerrect.iBr.iX, + outrect.iBr.iY - innerrect.iBr.iY); + + standard->SetBubbleBitmapParam(NULL,NULL,KAknsIIDQsnFrInputCharPreview); + + standard->SetTextFormat(bubbleTextLayout); + standard->SetBubbleTextFont(bubbleFont); + standard->SetBubbleSize(TSize(outrect.Width(),outrect.Height())); // Read laf + standard->SetFrameDiff(innerrect.iTl.iX - outrect.iTl.iX, + innerrect.iTl.iY - outrect.iTl.iY, + outrect.iBr.iX - innerrect.iBr.iX, + outrect.iBr.iY - innerrect.iBr.iY); + + punctuation->SetBubbleBitmapParam(NULL,NULL,KAknsIIDQsnFrInputCharPreview); + + punctuation->SetTextFormat(bubbleTextLayout); + punctuation->SetBubbleTextFont(bubbleFont); + punctuation->SetBubbleSize(TSize(outrect.Width(),outrect.Height())); // Read laf + punctuation->SetFrameDiff(innerrect.iTl.iX - outrect.iTl.iX, + innerrect.iTl.iY - outrect.iTl.iY, + outrect.iBr.iX - innerrect.iBr.iX, + outrect.iBr.iY - innerrect.iBr.iY); + } + else + { + spell->ShowBubble(EFalse); + standard->ShowBubble(EFalse); + punctuation->ShowBubble(EFalse); + } + */ + } + +// End Of File