177 |
192 |
178 if ( event->iIndex != KPeninputVkbWndInvalidIndex ) |
193 if ( event->iIndex != KPeninputVkbWndInvalidIndex ) |
179 { |
194 { |
180 if (aCtrl->ControlId() == EPeninutWindowCtrlIdAccentPopupWindow) |
195 if (aCtrl->ControlId() == EPeninutWindowCtrlIdAccentPopupWindow) |
181 { |
196 { |
182 TInt currentRange = CPeninputDataConverter::AnyToInt( |
197 if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
183 iLayoutContext->RequestData(EPeninputDataTypeCurrentRange)); |
|
184 TInt currentAccent = CPeninputDataConverter::AnyToInt( |
|
185 iLayoutContext->RequestData(EPeninputDataTypeCurrentAccent)); |
|
186 |
|
187 if ((currentRange == ERangeAccent) && (currentAccent == event->iIndex)) |
|
188 { |
198 { |
189 iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby ); |
199 TRAP_IGNORE( HandleRangeListSelectedL( aCtrl, aEventData )); |
190 return; |
|
191 } |
200 } |
192 |
201 else |
193 iLayoutContext->SetData( EPeninputDataTypeCurrentAccent, &(event->iIndex)); |
202 { |
194 |
203 TInt currentRange = CPeninputDataConverter::AnyToInt( |
195 // Active range, update rangebar and vkb layout |
204 iLayoutContext->RequestData(EPeninputDataTypeCurrentRange)); |
196 //ChangeRange( ERangeAccent, EPeninputVkbLayoutAccented1 + 2 * event->iIndex); |
205 TInt currentAccent = CPeninputDataConverter::AnyToInt( |
197 (currentRange == ERangeAccent) ? ChangeRange(ERangeAccent, |
206 iLayoutContext->RequestData(EPeninputDataTypeCurrentAccent)); |
198 EPeninputVkbLayoutAccented1 + 2 * event->iIndex, EFalse) : |
207 |
199 ChangeRange(ERangeAccent, |
208 if ((currentRange == ERangeAccent) && (currentAccent == event->iIndex)) |
200 EPeninputVkbLayoutAccented1 + 2 * event->iIndex, ETrue); |
209 { |
|
210 iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby ); |
|
211 return; |
|
212 } |
|
213 |
|
214 iLayoutContext->SetData( EPeninputDataTypeCurrentAccent, &(event->iIndex)); |
|
215 |
|
216 // Active range, update rangebar and vkb layout |
|
217 //ChangeRange( ERangeAccent, EPeninputVkbLayoutAccented1 + 2 * event->iIndex); |
|
218 (currentRange == ERangeAccent) ? ChangeRange(ERangeAccent, |
|
219 EPeninputVkbLayoutAccented1 + 2 * event->iIndex, EFalse) : |
|
220 ChangeRange(ERangeAccent, |
|
221 EPeninputVkbLayoutAccented1 + 2 * event->iIndex, ETrue); |
|
222 } |
201 } |
223 } |
202 else if (aCtrl->ControlId() == EPeninutWindowCtrlIdSwitcherPopupWindow) |
224 else if (aCtrl->ControlId() == EPeninutWindowCtrlIdSwitcherPopupWindow) |
203 { |
225 { |
204 if (iLayoutContext->LayoutType() != event->iCommand) |
226 if (iLayoutContext->LayoutType() != event->iCommand) |
205 { |
227 { |
895 // (other items were commented in a header) |
938 // (other items were commented in a header) |
896 // -------------------------------------------------------------------------- |
939 // -------------------------------------------------------------------------- |
897 // |
940 // |
898 void CPeninputGenericVkbWindow::PopupChoiceList() |
941 void CPeninputGenericVkbWindow::PopupChoiceList() |
899 { |
942 { |
900 CFepUiBaseCtrl* accentBtn = Control( EPeninutWindowCtrlIdAccentedBtn ); |
943 if ( iLayoutContext->LayoutType() == EPluginInputModeFSQ ) |
901 |
944 { |
902 if ( accentBtn ) |
945 TRAP_IGNORE( PopupRangeListL()); |
903 { |
946 } |
904 if(!iPopupInited) |
947 else |
905 TRAP_IGNORE(DoIdleConstructL()); |
948 { |
906 iPopupWnd->Display( accentBtn->Rect() ); |
949 CFepUiBaseCtrl* accentBtn = Control( EPeninutWindowCtrlIdAccentedBtn ); |
907 iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStatePopup ); |
950 |
908 } |
951 if ( accentBtn ) |
|
952 { |
|
953 if(!iPopupInited) |
|
954 TRAP_IGNORE(DoIdleConstructL()); |
|
955 iPopupWnd->Display( accentBtn->Rect() ); |
|
956 iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStatePopup ); |
|
957 } |
|
958 } |
|
959 } |
|
960 // --------------------------------------------------------------------------- |
|
961 // Show range list |
|
962 // --------------------------------------------------------------------------- |
|
963 // |
|
964 void CPeninputGenericVkbWindow::PopupRangeListL() |
|
965 { |
|
966 if ( !iPopupInited ) |
|
967 { |
|
968 TRAP_IGNORE( DoIdleConstructL() ); |
|
969 } |
|
970 |
|
971 |
|
972 iPopupWnd->ClearItemsL(); |
|
973 RArray<CFepLayoutChoiceList::SItem> items; |
|
974 PrepareRangeListItems( items ); |
|
975 TInt count = items.Count(); |
|
976 for ( TInt i = 0; i < count; i++ ) |
|
977 { |
|
978 iPopupWnd->AddItemL( items[i] ); |
|
979 } |
|
980 items.Close(); |
|
981 |
|
982 if ( iPopupWnd->ItemsCount() < 1 ) |
|
983 { |
|
984 return; |
|
985 } |
|
986 |
|
987 if ( iPopupWnd->ItemsCount() < 2 ) |
|
988 { |
|
989 const CFepLayoutChoiceList::SItem* item = iPopupWnd->ItemByIndex( 0 ); |
|
990 CFepLayoutChoiceList::SEvent event; |
|
991 event.iIndex = 0; |
|
992 event.iCommand = item->iCommand; |
|
993 TPtrC ptr; |
|
994 ptr.Set(reinterpret_cast<TText*>(&event), sizeof(event)); |
|
995 HandleRangeListSelectedL( iPopupWnd, ptr ); |
|
996 return; |
|
997 } |
|
998 |
|
999 CFepUiBaseCtrl* btn = Control( EPeninutWindowCtrlIdMultiRangeBtn ); |
|
1000 iPopupWnd->SetListColumnNumWithLafL( iPopupWnd->ItemsCount() ); |
|
1001 iPopupWnd->SetCurrentFocusedIndex( - 1 ); //no active item |
|
1002 iPopupWnd->Display( btn->Rect() ); |
|
1003 iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStatePopup ); |
|
1004 } |
|
1005 |
|
1006 // --------------------------------------------------------------------------- |
|
1007 // Handle range list event |
|
1008 // --------------------------------------------------------------------------- |
|
1009 // |
|
1010 void CPeninputGenericVkbWindow::HandleRangeListSelectedL( CFepUiBaseCtrl* /*aCtrl*/, |
|
1011 const TDesC& aData ) |
|
1012 { |
|
1013 CFepLayoutChoiceList::SEvent* event = |
|
1014 (CFepLayoutChoiceList::SEvent*)aData.Ptr(); |
|
1015 |
|
1016 TInt index = -1; |
|
1017 TInt range = ERangeInvalid; |
|
1018 |
|
1019 if ( event->iCommand == EPeninputVkbLayoutNativeChar ) |
|
1020 { |
|
1021 range = ERangeNative; |
|
1022 } |
|
1023 |
|
1024 else if ( event->iCommand == EPeninputVkbLayoutNativeNumber ) |
|
1025 { |
|
1026 range = ERangeNativeNumber; |
|
1027 } |
|
1028 |
|
1029 else if ( event->iCommand == EPeninputVkbLayoutLatinChar ) |
|
1030 { |
|
1031 range = ERangeEnglish; |
|
1032 } |
|
1033 |
|
1034 else if ( event->iCommand == EPeninputVkbLayoutLatinNumber ) |
|
1035 { |
|
1036 range = ERangeNumber; |
|
1037 } |
|
1038 |
|
1039 else if ( event->iCommand == EPeninputVkbLayoutSymbol ) |
|
1040 { |
|
1041 range = ERangeSymbol; |
|
1042 } |
|
1043 |
|
1044 else if ( event->iCommand == EPeninputVkbLayoutAccented1 ) |
|
1045 { |
|
1046 index = 0; |
|
1047 range = ERangeAccent; |
|
1048 } |
|
1049 |
|
1050 else if ( event->iCommand == EPeninputVkbLayoutAccented2 ) |
|
1051 { |
|
1052 index = 1; |
|
1053 range = ERangeAccent; |
|
1054 } |
|
1055 |
|
1056 else if ( event->iCommand == EPeninputVkbLayoutAccented3 ) |
|
1057 { |
|
1058 index = 2; |
|
1059 range = ERangeAccent; |
|
1060 } |
|
1061 |
|
1062 TInt currentRange = IntContext( EPeninputDataTypeCurrentRange ); |
|
1063 TInt currentAccent = IntContext( EPeninputDataTypeCurrentAccent ); |
|
1064 |
|
1065 if ( currentRange == range ) |
|
1066 { |
|
1067 if ( range != ERangeAccent || currentAccent == index ) |
|
1068 { |
|
1069 iUiStateMgr->SetCurrentUiState( EPeninputVkbUiStateStandby ); |
|
1070 return; |
|
1071 } |
|
1072 } |
|
1073 |
|
1074 iLayoutContext->SetData( EPeninputDataTypeCurrentAccent, &index ); |
|
1075 |
|
1076 if ( range != ERangeAccent ) |
|
1077 { |
|
1078 ChangeRange( range ); |
|
1079 } |
|
1080 else |
|
1081 { |
|
1082 ChangeRange( ERangeAccent, |
|
1083 EPeninputVkbLayoutAccented1 + 2 * index, ETrue ); |
|
1084 } |
|
1085 UpdateRangeCtrlsL(); |
|
1086 } |
|
1087 |
|
1088 // --------------------------------------------------------------------------- |
|
1089 // Update state of range button |
|
1090 // --------------------------------------------------------------------------- |
|
1091 // |
|
1092 void CPeninputGenericVkbWindow::UpdateRangeCtrlsL() |
|
1093 { |
|
1094 CAknFepCtrlCommonButton* rangeBtn = |
|
1095 static_cast<CAknFepCtrlCommonButton*>( |
|
1096 Control(EPeninutWindowCtrlIdMultiRangeBtn)); |
|
1097 if ( !rangeBtn ) |
|
1098 { |
|
1099 return; |
|
1100 } |
|
1101 |
|
1102 RArray<CFepLayoutChoiceList::SItem> items; |
|
1103 PrepareRangeListItems( items ); |
|
1104 TInt count = items.Count(); |
|
1105 items.Close(); |
|
1106 |
|
1107 TInt languageId = IntContext( EPeninputDataTypeInputLanguage ); |
|
1108 TInt range = IntContext( EPeninputDataTypeCurrentRange ); |
|
1109 |
|
1110 TInt resId = -1; |
|
1111 TInt aplhaRangeResId = -1; |
|
1112 TInt numberRangeResId = -1; |
|
1113 GetRangeIconResource( languageId, aplhaRangeResId, numberRangeResId ); |
|
1114 |
|
1115 if ( range == ERangeEnglish || range == ERangeNative ) |
|
1116 { |
|
1117 resId = aplhaRangeResId; |
|
1118 } |
|
1119 else |
|
1120 { |
|
1121 resId = numberRangeResId; |
|
1122 } |
|
1123 |
|
1124 rangeBtn->SetResourceId( resId ); |
|
1125 rangeBtn->ConstructFromResourceL(); |
|
1126 rangeBtn->SetDimmed( count < 1 ); |
|
1127 } |
|
1128 |
|
1129 // --------------------------------------------------------------------------- |
|
1130 // Get resource ids of range button icon |
|
1131 // --------------------------------------------------------------------------- |
|
1132 // |
|
1133 void CPeninputGenericVkbWindow::GetRangeIconResource( TInt aLangId, |
|
1134 TInt& aAlphaRange, |
|
1135 TInt& aOtherRange ) |
|
1136 { |
|
1137 switch ( aLangId ) |
|
1138 { |
|
1139 case ELangRussian: //Cyrillic |
|
1140 case ELangBulgarian: |
|
1141 case ELangUkrainian: |
|
1142 { |
|
1143 aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_CYRILLIC_ALPHA; |
|
1144 aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_CYRILLIC_NUMERIC; |
|
1145 } |
|
1146 break; |
|
1147 case ELangGreek: //Greek |
|
1148 case ELangCyprusGreek: |
|
1149 { |
|
1150 aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_GREEK_ALPHA; |
|
1151 aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_GREEK_NUMERIC; |
|
1152 } |
|
1153 break; |
|
1154 case ELangHebrew: //Hebrew |
|
1155 { |
|
1156 aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_HEBREW_ALPHA; |
|
1157 aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_HEBREW_NUMERIC; |
|
1158 } |
|
1159 break; |
|
1160 case ELangArabic: //Arabic |
|
1161 case ELangFarsi: //Farsi |
|
1162 case ELangUrdu: //Urdu |
|
1163 { |
|
1164 aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_ARABIC_ALPHA; |
|
1165 aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_ARABIC_NUMERIC; |
|
1166 } |
|
1167 break; |
|
1168 case ELangThai: //Thai |
|
1169 { |
|
1170 aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_THAI_ALPHA; |
|
1171 aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_THAI_NUMERIC; |
|
1172 } |
|
1173 break; |
|
1174 default: //others |
|
1175 { |
|
1176 aAlphaRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_LATIN_ALPHA; |
|
1177 aOtherRange = R_PENINPUT_LAYOUT_VKB_RANGECTRL_LATIN_NUMERIC; |
|
1178 } |
|
1179 } |
|
1180 } |
|
1181 |
|
1182 // --------------------------------------------------------------------------- |
|
1183 // Prepare range list items |
|
1184 // --------------------------------------------------------------------------- |
|
1185 // |
|
1186 void CPeninputGenericVkbWindow::PrepareRangeListItems( |
|
1187 RArray<CFepLayoutChoiceList::SItem>& aRangeItems ) |
|
1188 { |
|
1189 aRangeItems.Reset(); |
|
1190 TInt currentRange = IntContext( EPeninputDataTypeCurrentRange ); |
|
1191 TInt permittedRange = IntContext( EPeninputDataTypePermittedRange ); |
|
1192 TInt currentAccent = IntContext( EPeninputDataTypeCurrentAccent ); |
|
1193 |
|
1194 CPeninputRangeBarInfo* rbinfo= ConfigInfo()->RangeBarInfo(); |
|
1195 CPeninputRangeInfo* rgninfo = NULL; |
|
1196 |
|
1197 //add accent items |
|
1198 if ( permittedRange & ERangeAccent ) |
|
1199 { |
|
1200 rgninfo = rbinfo->FindRange( ERangeAccent ); |
|
1201 if ( rgninfo ) |
|
1202 { |
|
1203 for ( TInt i = 0; i < iAccentCmdList.Count(); i++ ) |
|
1204 { |
|
1205 if( currentRange != ERangeAccent || currentAccent != i ) |
|
1206 { |
|
1207 aRangeItems.Append( iAccentCmdList[i] ); |
|
1208 } |
|
1209 } |
|
1210 } |
|
1211 } |
|
1212 |
|
1213 //add range items |
|
1214 CFepLayoutChoiceList::SItem item; |
|
1215 |
|
1216 if ( permittedRange & ERangeNative ) |
|
1217 { |
|
1218 rgninfo = rbinfo->FindRange( ERangeNative ); |
|
1219 if ( rgninfo && currentRange != ERangeNative ) |
|
1220 { |
|
1221 item.iCommand = EPeninputVkbLayoutNativeChar; |
|
1222 item.iText.Copy( iRangeLabels.iLabelNativeChar ); |
|
1223 aRangeItems.Append( item ); |
|
1224 } |
|
1225 } |
|
1226 |
|
1227 if ( permittedRange & ERangeNativeNumber ) |
|
1228 { |
|
1229 rgninfo = rbinfo->FindRange( ERangeNativeNumber ); |
|
1230 if ( rgninfo && currentRange != ERangeNativeNumber ) |
|
1231 { |
|
1232 item.iCommand = EPeninputVkbLayoutNativeNumber; |
|
1233 item.iText.Copy( iRangeLabels.iLabelNativeNumber ); |
|
1234 aRangeItems.Append( item ); |
|
1235 } |
|
1236 } |
|
1237 |
|
1238 if ( permittedRange & ERangeEnglish ) |
|
1239 { |
|
1240 rgninfo = rbinfo->FindRange( ERangeEnglish ); |
|
1241 if ( rgninfo && currentRange != ERangeEnglish ) |
|
1242 { |
|
1243 item.iCommand = EPeninputVkbLayoutLatinChar; |
|
1244 item.iText.Copy( iRangeLabels.iLabelLatinChar ); |
|
1245 aRangeItems.Append( item ); |
|
1246 } |
|
1247 } |
|
1248 |
|
1249 if ( permittedRange & ERangeNumber ) |
|
1250 { |
|
1251 rgninfo = rbinfo->FindRange( ERangeNumber ); |
|
1252 if ( rgninfo && currentRange != ERangeNumber ) |
|
1253 { |
|
1254 item.iCommand = EPeninputVkbLayoutLatinNumber; |
|
1255 item.iText.Copy( iRangeLabels.iLabelLatinNumber ); |
|
1256 aRangeItems.Append( item ); |
|
1257 } |
|
1258 } |
|
1259 } |
|
1260 |
|
1261 // --------------------------------------------------------------------------- |
|
1262 // Load range labels for range list |
|
1263 // --------------------------------------------------------------------------- |
|
1264 // |
|
1265 void CPeninputGenericVkbWindow::ConstructRangeLabelListL( TInt /*aLangId*/ ) |
|
1266 { |
|
1267 iRangeLabels.iLabelNativeChar.Zero(); |
|
1268 iRangeLabels.iLabelNativeNumber.Zero(); |
|
1269 iRangeLabels.iLabelLatinChar.Zero(); |
|
1270 iRangeLabels.iLabelLatinNumber.Zero(); |
|
1271 iRangeLabels.iLabelSymbol.Zero(); |
|
1272 iRangeLabels.iLabelAccent.Zero(); |
|
1273 |
|
1274 TInt resid = R_PENINPUT_LAYOUT_VKB_RANGES; |
|
1275 |
|
1276 TResourceReader reader; |
|
1277 CCoeEnv::Static()->CreateResourceReaderLC( reader, resid ); |
|
1278 TPtrC ptr1 = reader.ReadTPtrC(); |
|
1279 TPtrC ptr2 = reader.ReadTPtrC(); |
|
1280 TPtrC ptr3 = reader.ReadTPtrC(); |
|
1281 TPtrC ptr4 = reader.ReadTPtrC(); |
|
1282 TPtrC ptr5 = reader.ReadTPtrC(); |
|
1283 TPtrC ptr6 = reader.ReadTPtrC(); |
|
1284 |
|
1285 iRangeLabels.iLabelNativeChar.Copy( ptr1 ); |
|
1286 iRangeLabels.iLabelNativeNumber.Copy( ptr2 ); |
|
1287 iRangeLabels.iLabelLatinChar.Copy( ptr3 ); |
|
1288 iRangeLabels.iLabelLatinNumber.Copy( ptr4 ); |
|
1289 iRangeLabels.iLabelSymbol.Copy( ptr5 ); |
|
1290 iRangeLabels.iLabelAccent.Copy( ptr6 ); |
|
1291 |
|
1292 CleanupStack::PopAndDestroy( 1 ); //reader |
|
1293 } |
|
1294 |
|
1295 // --------------------------------------------------------------------------- |
|
1296 // Utils to get context value |
|
1297 // --------------------------------------------------------------------------- |
|
1298 // |
|
1299 TInt CPeninputGenericVkbWindow::IntContext( TPeninputDataType aDataIndex ) |
|
1300 { |
|
1301 return CPeninputDataConverter::AnyToInt( |
|
1302 iLayoutContext->RequestData( aDataIndex )); |
909 } |
1303 } |
910 |
1304 |
911 // -------------------------------------------------------------------------- |
1305 // -------------------------------------------------------------------------- |
912 // CPeninputGenericVkbWindow::ResetAccentButton |
1306 // CPeninputGenericVkbWindow::ResetAccentButton |
913 // (other items were commented in a header) |
1307 // (other items were commented in a header) |
1883 } |
2297 } |
1884 iPopupWnd->SetListColumnNumWithLafL( iPopupWnd->ItemsCount() ); |
2298 iPopupWnd->SetListColumnNumWithLafL( iPopupWnd->ItemsCount() ); |
1885 iPopupInited = ETrue; |
2299 iPopupInited = ETrue; |
1886 iPopupSet = ETrue; |
2300 iPopupSet = ETrue; |
1887 } |
2301 } |
|
2302 // --------------------------------------------------------------------------- |
|
2303 // Load accent labels for range list |
|
2304 // --------------------------------------------------------------------------- |
|
2305 // |
|
2306 void CPeninputGenericVkbWindow::ConstructFSQAccentListL( TInt aLangId ) |
|
2307 { |
|
2308 iAccentCmdList.Reset(); |
|
2309 |
|
2310 TBool is10x3 = ( aLangId == ELangEnglish ) || ( aLangId == ELangAmerican ) |
|
2311 || ( aLangId == ELangDutch) || (aLangId == ELangTagalog ) |
|
2312 || ( aLangId == ELangIndonesian) || (aLangId == ELangMalay ); |
|
2313 |
|
2314 if ( aLangId == ELangVietnamese ) |
|
2315 { |
|
2316 _LIT( KVietAccentList1, "\x00E0 - \x013A" ); |
|
2317 _LIT( KVietAccentList2, "\x013C - \x017E" ); |
|
2318 |
|
2319 CFepLayoutChoiceList::SItem item; |
|
2320 |
|
2321 item.iCommand = EPeninputVkbLayoutAccented1; |
|
2322 item.iText.Copy( KVietAccentList1 ); |
|
2323 iAccentCmdList.Append( item ); |
|
2324 |
|
2325 item.iCommand = EPeninputVkbLayoutAccented2; |
|
2326 item.iText.Copy( KVietAccentList2 ); |
|
2327 iAccentCmdList.Append( item ); |
|
2328 } |
|
2329 |
|
2330 // 10X3 |
|
2331 else if ( is10x3 ) |
|
2332 { |
|
2333 _LIT( KVietAccentList1, "\x00E0 - \x0121" ); |
|
2334 _LIT( KVietAccentList2, "\x0123 - \x014F" ); |
|
2335 _LIT( KVietAccentList3, "\x0151 - \x017E" ); |
|
2336 |
|
2337 CFepLayoutChoiceList::SItem item; |
|
2338 |
|
2339 item.iCommand = EPeninputVkbLayoutAccented1; |
|
2340 item.iText.Copy( KVietAccentList1 ); |
|
2341 iAccentCmdList.Append( item ); |
|
2342 |
|
2343 item.iCommand = EPeninputVkbLayoutAccented2; |
|
2344 item.iText.Copy( KVietAccentList2 ); |
|
2345 iAccentCmdList.Append( item ); |
|
2346 |
|
2347 |
|
2348 item.iCommand = EPeninputVkbLayoutAccented3; |
|
2349 item.iText.Copy( KVietAccentList3 ); |
|
2350 iAccentCmdList.Append( item ); |
|
2351 } |
|
2352 //10X4 |
|
2353 else |
|
2354 { |
|
2355 // Add item |
|
2356 TResourceReader reader; |
|
2357 CFepLayoutChoiceList::SItem item; |
|
2358 |
|
2359 item.iCommand = EPeninputVkbLayoutAccented1; |
|
2360 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT1 ); |
|
2361 TPtrC p1 = reader.ReadTPtrC(); |
|
2362 item.iText.Copy( p1 ); |
|
2363 iAccentCmdList.Append( item ); |
|
2364 CleanupStack::PopAndDestroy( 1 ); //reader |
|
2365 |
|
2366 item.iCommand = EPeninputVkbLayoutAccented2; |
|
2367 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT2 ); |
|
2368 TPtrC p2 = reader.ReadTPtrC(); |
|
2369 item.iText.Copy( p2 ); |
|
2370 iAccentCmdList.Append( item ); |
|
2371 CleanupStack::PopAndDestroy( 1 ); //reader |
|
2372 |
|
2373 item.iCommand = EPeninputVkbLayoutAccented3; |
|
2374 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_PENINPUT_VKB_ACCENT3 ); |
|
2375 TPtrC p3 = reader.ReadTPtrC(); |
|
2376 item.iText.Copy( p3 ); |
|
2377 iAccentCmdList.Append( item ); |
|
2378 CleanupStack::PopAndDestroy( 1 );//reader |
|
2379 } |
|
2380 |
|
2381 iPopupInited = ETrue; |
|
2382 iPopupSet = ETrue; |
|
2383 } |
1888 void CPeninputGenericVkbWindow::UpdateICFTextL() |
2384 void CPeninputGenericVkbWindow::UpdateICFTextL() |
1889 { |
2385 { |
1890 CFepLayoutMultiLineIcf* icf = |
2386 CFepLayoutMultiLineIcf* icf = |
1891 static_cast<CFepLayoutMultiLineIcf*>(Control(EPeninputWindowCtrlIdMultiLineICF)); |
2387 static_cast<CFepLayoutMultiLineIcf*>(Control(EPeninputWindowCtrlIdMultiLineICF)); |
1892 if( icf ) |
2388 if( icf ) |
2099 KAknsIIDQsnTextColors, |
2595 KAknsIIDQsnTextColors, |
2100 EAknsCIQsnTextColorsCG64 ); |
2596 EAknsCIQsnTextColorsCG64 ); |
2101 return matchlistcolor; |
2597 return matchlistcolor; |
2102 } |
2598 } |
2103 |
2599 |
|
2600 void CPeninputGenericVkbWindow::SetIndiBubbleImageL( const TInt aImgID1, |
|
2601 const TInt aMaskID1, |
|
2602 const TInt aImgID2, |
|
2603 const TInt aMaskID2 ) |
|
2604 { |
|
2605 MAknsSkinInstance* skininstance = AknsUtils::SkinInstance(); |
|
2606 |
|
2607 CFbsBitmap* bmp1 = NULL; |
|
2608 CFbsBitmap* mask1 = NULL; |
|
2609 |
|
2610 TInt colorIndex = EAknsCIQsnIconColorsCG30; |
|
2611 |
|
2612 AknsUtils::CreateColorIconL(skininstance, |
|
2613 KAknsIIDQsnIconColors, |
|
2614 KAknsIIDQsnIconColors, |
|
2615 colorIndex, |
|
2616 bmp1, |
|
2617 mask1, |
|
2618 AknIconUtils::AvkonIconFileName(), |
|
2619 aImgID1, |
|
2620 aMaskID1, |
|
2621 KRgbGray); |
|
2622 CleanupStack::PushL( bmp1 ); |
|
2623 CleanupStack::PushL( mask1 ); |
|
2624 |
|
2625 AknIconUtils::GetContentDimensions(bmp1, iIndicatorSize); |
|
2626 |
|
2627 CFbsBitmap* bmp2 = NULL; |
|
2628 CFbsBitmap* mask2 = NULL; |
|
2629 AknsUtils::CreateColorIconL(skininstance, |
|
2630 KAknsIIDQsnIconColors, |
|
2631 KAknsIIDQsnIconColors, |
|
2632 colorIndex, |
|
2633 bmp2, |
|
2634 mask2, |
|
2635 AknIconUtils::AvkonIconFileName(), |
|
2636 aImgID2, |
|
2637 aMaskID2, |
|
2638 KRgbGray); |
|
2639 |
|
2640 CleanupStack::PushL( bmp2 ); |
|
2641 CleanupStack::PushL( mask2 ); |
|
2642 |
|
2643 AknIconUtils::GetContentDimensions(bmp2, iIndicatorTextSize); |
|
2644 |
|
2645 TRect boundRect; |
|
2646 if ( iIndiWithText ) |
|
2647 { |
|
2648 boundRect = iLafMgr->IndiIconRectWithText(); |
|
2649 } |
|
2650 else |
|
2651 { |
|
2652 boundRect = iLafMgr->IndiIconRectWithoutText(); |
|
2653 } |
|
2654 |
|
2655 TRect imgrect, textrect; |
|
2656 |
|
2657 CalIndicatorRect(boundRect, imgrect, textrect, EIndiAlignCenter); |
|
2658 AknIconUtils::SetSize(bmp1, imgrect.Size(), EAspectRatioNotPreserved); |
|
2659 AknIconUtils::SetSize(mask1, imgrect.Size(), EAspectRatioNotPreserved); |
|
2660 AknIconUtils::SetSize(bmp2, textrect.Size(), EAspectRatioNotPreserved); |
|
2661 AknIconUtils::SetSize(mask2, textrect.Size(), EAspectRatioNotPreserved); |
|
2662 |
|
2663 CFbsBitmap* bmp3 = AknPenImageUtils::CombineTwoImagesL(bmp1, bmp2, bmp1->DisplayMode()); |
|
2664 CFbsBitmap* mask3 = AknPenImageUtils::CombineTwoImagesL(mask1, mask2, EGray256); |
|
2665 |
|
2666 CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
2667 (Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
2668 icf->MsgBubbleCtrl()->SetBitmapParam( bmp3, mask3, |
|
2669 KAknsIIDQsnFrInputPreviewSideL, |
|
2670 KAknsIIDQsnFrInputPreviewMiddle, |
|
2671 KAknsIIDQsnFrInputPreviewSideR ); |
|
2672 |
|
2673 CleanupStack::PopAndDestroy( mask2 ); |
|
2674 CleanupStack::PopAndDestroy( bmp2 ); |
|
2675 CleanupStack::PopAndDestroy( mask1 ); |
|
2676 CleanupStack::PopAndDestroy( bmp1 ); |
|
2677 } |
|
2678 |
|
2679 void CPeninputGenericVkbWindow::CalIndicatorRect(const TRect& aBoundRect, |
|
2680 TRect& aRealRect1, |
|
2681 TRect& aRealRect2, |
|
2682 TIndicatorAlign aAlign) |
|
2683 { |
|
2684 TInt imgAspectText = iIndicatorTextSize.iWidth / iIndicatorTextSize.iHeight; |
|
2685 TInt imgAspectIndi = iIndicatorSize.iWidth / iIndicatorSize.iHeight; |
|
2686 TSize imgSizeText( aBoundRect.Size().iHeight * imgAspectText, |
|
2687 aBoundRect.Size().iHeight ); |
|
2688 TSize imgSizeIndi( aBoundRect.Size().iHeight * imgAspectIndi, |
|
2689 aBoundRect.Size().iHeight ); |
|
2690 // check if the length of img > bound rect width |
|
2691 TInt nTotalWidth = imgSizeText.iWidth + imgSizeIndi.iWidth; |
|
2692 if( nTotalWidth > aBoundRect.Size().iWidth ) |
|
2693 { |
|
2694 TReal nAspect = (TReal)imgSizeText.iWidth / nTotalWidth; |
|
2695 imgSizeText.iWidth = aBoundRect.Size().iWidth * nAspect; |
|
2696 imgSizeIndi.iWidth = aBoundRect.Size().iWidth - imgSizeText.iWidth; |
|
2697 imgSizeText.iHeight = imgSizeText.iWidth / imgAspectText; |
|
2698 // make sure the height of two rect is equal |
|
2699 imgSizeIndi.iHeight = imgSizeText.iHeight; |
|
2700 } |
|
2701 if( aAlign == EIndiAlignRight ) |
|
2702 { |
|
2703 aRealRect2 = TRect(TPoint( aBoundRect.iBr.iX - imgSizeText.iWidth, aBoundRect.iTl.iY), |
|
2704 imgSizeText); |
|
2705 aRealRect1 = TRect(TPoint(aRealRect2.iTl.iX - imgSizeIndi.iWidth, aRealRect2.iTl.iY), |
|
2706 imgSizeIndi); |
|
2707 } |
|
2708 else if( aAlign == EIndiAlignCenter ) |
|
2709 { |
|
2710 TInt offsetX = ( aBoundRect.Size().iWidth - imgSizeText.iWidth - imgSizeIndi.iWidth ) / 2; |
|
2711 TInt offsetY = ( aBoundRect.Size().iHeight - imgSizeText.iHeight ) / 2; |
|
2712 aRealRect2 = TRect( TPoint( aBoundRect.iBr.iX - imgSizeText.iWidth - offsetX, |
|
2713 aBoundRect.iTl.iY + offsetY), |
|
2714 imgSizeText ); |
|
2715 aRealRect1 = TRect( TPoint(aRealRect2.iTl.iX - imgSizeIndi.iWidth, aRealRect2.iTl.iY), |
|
2716 imgSizeIndi ); |
|
2717 } |
|
2718 else if( aAlign == EIndiAlignLeft ) |
|
2719 { |
|
2720 aRealRect1 = TRect( aBoundRect.iTl, imgSizeIndi ); |
|
2721 aRealRect2 = TRect( TPoint( aRealRect1.iBr.iX, aRealRect1.iTl.iY ), imgSizeText ); |
|
2722 } |
|
2723 } |
|
2724 |
|
2725 void CPeninputGenericVkbWindow::IndiBubbleWithText() |
|
2726 { |
|
2727 CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
2728 (Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
2729 if ( icf ) |
|
2730 { |
|
2731 TAknTextLineLayout textLine = iLafMgr->IndiText(); |
|
2732 TRect bubbleRect = iLafMgr->IndiPaneRectWithText(); |
|
2733 TRect iconRect = iLafMgr->IndiIconRectWithText(); |
|
2734 TSize offset( 60, 6 ); |
|
2735 TSize size( iconRect.Width(), iconRect.Height()); |
|
2736 |
|
2737 icf->MsgBubbleCtrl()->SetRect( bubbleRect ); |
|
2738 icf->MsgBubbleCtrl()->SetIconOffsetAndSize( offset, size ); |
|
2739 icf->MsgBubbleCtrl()->SetTextFormat( textLine ); |
|
2740 icf->MsgBubbleCtrl()->SetTextColorIndex( EAknsCIQsnTextColorsCG67 ); |
|
2741 } |
|
2742 } |
|
2743 |
|
2744 void CPeninputGenericVkbWindow::IndiBubbleWithoutText() |
|
2745 { |
|
2746 CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
2747 (Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
2748 if ( icf ) |
|
2749 { |
|
2750 TRect bubbleRect = iLafMgr->IndiPaneRectWithoutText(); |
|
2751 TRect iconRect = iLafMgr->IndiIconRectWithoutText(); |
|
2752 TSize offset( 0, 6 ); |
|
2753 TSize size( iconRect.Width(), iconRect.Height()); |
|
2754 |
|
2755 icf->MsgBubbleCtrl()->SetRect( bubbleRect ); |
|
2756 icf->MsgBubbleCtrl()->SetIconOffsetAndSize( offset, size ); |
|
2757 } |
|
2758 } |
|
2759 |
|
2760 void CPeninputGenericVkbWindow::SetIndiWithTextFlag( TBool aFlag ) |
|
2761 { |
|
2762 iIndiWithText = aFlag; |
|
2763 } |
|
2764 |
|
2765 void CPeninputGenericVkbWindow::UpdateIndiBubbleL( TUint8* aData ) |
|
2766 { |
|
2767 CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
2768 (Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
2769 |
|
2770 RDesReadStream readStream; |
|
2771 TFepIndicatorInfo indicatorData; |
|
2772 |
|
2773 TPtr8 countPtr( aData, 4*sizeof(TInt), 4*sizeof(TInt) ); |
|
2774 readStream.Open(countPtr); |
|
2775 CleanupClosePushL(readStream); |
|
2776 |
|
2777 indicatorData.iIndicatorImgID = readStream.ReadInt32L(); |
|
2778 indicatorData.iIndicatorMaskID = readStream.ReadInt32L(); |
|
2779 indicatorData.iIndicatorTextImgID = readStream.ReadInt32L(); |
|
2780 indicatorData.iIndicatorTextMaskID = readStream.ReadInt32L(); |
|
2781 |
|
2782 CleanupStack::PopAndDestroy(&readStream); |
|
2783 |
|
2784 if ( indicatorData.iIndicatorImgID != 0 && |
|
2785 indicatorData.iIndicatorMaskID != 0 && |
|
2786 indicatorData.iIndicatorTextImgID != 0 && |
|
2787 indicatorData.iIndicatorTextMaskID != 0 ) |
|
2788 { |
|
2789 SetIndicatorData( indicatorData ); |
|
2790 |
|
2791 if ( icf ) |
|
2792 { |
|
2793 SetIndiBubbleImageL( indicatorData.iIndicatorImgID, |
|
2794 indicatorData.iIndicatorMaskID, |
|
2795 indicatorData.iIndicatorTextImgID, |
|
2796 indicatorData.iIndicatorTextMaskID ); |
|
2797 |
|
2798 TBuf<100> text; |
|
2799 icf->MsgBubbleCtrl()->GetText( text ); |
|
2800 icf->ShowBubble( text, icf->MsgBubbleCtrl()->Rect()); |
|
2801 } |
|
2802 } |
|
2803 } |
2104 // End Of File |
2804 // End Of File |