2 * Copyright (c) 2002 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.
15 * Interface for Setting page carrying CEikEdwin editors
16 * - CAknTextSettingPage: 6 line text editor
17 * - CAknIntegerSettingPage: 1 line integer editor
23 #ifndef __AKNTEXTSETTINGPAGE_H__
24 #define __AKNTEXTSETTINGPAGE_H__
26 // For coecontrol and its observer
32 #include "aknsettingpage.h"
33 #include "aknnumedwin.h"
36 * This class is an intermediate pure virtual class for all setting page classes that host
39 * It implements type-specific access to the hosted editor and common drawing code
41 class CAknEdwinSettingPage : public CAknSettingPage
47 * Common access to the edwin for descendant classes
49 * @return Pointer to contained edwin control
51 IMPORT_C CEikEdwin* TextControl();
55 * Handles pointer events
57 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
61 * Simple constructor depending only on a single resource Id.
63 * @param aSettingPageResourceId Setting Page resource id to use
65 IMPORT_C CAknEdwinSettingPage( TInt ResourceId );
67 * Constructor that allows separate setting page and editor resources
69 * This constructor allows the use of setting page using only the editor resource. Other combinations are also possible
71 * In all cases the number (if supplied i.e. <> 0 ) is used.
73 * Editor Resource Setting Page Resource
74 * present present Both are used (but text & number overridden)
75 * = 0 present Editor resource is used via SP resource (Effectively like the other constructor)
76 * present = 0 Default Avkon SP resource if used + this editor resource
77 * = 0 = 0 uses default resource for both SP and editor. This is OK if:
78 * i) control type is present,
79 * ii) a default resource exists ( OK for text, integer, date, time, duration )
81 * Note: THe first argument is a TDesC* (rather than TDesC&) because the other constructor
82 * cannot initialize such a member without allocation or having an internal dummy buffer.
83 * Note that this buffer must be owned by the client until ExecuteLD has been called.
85 * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other
86 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource
87 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the
88 * specific API for setting them, WILL override resource.
89 * It is assumed that number from resource is very rare. Special text is somewhat more likely.
91 * @param aSettingTitleText Text at top of setting pane; EXTERNALLY OWNED
92 * @param aSettingNumber Number at top left (if present)
93 * @param aControlType Determines the type constructed and how its resource is read
94 * @param aEditorResourceId Editor resource to use in the setting page (if present)
95 * @param aSettingPageResourceId Setting Page to use (if present)
98 IMPORT_C CAknEdwinSettingPage(
99 const TDesC* aSettingTitleText,
102 TInt aEditorResourceId,
103 TInt aSettingPageResourceId );
110 * No implementation of SizeChanged is delivered with this class
113 virtual void SizeChanged() = 0;
116 * Common draw function for laid-out descendent setting pages.
117 * This should not need to be re-implemented as long as the rectangle members are
120 * @param aRect rectangle within which to perform the draw
122 IMPORT_C void Draw(const TRect& aRect) const;
128 IMPORT_C void* ExtensionInterface( TUid aInterface );
132 * New reserved method with this class
135 IMPORT_C virtual void CAknEdwinSettingPage_Reserved_1();
139 * Rectangle within which to layout the edwin. Not drawn
141 TAknLayoutRect iEdwinLayoutRect;
144 * Horizontal shadow rectangle
146 TAknLayoutRect iHorizontalShadow;
149 * Vertical shadow rectangle
151 TAknLayoutRect iVerticalShadow;
154 * Rectangle drawn around the edwin
156 TAknLayoutRect iOutlineFrame;
163 * Implementation of the 6 line textual setting page.
164 * A multi-line edwin is displayed when the setting page is executing.
165 * An externally held text descriptor is altered by user input
167 class CAknTextSettingPageExtension;
169 class CAknTextSettingPage : public CAknEdwinSettingPage
173 // Flags to modify the behaviour of the editor
174 enum TAknTextSettingPageFlags
176 EZeroLengthNotOffered = 0x0, // DEPRECATED. This enum preserved but with value 0
177 EPutCursorAtEnd = 0x0, // DEPRECATED. This is already default so putting flag at beginning is more useful
178 EZeroLengthAllowed = 0x0000001,
179 ENoInitialSelection = 0x0000004, // DEPRECATED and no longer used
180 EPutCursorAtBeginning = 0x0000008, // DEPRECATED and no longer used
181 // Instructs the TextSettingPage not to override any of the Edwin's cursor and selection flags
182 EUseEdwinCursorAndSelectionFlags = 0x0000010, // DEPRECATED
183 EPredictiveTextEntryPermitted = 0x0020
188 * Simple constructor depending only on a single resource Id. Editor resource is given via
189 * the link in the setting page resource.
191 * @param aSettingPageResourceId Setting Page to use (if present)
192 * @param aText Reference to text for editing
193 * @param aTextSettingPageFlags option flags for miscellaneous things
195 IMPORT_C CAknTextSettingPage(TInt aResourceID, TDes& aText, TInt aTextSettingPageFlags = 0 );
197 * Constructor that allows separate setting page and editor resources
199 * This constructor allows the use of setting page using only the editor resource. Other combinations are also possible
201 * In all cases the number (if supplied i.e. <> 0 ) is used.
203 * Editor Resource Setting Page Resource
204 * present present Both are used (but text & number overridden)
205 * = 0 present Editor resource is used via SP resource (Effectively like the other constructor)
206 * present = 0 Default Avkon SP resource if used + this editor resource
207 * = 0 = 0 uses default resource for both SP and editor. This is OK if:
208 * i) control type is present,
209 * ii) a default resource exists ( OK for text, integer, date, time, duration )
211 * Note: The first argument is a TDesC* (rather than TDesC&) because the other constructor
212 * cannot initialize such a member without allocation or having an internal dummy buffer.
213 * Note that this buffer must be owned by the client until ExecuteLD has been called.
215 * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other
216 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource
217 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the
218 * specific API for setting them, WILL override resource.
219 * It is assumed that number from resource is very rare. Special text is somewhat more likely.
221 * @param aSettingTitleText Text at top of setting pane; OWNED EXTERNALLY
222 * @param aSettingNumber Number at top left (if present)
223 * @param aControlType Determines the type constructed and how its resource is read
224 * @param aEditorResourceId Editor resource to use in the setting page (if present)
225 * @param aSettingPageResourceId Setting Page to use (if present)
226 * @param aText Reference to text for editing
227 * @param aTextSettingPageFlags option flags for miscellaneous things
229 IMPORT_C CAknTextSettingPage( const TDesC* aSettingTitleText,
232 TInt aEditorResourceId,
233 TInt aSettingPageResourceId,
235 TInt aTextSettingPageFlags = 0);
238 * 2nd stage construction for this specific type. Calls BaseConstructL in
239 * CAknSettingPage, where the object is constructed from resource.
241 * After calling this method, the contained editor is fully constructed and has its text set,
242 * copied from the aText parameter of the constructor.
244 * This constructor can be called prior to a call to ExecuteLD in order to ensure
245 * construction of the editor if API needs to be called on it prior to setting page launch.
246 * ExecuteLD will not attempt itself to do the construction a 2nd time.
249 IMPORT_C virtual void ConstructL();
253 * Handles pointer events
255 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
263 IMPORT_C virtual ~CAknTextSettingPage();
266 // CAknSettingPage Framework implementations
271 * Called immediately prior to activation of the dialog. Framework routine for derived
275 IMPORT_C virtual void DynamicInitL();
278 * Called when something has changed and the client's object needs to have its text updated
281 IMPORT_C virtual void UpdateSettingL();
284 * Called when the user accepts the text and the setting page is about to be dismissed. The latest value of the
285 * text is written to the client's object
287 IMPORT_C virtual void AcceptSettingL();
290 * Called when the user rejects the setting.
291 * A backed up copy is used to restore the initial value
294 IMPORT_C virtual void RestoreOriginalSettingL();
297 * From MCoeControlObserver:
298 * Acts upon changes in the hosted control's state. If the EUpdateWhenChanged
299 * flag is set, this updates the setting text.
301 * @param aControl The control changing its state (not used)
302 * @param aEventType The type of control event
304 IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType );
308 * Framework method to set the validity of the data
309 * This is called when the data changes.
312 IMPORT_C virtual void CheckAndSetDataValidity();
315 * This method copies out the text from the editor into the client's descriptor
318 IMPORT_C virtual void UpdateTextL();
321 * Update the CBA. This should be called after a control state change in case
322 * there has been a change in data validity.
325 IMPORT_C virtual void UpdateCbaL();
328 * Framework method to determine if it is OK to exit the setting page.
329 * Derived classes may check for valid data before allowing the dismissal of the
334 * @param aAccept ETrue if the user has indicated to accept the setting page; EFalse otherwise
335 * @return TBool a value indicating whether the setting page should be dismissed
337 IMPORT_C virtual TBool OkToExitL(TBool aAccept);
340 * This routine routes the keys to the editor.
341 * However, if the menu is showing, then events are sent to the menu.
343 * @param aKeyEvent event information
344 * @param aType type of event being handled
347 IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType);
351 * Reserved methods for CAknSettingPage hierarchy
354 IMPORT_C virtual void CAknSettingPage_Reserved_1();
355 IMPORT_C virtual void CAknSettingPage_Reserved_2();
365 * This routine is called as part of the set-up of the control. It is the place to put
369 IMPORT_C virtual void SizeChanged();
372 * Writes the internal state of the control and its components to aStream.
373 * Does nothing in release mode.
374 * Designed to be overidden and base called by subclasses.
376 * @param aWriteSteam A connected write stream
378 IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
382 * Reserved method derived from CCoeControl
384 IMPORT_C virtual void Reserved_2();
390 IMPORT_C void* ExtensionInterface( TUid aInterface );
393 * Reserved method from CAknEdwinSettingPage
396 IMPORT_C virtual void CAknEdwinSettingPage_Reserved_1();
399 // restarts timer that blocks Ok button for the period FEP may reject the edit
400 void RestartMultitapWaitTimer();
405 TInt iTextSettingPageFlags;
406 CAknTextSettingPageExtension* iExtension;
411 * Setting page specialized for display of CAknIntegerEdwin
414 class CAknIntegerSettingPage : public CAknEdwinSettingPage
418 // Flags to modify the behaviour of the editor
419 enum TAknIntegerSettingPageFlags
421 EInvalidValueNotOffered = 0x0,
422 EEmptyValueAllowed = 0x0000001,
423 EInvalidValueAllowed = 0x0000002,
424 ENoInitialSelection = 0x0000004,
425 EPutCursorAtBeginning = 0x0000008
429 IMPORT_C CAknIntegerSettingPage(TInt aResourceID, TInt& aValue, TInt aTextSettingPageFlags = 0 );
431 * Constructor that allows separate setting page and editor resources
433 * This constructor allows the use of setting page using only the editor resource. Other combinations are also possible
435 * In all cases the number (if supplied i.e. <> 0 ) is used.
437 * Editor Resource Setting Page Resource
438 * present present Both are used (but text & number overridden)
439 * = 0 present Editor resource is used via SP resource (Effectively like the other constructor)
440 * present = 0 Default Avkon SP resource if used + this editor resource
441 * = 0 = 0 uses default resource for both SP and editor. This is OK if:
442 * i) control type is present,
443 * ii) a default resource exists ( OK for text, integer, date, time, duration )
445 * Note: The first argument is a TDesC* (rather than TDesC&) because the other constructor
446 * cannot initialize such a member without allocation or having an internal dummy buffer.
448 * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other
449 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource
450 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the
451 * specific API for setting them, WILL override resource.
452 * It is assumed that number from resource is very rare. Special text is somewhat more likely.
454 * @param aSettingTitleText Text at top of setting pane; OWNED EXTERNALLY
455 * @param aSettingNumber Number at top left (if present)
456 * @param aControlType Determines the type constructed and how its resource is read
457 * @param aEditorResourceId Editor resource to use in the setting page (if present)
458 * @param aSettingPageResourceId Setting Page to use (if present)
459 * @param aValue Reference to integer value for editing
460 * @param aIntegerSettingPageFlags option flags for miscellaneous things
462 IMPORT_C CAknIntegerSettingPage( const TDesC* aSettingTitleText,
465 TInt aEditorResourceId,
466 TInt aSettingPageResourceId,
468 TInt aIntegerSettingPageFlags = 0);
471 * 2nd stage construction for this specific type. Call BaseConstructL in
472 * CAknSettingPage, where the object is constructed from resource.
474 IMPORT_C virtual void ConstructL();
477 * Type-specific access to the hosted editor
479 * @return CAknIntegerEdwin* pointer to the current hosted editor
481 IMPORT_C CAknIntegerEdwin* IntegerEditorControl();
485 * Handles pointer events
487 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
490 // Framework methods from CAknSettingPage
495 * Called immediately prior to activation of the dialog. Framework routine for derived
499 IMPORT_C virtual void DynamicInitL();
502 * Called when something has changed and the client's object needs to have its value updated
505 IMPORT_C virtual void UpdateSettingL();
509 * Called when the user rejects the setting. A backup copy may need to be restored if UpdateWhenChanged flag was set
512 IMPORT_C virtual void RestoreOriginalSettingL();
515 * Framework method to set the validity of the data
516 * This is called when the data changes.
517 * May be over-ridden to change the validation rules.
520 IMPORT_C virtual void CheckAndSetDataValidity();
523 * This framework method is used to update the contents of the CBA in a custom way.
524 * Some setting page classes implement a degree of validation and will implement this.
525 * Derived classes should ensure that this is being called frequently enough for their
528 IMPORT_C virtual void UpdateCbaL();
531 * Reserved methods for CAknSettingPage hierarchy
534 IMPORT_C virtual void CAknSettingPage_Reserved_1();
535 IMPORT_C virtual void CAknSettingPage_Reserved_2();
540 // From MEikControlObserver
546 * From MCoeControlObserver:
547 * Acts upon changes in the hosted control's state.
549 * The implementation of this class is trivial and should be able to be
550 * safely re-implemented in directly client-derived classes.
551 * For non-base setting page classes, a call to the base class should be made
553 * @param aControl The control changing its state (not used)
554 * @param aEventType The type of control event
556 IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType );
565 * This routine is called as part of the set-up of the control. It is the place to put
569 IMPORT_C virtual void SizeChanged();
573 * Writes the internal state of the control and its components to aStream.
574 * Does nothing in release mode.
575 * Designed to be overidden and base called by subclasses.
577 * @param aWriteSteam A connected write stream
579 IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
583 * Reserved method derived from CCoeControl
585 IMPORT_C virtual void Reserved_2();
591 IMPORT_C void* ExtensionInterface( TUid aInterface );
596 * Reserved method from CAknEdwinSettingPage
599 IMPORT_C virtual void CAknEdwinSettingPage_Reserved_1();
604 TInt iIntegerSettingPageFlags;