Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
2 * Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #if !defined(__EIKSECED_H__)
20 #define __EIKSECED_H__
22 #if !defined(__EIKDEF_H__)
26 #if !defined(__EIKBCTRL_H__)
32 // FORWARD DECLARATIONS
33 class TResourceReader;
34 class CEikSecretEditorExtension;
35 class MAknsControlContext;
38 * A single line text editor which displays an asterisk for every
41 * The editor is suitable for editing confidential information such as
42 * a password. You can paste to the editor but no other clipboard
43 * functions are available.
45 * The editor has an associated resource struct SECRETED and control
46 * factory identifier EEikCtSecretEd.
48 class CEikSecretEditor : public CEikBorderedControl, public MCoeFepAwareTextEditor, public MCoeFepAwareTextEditor_Extension1
53 * The maximum number of characters in the displayed
56 EMaxSecEdBufLength = 32,
58 * Indicates the maximum number of characters which may be entered into
61 * Editors additionally have a maximum length, see SetMaxLength(),
62 * which must not exceed this value.
64 EMaxSecEdSecArrayLength = 255
68 * Settable features for Secret Editor. See SetFeature().
74 /** Disables VKB. Non-zero (or ETrue) parameter disables VKB,
75 0 (or EFalse) enables VKB. When disabled,
76 editor doesn't request PenInputServer to start VKB */
83 * Default constructor.
85 * This constructs a editor with a border type of
86 * TGulBorder::ESingleGray.
88 * This function should be used as the first stage in two stage
89 * construction, followed by a call to either ConstructFromResourceL() or
92 IMPORT_C CEikSecretEditor();
97 IMPORT_C ~CEikSecretEditor();
99 public: // from CCoeControl
101 * Second-phase construction from a resource file.
103 * This function reads the number of characters which may be entered by
104 * the user into the editor from a SECRETED resource. You should call
105 * either this function or SetMaxLength() before drawing the editor and
106 * offering key events, otherwise the editor will not accept text input.
108 * @param aReader A resource file reader.
109 * @panic EIKCTL 13 If the value read from resource is greater than
112 IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aReader);
115 * Gets the editor's minimum size in pixels.
117 * Overrides CCoeControl::MinimumSize().
119 * @return The editor's minimum size in pixels.
121 IMPORT_C virtual TSize MinimumSize();
124 * Responds to key presses.
126 * Overrides CCoeControl::OfferKeyEventL().
128 * @param aKeyEvent The key event.
129 * @param aType Not used.
130 * @return Indicates whether or not the key event was consumed.
132 IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
135 * Gets the list of logical colours used to draw the editor.
137 * Overrides CCoeControl::GetColorUseListL().
139 * @param aColorUseList On return, the colour list.
141 IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u
144 * Handles a change to the editor's resources.
146 * The types of resources handled are those which are shared across the
147 * environment, e.g. colours or fonts.
149 * Calls CEikBorderedControl::HandleResourceChange().
151 * @param aType A message UID value.
153 IMPORT_C virtual void HandleResourceChange(TInt aType); // not available before Release 005u
156 * Gets the editor's input capabilities.
158 * Overrides CCoeControl::InputCapabilities().
160 * If this function is overrided in a subclass, the subclass should
161 * obtain this class' InputCapabilities' object provider through
162 * TCoeInputCapabilities::ObjectProvider() and set that as a part of
163 * the subclass' InputCapabilities object provider chain to ensure
164 * maximum functionality.
166 * @return The editor's input capabilities. The ESecretText and
167 * ENavigation flags are set.
169 IMPORT_C virtual TCoeInputCapabilities InputCapabilities() const;
172 * From @c CCoeControl.
174 * Handles pointer events.
176 * @param aPointerEvent The pointer event.
178 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
180 IMPORT_C void FocusChanged( TDrawNow aDrawNow );
184 * Gets the editor's text string.
186 * This may be called from the container class when the model data
187 * should be updated according to the text contained in the editor.
189 * @param aText On return, the editor's text. This is what is stored in
190 * memory, not what is displayed. This descriptor must be capable of
191 * holding the maxlength of the internal buffer.
194 IMPORT_C void GetText(TDes& aText) const;
197 * Set the contents of the character buffer.
199 * @param aText The text to be set as the contents of the character buffer.
201 IMPORT_C virtual void SetText(const TDesC& aText);
204 * Set the initial display of the secret editor.
205 * Calling this routine doesn't affect the actual character buffer.
207 * @param aNumberOfCharacters Must be >=0 and <= EMaxSecEdBufLength.
209 IMPORT_C virtual void InitializeDisplay(TInt aNumberOfChars);
212 * Clears the editor's text string removing any trace of it from memory.
214 IMPORT_C void Reset();
217 * Set the maximum length of the editor.
219 * This is the maximum number of characters which may be entered by the
220 * user into the editor.
222 * @param aMaxLength The maximum number of characters which may be
224 * @panic EIKCTL 13 If aMaxLength is greater than EMaxSecEdLength.
227 IMPORT_C void SetMaxLength(TInt aMaxLength);
230 * Sets the font that is used to draw the text in this editor.
232 * @param aFont A pointer to a CFont object that is used to draw the
233 * text in this editor.
235 IMPORT_C void AknSetFont(const CFont &aFont);
238 * Sets the alignment of the editor.
240 * @param aAlign The editor's alignment.
242 IMPORT_C void AknSetAlignment(const CGraphicsContext::TTextAlign &aAlign);
245 * Changes default and current input mode of a secret editor. By default
246 * input mode in the secret editor is alpha input mode
247 * (EAknEditorSecretAlphaInputMode). By using this method the default input
248 * mode can be changed to numeric input mode (EAknEditorNumericInputMode).
251 * @param aInputMode Default input mode in the secret editor.
252 * Only EAknEditorNumericInputMode and EAknEditorSecretAlphaInputMode
255 IMPORT_C void SetDefaultInputMode(TInt aInputMode);
258 * Returns the current maximum length of the internal buffer.
260 * @return the current maximum length of the internal buffer.
262 IMPORT_C TInt MaxLength() const;
265 * Access method for getting at the buffer without copying out from it.
267 * @return Non-modifiable descriptor reference to the contained buffer.
269 IMPORT_C const TDesC& Buffer() const;
272 * Method to reveal (or hide) the currently input editor contents.
274 * @param aReveal - if ETrue, reveals the contents; if EFalse hides them.
276 IMPORT_C void RevealSecretText( TBool aReveal );
279 * Method for enabling/disabling special character table from
280 * the secret editor. By default the SCT is enabled in the secret
282 * ConstructFromResourceL need to be called before this method.
286 * @param aEnable Boolean value for enabling or disabling the special
289 IMPORT_C void EnableSCT( TBool aEnable = ETrue );
292 * Set the skin control context to be used with this secret editor. If this
293 * method is not called, the control context available through MOP (if any)
294 * is used. If @c NULL control context is specified, no control context is
299 * @param aContext The background control context used to draw the
300 * background of this editor or @c NULL. Ownership is not transferred.
302 IMPORT_C void SetSkinBackgroundControlContextL( MAknsControlContext* aContext );
304 // for cursor support
306 void EnableCursor( TBool aEnable );
308 protected: // inherited
309 // methods to enable CAknNumericSecretEditor to inherit from CEikSecretEditor
311 * Appends a character to the editor.
313 * @param aKeyCode The character to append.
315 IMPORT_C virtual void AppendCharacterL( TInt aKeyCode );
318 * Updates and redraws the editor.
320 IMPORT_C virtual void Update();
322 void InsertSecretChar();
325 * Responds to changes to the size and position of
326 * the contents of this control.
328 * Overrides CCoeControl::SizeChanged().
330 IMPORT_C void SizeChanged();
333 IMPORT_C virtual void Draw(const TRect& aRect) const;
335 private: // from MCoeFepAwareTextEditor
336 IMPORT_C void StartFepInlineEditL(const TDesC& aInitialInlineText, TInt aPositionOfInsertionPointInInlineText, TBool aCursorVisibility, const MFormCustomDraw* aCustomDraw, MFepInlineTextFormatRetriever& aInlineTextFormatRetriever, MFepPointerEventHandlerDuringInlineEdit& aPointerEventHandlerDuringInlineEdit);
337 IMPORT_C void UpdateFepInlineTextL(const TDesC& aNewInlineText, TInt aPositionOfInsertionPointInInlineText);
338 IMPORT_C void SetInlineEditingCursorVisibilityL(TBool aCursorVisibility);
339 IMPORT_C void CancelFepInlineEdit();
340 IMPORT_C TInt DocumentLengthForFep() const;
341 IMPORT_C TInt DocumentMaximumLengthForFep() const;
342 IMPORT_C void SetCursorSelectionForFepL(const TCursorSelection& aCursorSelection);
343 IMPORT_C void GetCursorSelectionForFep(TCursorSelection& aCursorSelection) const;
344 IMPORT_C void GetEditorContentForFep(TDes& aEditorContent, TInt aDocumentPosition, TInt aLengthToRetrieve) const;
345 IMPORT_C void GetFormatForFep(TCharFormat& aFormat, TInt aDocumentPosition) const;
346 IMPORT_C void GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLine, TInt& aHeight, TInt& aAscent, TInt aDocumentPosition) const;
347 IMPORT_C void DoCommitFepInlineEditL();
348 IMPORT_C MCoeFepAwareTextEditor_Extension1* Extension1(TBool& aSetToTrue);
349 IMPORT_C void SetStateTransferingOwnershipL(CState* aState, TUid aTypeSafetyUid);
350 IMPORT_C CState* State(TUid aTypeSafetyUid); // this function does *not* transfer ownership
353 void OverflowAlert();
355 private: // from CCoeControl
356 IMPORT_C void Reserved_1();
357 IMPORT_C void Reserved_2();
362 IMPORT_C void* ExtensionInterface( TUid aInterface );
363 private: // from MCoeFepAwareTextEditor
364 IMPORT_C void MCoeFepAwareTextEditor_Reserved_2();
365 private: // from MCoeFepAwareTextEditor_Extension1
366 IMPORT_C virtual void MCoeFepAwareTextEditor_Extension1_Reserved_2();
367 IMPORT_C virtual void MCoeFepAwareTextEditor_Extension1_Reserved_3();
368 IMPORT_C virtual void MCoeFepAwareTextEditor_Extension1_Reserved_4();
372 TInt CharsFitOnEditor() const;
373 IMPORT_C virtual MCoeFepAwareTextEditor_Extension1::CState* CreateFepStateL();
374 void CalculateAscent();
377 // for cursor support
378 void SetCursorFormat();
380 void InitCRedirectionListenerL();
383 typedef TBuf<EMaxSecEdBufLength> TSecEdBuf;
393 public: // timer methods
396 static TInt TimerCallback(TAny* aThis);
400 CGraphicsContext::TTextAlign iAlign;
401 TBool iRevealSecretText; // holds the state of whether text is shown or not
402 CEikSecretEditorExtension* iExtension;
404 HBufC* iInlineEditText;
408 * Sets the colors for text and background as skin IDs.
411 * @param aAknSkinIDForTextColor ID for text color.
412 * @param aAknSkinIDForBgColor ID for background color.
414 IMPORT_C void SetSkinTextColorL(TInt aAknSkinIDForTextColor, TInt aAknSkinIdForBgColor=KErrNotFound);
417 * Used for setting various flag-like features to the editor.
419 * @param aFeatureId The feature id, see TFeatureId
420 * @param aFeatureParam The feature parameter. This is usually
421 * enabled or disabled. For more info, see
422 * the feature documentation in TFeatureId.
423 * @return KErrNone if the feature modification succeeded
426 IMPORT_C TInt SetFeature( TInt aFeatureId, TInt aFeatureParam );
429 * Used to getting feature statuses.
431 * @param aFeatureId The feature id, see TFeatureId
432 * @param aFeatureParam On return, the parameter for the feature
433 * (usually non-zero for an enabled feature
434 * and zero for disabled)
435 * @return KErrNone if the feature is supported and fetching its value
439 IMPORT_C TInt GetFeature( TInt aFeatureId, TInt& aFeatureParam ) const;
442 * Used for checking if the editor supports a feature.
443 * For features, see TFeatureId.
446 * @return ETrue if the feature is supported
449 IMPORT_C TBool SupportsFeature( TInt aFeatureId ) const;