581 |
580 |
582 gc.SetPenColor(textColor); |
581 gc.SetPenColor(textColor); |
583 gc.UseFont(iFont); |
582 gc.UseFont(iFont); |
584 |
583 |
585 TSize size=iBorder.SizeDelta(); |
584 TSize size=iBorder.SizeDelta(); |
586 if ( iExtension ) |
585 |
587 { |
586 if ( iRevealSecretText ) |
588 if ( iRevealSecretText ) |
587 { |
589 { |
588 gc.DrawText( iSecCharArr->Des(), iExtension->iTextRect, |
590 gc.DrawText( iSecCharArr->Des(), iExtension->iTextRect, |
589 iAscent, iAlign, 0 ); |
591 iAscent, iAlign, 0 ); |
590 } |
592 } |
591 else |
593 else |
592 { |
594 { |
593 gc.DrawText(iBuf, iExtension->iTextRect, iAscent, iAlign, 0); |
595 gc.DrawText(iBuf, iExtension->iTextRect, iAscent, iAlign, 0); |
594 } |
596 } |
|
597 } |
|
598 |
595 |
599 gc.DiscardFont(); |
596 gc.DiscardFont(); |
600 } |
597 } |
601 |
598 |
602 void CEikSecretEditor::InsertChar() |
599 void CEikSecretEditor::InsertChar() |
624 return ((ret <= 1)? ret : ret-1); // there might be chars wider than asterisk visible. |
621 return ((ret <= 1)? ret : ret-1); // there might be chars wider than asterisk visible. |
625 } |
622 } |
626 |
623 |
627 void CEikSecretEditor::ReportUpdate() |
624 void CEikSecretEditor::ReportUpdate() |
628 { |
625 { |
629 if ( iExtension ) |
626 TRAP_IGNORE ( |
630 { |
627 iExtension->iExtendedInputCapabilities->ReportEventL( |
631 TRAP_IGNORE ( |
628 CAknExtendedInputCapabilities::MAknEventObserver::EControlContentUpdatedInternally, |
632 iExtension->iExtendedInputCapabilities->ReportEventL( |
629 NULL ); |
633 CAknExtendedInputCapabilities::MAknEventObserver::EControlContentUpdatedInternally, |
630 ) |
634 NULL ); |
|
635 ) |
|
636 } |
|
637 } |
631 } |
638 |
632 |
639 EXPORT_C void CEikSecretEditor::AppendCharacterL( TInt aKeyCode ) |
633 EXPORT_C void CEikSecretEditor::AppendCharacterL( TInt aKeyCode ) |
640 { // Replace this if a timer is not needed. |
634 { // Replace this if a timer is not needed. |
641 if (!iTimer) |
635 if (!iTimer) |
788 iExtension->iBgContextSet = ETrue; |
782 iExtension->iBgContextSet = ETrue; |
789 } |
783 } |
790 |
784 |
791 EXPORT_C void CEikSecretEditor::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
785 EXPORT_C void CEikSecretEditor::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
792 { |
786 { |
793 if ( iFepState && iExtension ) |
787 if ( iFepState ) |
794 { |
788 { |
795 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
789 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
796 { |
790 { |
797 if ( iExtension->iFeedback ) |
791 if ( iExtension |
|
792 && iExtension->iFeedback ) |
798 { |
793 { |
799 // tactile feedback is always given on down event |
794 // tactile feedback is always given on down event |
800 iExtension->iFeedback->InstantFeedback( this, ETouchFeedbackEdit ); |
795 iExtension->iFeedback->InstantFeedback( this, ETouchFeedbackEditor ); |
801 } |
796 } |
802 |
797 |
803 CAknExtendedInputCapabilities:: |
798 CAknExtendedInputCapabilities:: |
804 MAknEventObserver::TPointerEventReceivedParams params; |
799 MAknEventObserver::TPointerEventReceivedParams params; |
805 params.iPointerEvent = aPointerEvent; |
800 params.iPointerEvent = aPointerEvent; |
812 ¶ms ); |
807 ¶ms ); |
813 ) |
808 ) |
814 } |
809 } |
815 } |
810 } |
816 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up && |
811 else if ( aPointerEvent.iType == TPointerEvent::EButton1Up && |
817 !iExtension->iDisablePenInput ) |
812 iExtension && !iExtension->iDisablePenInput) |
818 { |
813 { |
819 if ( iExtension->iFeedback ) |
814 if (iExtension && iExtension->iFeedback) |
820 { |
815 { |
821 // Edit feedback is given if PenInput will open on up event |
816 // Edit feedback is given if PenInput will open on up event |
822 iExtension->iFeedback->InstantFeedback( this, |
817 iExtension->iFeedback->InstantFeedback( this, |
823 ETouchFeedbackEdit, |
818 ETouchFeedbackEditor, |
824 ETouchFeedbackVibra, |
819 ETouchFeedbackVibra, |
825 aPointerEvent ); |
820 aPointerEvent ); |
826 } |
821 } |
827 TRAP_IGNORE( |
822 TRAP_IGNORE( |
828 static_cast<CAknEdwinState*>(iFepState)->ReportAknEdStateEventL( |
823 static_cast<CAknEdwinState*>(iFepState)->ReportAknEdStateEventL( |
940 // The status of AknLayoutUtils::Variant() is no longer checked -> Both |
935 // The status of AknLayoutUtils::Variant() is no longer checked -> Both |
941 // European and APAC variants enable EAknEditorFlagLatinInputModesOnly. |
936 // European and APAC variants enable EAknEditorFlagLatinInputModesOnly. |
942 editorState->SetFlags( EAknEditorFlagNoLRNavigation | |
937 editorState->SetFlags( EAknEditorFlagNoLRNavigation | |
943 EAknEditorFlagLatinInputModesOnly | |
938 EAknEditorFlagLatinInputModesOnly | |
944 EAknEditorFlagNoT9 | |
939 EAknEditorFlagNoT9 | |
945 EAknEditorFlagUseSCTNumericCharmap | |
940 EAknEditorFlagUseSCTNumericCharmap ); |
946 EAknEditorFlagAvkonSecretEditor ); |
|
947 |
941 |
948 editorState->SetDefaultInputMode(EAknEditorSecretAlphaInputMode); |
942 editorState->SetDefaultInputMode(EAknEditorSecretAlphaInputMode); |
949 editorState->SetCurrentInputMode(EAknEditorSecretAlphaInputMode); |
943 editorState->SetCurrentInputMode(EAknEditorSecretAlphaInputMode); |
950 editorState->SetPermittedCases(EAknEditorLowerCase|EAknEditorUpperCase); |
944 editorState->SetPermittedCases(EAknEditorLowerCase|EAknEditorUpperCase); |
951 editorState->SetCurrentCase(EAknEditorLowerCase); |
945 editorState->SetCurrentCase(EAknEditorLowerCase); |
1172 |
1135 |
1173 return ret; |
1136 return ret; |
1174 } |
1137 } |
1175 |
1138 |
1176 void CEikSecretEditor::SetCursorFormat() |
1139 void CEikSecretEditor::SetCursorFormat() |
1177 { |
1140 { |
1178 if ( iExtension ) |
1141 iExtension->iCursor.iType = TTextCursor::ETypeRectangle; |
1179 { |
1142 iExtension->iCursor.iFlags = 0; |
1180 iExtension->iCursor.iType = TTextCursor::ETypeRectangle; |
1143 iExtension->iCursor.iHeight = AknLayoutUtils::CursorHeightFromFont( |
1181 iExtension->iCursor.iFlags = 0; |
1144 iFont->FontSpecInTwips() ); |
1182 iExtension->iCursor.iHeight = AknLayoutUtils::CursorHeightFromFont( |
1145 iExtension->iCursor.iAscent = AknLayoutUtils::CursorAscentFromFont( |
1183 iFont->FontSpecInTwips() ); |
1146 iFont->FontSpecInTwips() ); |
1184 iExtension->iCursor.iAscent = AknLayoutUtils::CursorAscentFromFont( |
1147 iExtension->iCursor.iWidth = AknLayoutUtils::CursorWidthFromFont ( |
1185 iFont->FontSpecInTwips() ); |
1148 iFont->FontSpecInTwips() ); |
1186 iExtension->iCursor.iWidth = AknLayoutUtils::CursorWidthFromFont ( |
1149 iExtension->iCursor.iColor = KRgbWhite; |
1187 iFont->FontSpecInTwips() ); |
1150 if ( !iExtension->iWindowSet ) |
1188 iExtension->iCursor.iColor = KRgbWhite; |
1151 { |
1189 if ( !iExtension->iWindowSet ) |
1152 #ifdef RD_UI_TRANSITION_EFFECTS_PHASE2 |
1190 { |
1153 CRedirectionListener* listener = ( CRedirectionListener* ) |
1191 #ifdef RD_UI_TRANSITION_EFFECTS_PHASE2 |
1154 CAknTransitionUtils::GetData( (TInt) this ); |
1192 CRedirectionListener* listener = ( CRedirectionListener* ) |
1155 listener->SetWindows( &( iCoeEnv->RootWin() ), DrawableWindow() ); |
1193 CAknTransitionUtils::GetData( (TInt) this ); |
1156 #else |
1194 listener->SetWindows( &( iCoeEnv->RootWin() ), DrawableWindow() ); |
1157 iExtension->iWg = &( iCoeEnv->RootWin() ); |
1195 #else |
1158 iExtension->iWindow = DrawableWindow(); |
1196 iExtension->iWg = &( iCoeEnv->RootWin() ); |
1159 #endif |
1197 iExtension->iWindow = DrawableWindow(); |
1160 iExtension->iWindowSet = ETrue; |
1198 #endif |
1161 } |
1199 iExtension->iWindowSet = ETrue; |
|
1200 } |
|
1201 } |
|
1202 } |
1162 } |
1203 |
1163 |
1204 TPoint CEikSecretEditor::CursorPos() |
1164 TPoint CEikSecretEditor::CursorPos() |
1205 { |
1165 { |
1206 TInt charsFit = CharsFitOnEditor(); |
1166 TInt charsFit = CharsFitOnEditor(); |
1207 TInt pos = ( iSecCharArr->Length() < charsFit ? |
1167 TInt pos = ( iSecCharArr->Length() < charsFit ? |
1208 iSecCharArr->Length() : charsFit ); |
1168 iSecCharArr->Length() : charsFit ); |
1209 TInt textWidth( iRevealSecretText ? |
1169 TInt textWidth( iRevealSecretText ? |
1210 iFont->TextWidthInPixels( *iSecCharArr ) : |
1170 iFont->TextWidthInPixels( *iSecCharArr ) : |
1211 iFont->CharWidthInPixels( KSecretChar ) * pos ); |
1171 iFont->CharWidthInPixels( KSecretChar ) * pos ); |
1212 TInt x( 0 ); |
1172 TInt x; |
1213 if ( iExtension ) |
1173 if ( iAlign == CGraphicsContext::ELeft ) |
1214 { |
1174 { |
1215 if ( iAlign == CGraphicsContext::ELeft ) |
1175 x = iExtension->iTextRect.iTl.iX + textWidth; |
1216 { |
1176 } |
1217 x = iExtension->iTextRect.iTl.iX + textWidth; |
1177 else if (iAlign == CGraphicsContext::ECenter) |
1218 } |
1178 { |
1219 else if (iAlign == CGraphicsContext::ECenter ) |
1179 x = iExtension->iTextRect.iTl.iX + |
1220 { |
1180 (iExtension->iTextRect.Width() + textWidth) / 2; |
1221 x = iExtension->iTextRect.iTl.iX + |
1181 } |
1222 (iExtension->iTextRect.Width() + textWidth) / 2; |
1182 else |
1223 } |
1183 { |
1224 else |
1184 x = iExtension->iTextRect.iBr.iX; |
1225 { |
|
1226 x = iExtension->iTextRect.iBr.iX; |
|
1227 } |
|
1228 } |
1185 } |
1229 TInt y( Rect().iTl.iY + iAscent ); |
1186 TInt y( Rect().iTl.iY + iAscent ); |
1230 return TPoint( x, y ); |
1187 return TPoint( x, y ); |
1231 } |
1188 } |
1232 |
1189 |
1277 CAknEdwinState* edwinState( static_cast<CAknEdwinState*>( |
1234 CAknEdwinState* edwinState( static_cast<CAknEdwinState*>( |
1278 iFepState ) ); |
1235 iFepState ) ); |
1279 TInt flags( edwinState->Flags() ); |
1236 TInt flags( edwinState->Flags() ); |
1280 if ( aEnable ) |
1237 if ( aEnable ) |
1281 { |
1238 { |
1282 flags |= EAknEditorFlagTextCursorVisible; |
1239 flags &= ~EEikEdwinAvkonDisableCursor; |
1283 } |
1240 } |
1284 else |
1241 else |
1285 { |
1242 { |
1286 flags &= ~EAknEditorFlagTextCursorVisible; |
1243 flags |= EEikEdwinAvkonDisableCursor; |
1287 } |
1244 } |
1288 edwinState->SetFlags( flags ); |
1245 edwinState->SetFlags( flags ); |
1289 } |
1246 } |
1290 } |
1247 } |
1291 |
1248 |
1292 void CEikSecretEditor::UpdateCursor() |
1249 void CEikSecretEditor::UpdateCursor() |
1293 { |
1250 { |
1294 if ( iExtension ) |
1251 #ifdef RD_UI_TRANSITION_EFFECTS_PHASE2 |
1295 { |
1252 CRedirectionListener* listener = ( CRedirectionListener* ) |
1296 #ifdef RD_UI_TRANSITION_EFFECTS_PHASE2 |
1253 CAknTransitionUtils::GetData( (TInt) this ); |
1297 CRedirectionListener* listener = ( CRedirectionListener* ) |
1254 listener->UpdateCursor( iExtension->iCursor ); |
1298 CAknTransitionUtils::GetData( (TInt) this ); |
1255 #else |
1299 listener->UpdateCursor( iExtension->iCursor ); |
1256 if ( iExtension->iCursorEnabled ) |
1300 #else |
1257 { |
1301 if ( iExtension->iCursorEnabled ) |
1258 if ( iExtension->iWindow ) |
1302 { |
1259 { |
1303 if ( iExtension->iWindow ) |
1260 iExtension->iWg->SetTextCursor( *iExtension->iWindow, CursorPos(), |
1304 { |
1261 iExtension->iCursor ); |
1305 iExtension->iWg->SetTextCursor( *iExtension->iWindow, CursorPos(), |
1262 } |
1306 iExtension->iCursor ); |
1263 iExtension->iCursorEnabled = ETrue; |
1307 } |
1264 } |
1308 iExtension->iCursorEnabled = ETrue; |
1265 #endif |
1309 } |
|
1310 #endif |
|
1311 } |
|
1312 } |
1266 } |
1313 |
1267 |
1314 EXPORT_C void CEikSecretEditor::FocusChanged( TDrawNow /*aDrawNow*/ ) |
1268 EXPORT_C void CEikSecretEditor::FocusChanged( TDrawNow /*aDrawNow*/ ) |
1315 { |
1269 { |
1316 EnableCursor( IsFocused() ); |
1270 EnableCursor( IsFocused() ); |