|
1 /* |
|
2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: drop-down list control |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <coemain.h> |
|
20 #include <peninputgeneralitutnew.rsg> |
|
21 #include <peninputitutconfig_chinese.rsg> |
|
22 #include <AknFepGlobalEnums.h> |
|
23 #include <peninputlabel.h> |
|
24 |
|
25 #include "peninputitutchnuistatestandby.h" |
|
26 #include "peninputgenericitutuimgrbase.h" |
|
27 #include "peninputgenericitutlayoutcontext.h" |
|
28 #include "peninputgenericitutdatamgr.h" |
|
29 |
|
30 CChnItutUiStateStandby* CChnItutUiStateStandby::NewL(CGenericItutUiMgrBase* aOwner) |
|
31 { |
|
32 CChnItutUiStateStandby* self = new (ELeave) CChnItutUiStateStandby(aOwner); |
|
33 CleanupStack::PushL(self); |
|
34 self->ConstructL(); |
|
35 CleanupStack::Pop(self); |
|
36 return self; |
|
37 } |
|
38 |
|
39 CChnItutUiStateStandby::~CChnItutUiStateStandby() |
|
40 { |
|
41 } |
|
42 |
|
43 CChnItutUiStateStandby::CChnItutUiStateStandby(CGenericItutUiMgrBase* aOwner) |
|
44 :CGenericItutUiStateBase(aOwner) |
|
45 { |
|
46 } |
|
47 |
|
48 CGenericItutUiMgrBase::TUiState CChnItutUiStateStandby::StateType() |
|
49 { |
|
50 return CGenericItutUiMgrBase::EStateStandby; |
|
51 } |
|
52 |
|
53 void CChnItutUiStateStandby::OnEntryL() |
|
54 { |
|
55 iOwner->LayoutContext()->Control(ECtrlIdSwitch)->Hide(EFalse); |
|
56 iOwner->LayoutContext()->Control(ECtrlIdIndicator)->Hide(EFalse); |
|
57 // pinyin |
|
58 switch (iOwner->DataMgr()->InputMode()) |
|
59 { |
|
60 case EPinyin: |
|
61 { |
|
62 iOwner->DataMgr()->NotifyChangeControlLayout( |
|
63 MItutPropertySubscriber::EItutPropertyKeypadResourceId, |
|
64 R_FINGER_INPUT_KEYPAD_PINYIN_STANDBY_PREDICT); |
|
65 } |
|
66 break; |
|
67 case EStroke: |
|
68 { |
|
69 TInt resID; |
|
70 if (iOwner->DataMgr()->InputLanguage() == ELangPrcChinese) |
|
71 { |
|
72 resID = R_FINGER_INPUT_KEYPAD_STROKE_STANDBY_PREDICT_PRC; |
|
73 } |
|
74 else |
|
75 { |
|
76 resID = R_FINGER_INPUT_KEYPAD_STROKE_STANDBY_PREDICT_TRA; |
|
77 } |
|
78 iOwner->DataMgr()->NotifyChangeControlLayout( |
|
79 MItutPropertySubscriber::EItutPropertyKeypadResourceId, |
|
80 resID); |
|
81 } |
|
82 break; |
|
83 case EZhuyin: |
|
84 { |
|
85 iOwner->DataMgr()->NotifyChangeControlLayout( |
|
86 MItutPropertySubscriber::EItutPropertyKeypadResourceId, |
|
87 R_FINGER_INPUT_KEYPAD_ZHUYIN_STANDBY_PREDICT); |
|
88 } |
|
89 break; |
|
90 default: |
|
91 break; |
|
92 } |
|
93 // Show ICF, Backspace, Arrow after position changed to avoid flick |
|
94 iOwner->LayoutContext()->Control(ECtrlIdICF)->Hide( EFalse ); |
|
95 iOwner->LayoutContext()->Control(ECtrlIdBackspace)->Hide( EFalse ); |
|
96 |
|
97 iOwner->LayoutContext()->ShowArrowBtn( |
|
98 EBtnArrowLeft | EBtnArrowRight | EBtnArrowUp | EBtnArrowDown); |
|
99 } |
|
100 |
|
101 void CChnItutUiStateStandby::OnExit() |
|
102 { |
|
103 // hide input mode indicator |
|
104 |
|
105 // Hide ICF, Backspace, Arrow contrls when exit to avoid flick |
|
106 //iOwner->LayoutContext()->ShowArrowBtn(0); |
|
107 //iOwner->LayoutContext()->Control(ECtrlIdICF)->Hide( ETrue ); |
|
108 //iOwner->LayoutContext()->Control(ECtrlIdBackspace)->Hide(ETrue); |
|
109 } |
|
110 |
|
111 TBool CChnItutUiStateStandby::HandleKeyL(TInt aCmd, TInt aKey) |
|
112 { |
|
113 if (aKey == EKeyBackspace) |
|
114 { |
|
115 return iOwner->ClrConsumed(); |
|
116 } |
|
117 |
|
118 if (IsKeyValid(aKey)) |
|
119 { |
|
120 iOwner->SetNumLongPressValid(ETrue); |
|
121 iOwner->SetCurrentStateL(CGenericItutUiMgrBase::EStateComposition); |
|
122 iOwner->CurrentState()->HandleKeyL(aCmd, aKey); |
|
123 return ETrue; |
|
124 } |
|
125 |
|
126 return EFalse; |
|
127 } |
|
128 |
|
129 TBool CChnItutUiStateStandby::IsKeyValid(TInt aKey) |
|
130 { |
|
131 TInt immode = iOwner->DataMgr()->InputMode(); |
|
132 |
|
133 return (immode == EPinyin && aKey >= EPtiKey2 && aKey <= EPtiKey9) || |
|
134 (immode == EStroke && aKey >= EPtiKey1 && aKey <= EPtiKey6) || |
|
135 (immode == EZhuyin && aKey >= EPtiKey0 && aKey <= EPtiKey9); |
|
136 } |
|
137 |
|
138 // End Of File |