00001 // EIKSECED.H 00002 // 00003 // Copyright (c) 1997-1999 Symbian Ltd. All rights reserved. 00004 // 00005 00006 #if !defined(__EIKSECED_H__) 00007 #define __EIKSECED_H__ 00008 00009 #if !defined(__EIKDEF_H__) 00010 #include <eikdef.h> 00011 #endif 00012 00013 #if !defined(__EIKBCTRL_H__) 00014 #include <eikbctrl.h> 00015 #endif 00016 00017 #include <fepbase.h> 00018 00019 // FORWARD DECLARATIONS 00020 class TResourceReader; 00021 class CEikSecretEditorExtension; 00022 class MAknsControlContext; 00023 00035 class CEikSecretEditor : public CEikBorderedControl, public MCoeFepAwareTextEditor, public MCoeFepAwareTextEditor_Extension1 00036 { 00037 public: 00038 enum { 00039 EMaxSecEdBufLength = 32, 00047 EMaxSecEdSecArrayLength = 255 00048 }; 00049 public: 00060 IMPORT_C CEikSecretEditor(); 00061 00065 IMPORT_C ~CEikSecretEditor(); 00066 00067 public: // from CCoeControl 00080 IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aReader); 00081 00089 IMPORT_C virtual TSize MinimumSize(); 00090 00100 IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); 00101 00109 IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u 00110 00121 IMPORT_C virtual void HandleResourceChange(TInt aType); // not available before Release 005u 00122 00131 IMPORT_C virtual TCoeInputCapabilities InputCapabilities() const; 00132 00140 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); 00141 00142 public: // specific 00154 IMPORT_C void GetText(TDes& aText) const; 00155 00161 IMPORT_C virtual void SetText(const TDesC& aText); 00162 00169 IMPORT_C virtual void InitializeDisplay(TInt aNumberOfChars); 00170 00174 IMPORT_C void Reset(); 00175 00187 IMPORT_C void SetMaxLength(TInt aMaxLength); 00188 00195 IMPORT_C void AknSetFont(const CFont &aFont); 00196 00202 IMPORT_C void AknSetAlignment(const CGraphicsContext::TTextAlign &aAlign); 00203 00215 IMPORT_C void SetDefaultInputMode(TInt aInputMode); 00216 00222 IMPORT_C TInt MaxLength() const; 00223 00229 IMPORT_C const TDesC& Buffer() const; 00230 00236 IMPORT_C void RevealSecretText( TBool aReveal ); 00237 00249 IMPORT_C void SetSkinBackgroundControlContextL( MAknsControlContext* aContext ); 00250 00251 protected: // inherited 00252 // methods to enable CAknNumericSecretEditor to inherit from CEikSecretEditor 00258 IMPORT_C virtual void AppendCharacterL( TInt aKeyCode ); 00259 00263 IMPORT_C virtual void Update(); 00264 00265 void InsertSecretChar(); 00266 00273 IMPORT_C void SizeChanged(); 00274 00275 private: // virtual 00276 IMPORT_C virtual void Draw(const TRect& aRect) const; 00277 00278 private: // from MCoeFepAwareTextEditor 00279 IMPORT_C void StartFepInlineEditL(const TDesC& aInitialInlineText, TInt aPositionOfInsertionPointInInlineText, TBool aCursorVisibility, const MFormCustomDraw* aCustomDraw, MFepInlineTextFormatRetriever& aInlineTextFormatRetriever, MFepPointerEventHandlerDuringInlineEdit& aPointerEventHandlerDuringInlineEdit); 00280 IMPORT_C void UpdateFepInlineTextL(const TDesC& aNewInlineText, TInt aPositionOfInsertionPointInInlineText); 00281 IMPORT_C void SetInlineEditingCursorVisibilityL(TBool aCursorVisibility); 00282 IMPORT_C void CancelFepInlineEdit(); 00283 IMPORT_C TInt DocumentLengthForFep() const; 00284 IMPORT_C TInt DocumentMaximumLengthForFep() const; 00285 IMPORT_C void SetCursorSelectionForFepL(const TCursorSelection& aCursorSelection); 00286 IMPORT_C void GetCursorSelectionForFep(TCursorSelection& aCursorSelection) const; 00287 IMPORT_C void GetEditorContentForFep(TDes& aEditorContent, TInt aDocumentPosition, TInt aLengthToRetrieve) const; 00288 IMPORT_C void GetFormatForFep(TCharFormat& aFormat, TInt aDocumentPosition) const; 00289 IMPORT_C void GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLine, TInt& aHeight, TInt& aAscent, TInt aDocumentPosition) const; 00290 IMPORT_C void DoCommitFepInlineEditL(); 00291 IMPORT_C MCoeFepAwareTextEditor_Extension1* Extension1(TBool& aSetToTrue); 00292 IMPORT_C void SetStateTransferingOwnershipL(CState* aState, TUid aTypeSafetyUid); 00293 IMPORT_C CState* State(TUid aTypeSafetyUid); // this function does *not* transfer ownership 00294 00295 private: 00296 void OverflowAlert(); 00297 00298 private: // from CCoeControl 00299 IMPORT_C void Reserved_1(); 00300 IMPORT_C void Reserved_2(); 00301 private: 00305 IMPORT_C void* ExtensionInterface( TUid aInterface ); 00306 private: // from MCoeFepAwareTextEditor 00307 IMPORT_C void MCoeFepAwareTextEditor_Reserved_2(); 00308 private: // from MCoeFepAwareTextEditor_Extension1 00309 IMPORT_C virtual void MCoeFepAwareTextEditor_Extension1_Reserved_2(); 00310 IMPORT_C virtual void MCoeFepAwareTextEditor_Extension1_Reserved_3(); 00311 IMPORT_C virtual void MCoeFepAwareTextEditor_Extension1_Reserved_4(); 00312 00313 private: // specific 00314 void InsertChar(); 00315 TInt CharsFitOnEditor() const; 00316 IMPORT_C virtual MCoeFepAwareTextEditor_Extension1::CState* CreateFepStateL(); 00317 void CalculateAscent(); 00318 private: 00319 typedef TBuf<EMaxSecEdBufLength> TSecEdBuf; 00320 protected: 00321 HBufC* iSecCharArr; 00322 TInt iSecPos; 00323 TSecEdBuf iBuf; 00324 TInt iMaxLen; 00325 TInt iCharWidth; 00326 TInt iAscent; 00327 TBool iBufferFull; 00328 00329 public: // timer methods 00330 void StartTimer(); 00331 private: 00332 static TInt TimerCallback(TAny* aThis); 00333 private: 00334 CPeriodic* iTimer; 00335 const CFont *iFont; 00336 CGraphicsContext::TTextAlign iAlign; 00337 TBool iRevealSecretText; // holds the state of whether text is shown or not 00338 CEikSecretEditorExtension* iExtension; 00339 CState* iFepState; 00340 HBufC* iInlineEditText; 00341 00342 public: 00350 IMPORT_C void SetSkinTextColorL(TInt aAknSkinIDForTextColor, TInt aAknSkinIdForBgColor=KErrNotFound); 00351 }; 00352 00353 #endif