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 "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.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);
259 * add for CAknTextSettingPageExtension to access the api fo CAknTextSettingPage
261 void ProcessPopupStateChangesL();
268 IMPORT_C virtual ~CAknTextSettingPage();
271 // CAknSettingPage Framework implementations
276 * Called immediately prior to activation of the dialog. Framework routine for derived
280 IMPORT_C virtual void DynamicInitL();
283 * Called when something has changed and the client's object needs to have its text updated
286 IMPORT_C virtual void UpdateSettingL();
289 * Called when the user accepts the text and the setting page is about to be dismissed. The latest value of the
290 * text is written to the client's object
292 IMPORT_C virtual void AcceptSettingL();
295 * Called when the user rejects the setting.
296 * A backed up copy is used to restore the initial value
299 IMPORT_C virtual void RestoreOriginalSettingL();
302 * From MCoeControlObserver:
303 * Acts upon changes in the hosted control's state. If the EUpdateWhenChanged
304 * flag is set, this updates the setting text.
306 * @param aControl The control changing its state (not used)
307 * @param aEventType The type of control event
309 IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType );
313 * Framework method to set the validity of the data
314 * This is called when the data changes.
317 IMPORT_C virtual void CheckAndSetDataValidity();
320 * This method copies out the text from the editor into the client's descriptor
323 IMPORT_C virtual void UpdateTextL();
326 * Update the CBA. This should be called after a control state change in case
327 * there has been a change in data validity.
330 IMPORT_C virtual void UpdateCbaL();
333 * Framework method to determine if it is OK to exit the setting page.
334 * Derived classes may check for valid data before allowing the dismissal of the
339 * @param aAccept ETrue if the user has indicated to accept the setting page; EFalse otherwise
340 * @return TBool a value indicating whether the setting page should be dismissed
342 IMPORT_C virtual TBool OkToExitL(TBool aAccept);
345 * This routine routes the keys to the editor.
346 * However, if the menu is showing, then events are sent to the menu.
348 * @param aKeyEvent event information
349 * @param aType type of event being handled
352 IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType);
356 * Reserved methods for CAknSettingPage hierarchy
359 IMPORT_C virtual void CAknSettingPage_Reserved_1();
360 IMPORT_C virtual void CAknSettingPage_Reserved_2();
370 * This routine is called as part of the set-up of the control. It is the place to put
374 IMPORT_C virtual void SizeChanged();
377 * Writes the internal state of the control and its components to aStream.
378 * Does nothing in release mode.
379 * Designed to be overidden and base called by subclasses.
381 * @param aWriteSteam A connected write stream
383 IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
387 * Reserved method derived from CCoeControl
389 IMPORT_C virtual void Reserved_2();
395 IMPORT_C void* ExtensionInterface( TUid aInterface );
398 * Reserved method from CAknEdwinSettingPage
401 IMPORT_C virtual void CAknEdwinSettingPage_Reserved_1();
404 // restarts timer that blocks Ok button for the period FEP may reject the edit
405 void RestartMultitapWaitTimer();
410 TInt iTextSettingPageFlags;
411 CAknTextSettingPageExtension* iExtension;
416 * Setting page specialized for display of CAknIntegerEdwin
419 class CAknIntegerSettingPage : public CAknEdwinSettingPage
423 // Flags to modify the behaviour of the editor
424 enum TAknIntegerSettingPageFlags
426 EInvalidValueNotOffered = 0x0,
427 EEmptyValueAllowed = 0x0000001,
428 EInvalidValueAllowed = 0x0000002,
429 ENoInitialSelection = 0x0000004,
430 EPutCursorAtBeginning = 0x0000008
434 IMPORT_C CAknIntegerSettingPage(TInt aResourceID, TInt& aValue, TInt aTextSettingPageFlags = 0 );
436 * Constructor that allows separate setting page and editor resources
438 * This constructor allows the use of setting page using only the editor resource. Other combinations are also possible
440 * In all cases the number (if supplied i.e. <> 0 ) is used.
442 * Editor Resource Setting Page Resource
443 * present present Both are used (but text & number overridden)
444 * = 0 present Editor resource is used via SP resource (Effectively like the other constructor)
445 * present = 0 Default Avkon SP resource if used + this editor resource
446 * = 0 = 0 uses default resource for both SP and editor. This is OK if:
447 * i) control type is present,
448 * ii) a default resource exists ( OK for text, integer, date, time, duration )
450 * Note: The first argument is a TDesC* (rather than TDesC&) because the other constructor
451 * cannot initialize such a member without allocation or having an internal dummy buffer.
453 * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other
454 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource
455 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the
456 * specific API for setting them, WILL override resource.
457 * It is assumed that number from resource is very rare. Special text is somewhat more likely.
459 * @param aSettingTitleText Text at top of setting pane; OWNED EXTERNALLY
460 * @param aSettingNumber Number at top left (if present)
461 * @param aControlType Determines the type constructed and how its resource is read
462 * @param aEditorResourceId Editor resource to use in the setting page (if present)
463 * @param aSettingPageResourceId Setting Page to use (if present)
464 * @param aValue Reference to integer value for editing
465 * @param aIntegerSettingPageFlags option flags for miscellaneous things
467 IMPORT_C CAknIntegerSettingPage( const TDesC* aSettingTitleText,
470 TInt aEditorResourceId,
471 TInt aSettingPageResourceId,
473 TInt aIntegerSettingPageFlags = 0);
476 * 2nd stage construction for this specific type. Call BaseConstructL in
477 * CAknSettingPage, where the object is constructed from resource.
479 IMPORT_C virtual void ConstructL();
482 * Type-specific access to the hosted editor
484 * @return CAknIntegerEdwin* pointer to the current hosted editor
486 IMPORT_C CAknIntegerEdwin* IntegerEditorControl();
490 * Handles pointer events
492 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
495 // Framework methods from CAknSettingPage
500 * Called immediately prior to activation of the dialog. Framework routine for derived
504 IMPORT_C virtual void DynamicInitL();
507 * Called when something has changed and the client's object needs to have its value updated
510 IMPORT_C virtual void UpdateSettingL();
514 * Called when the user rejects the setting. A backup copy may need to be restored if UpdateWhenChanged flag was set
517 IMPORT_C virtual void RestoreOriginalSettingL();
520 * Framework method to set the validity of the data
521 * This is called when the data changes.
522 * May be over-ridden to change the validation rules.
525 IMPORT_C virtual void CheckAndSetDataValidity();
528 * This framework method is used to update the contents of the CBA in a custom way.
529 * Some setting page classes implement a degree of validation and will implement this.
530 * Derived classes should ensure that this is being called frequently enough for their
533 IMPORT_C virtual void UpdateCbaL();
536 * Reserved methods for CAknSettingPage hierarchy
539 IMPORT_C virtual void CAknSettingPage_Reserved_1();
540 IMPORT_C virtual void CAknSettingPage_Reserved_2();
545 // From MEikControlObserver
551 * From MCoeControlObserver:
552 * Acts upon changes in the hosted control's state.
554 * The implementation of this class is trivial and should be able to be
555 * safely re-implemented in directly client-derived classes.
556 * For non-base setting page classes, a call to the base class should be made
558 * @param aControl The control changing its state (not used)
559 * @param aEventType The type of control event
561 IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType );
570 * This routine is called as part of the set-up of the control. It is the place to put
574 IMPORT_C virtual void SizeChanged();
578 * Writes the internal state of the control and its components to aStream.
579 * Does nothing in release mode.
580 * Designed to be overidden and base called by subclasses.
582 * @param aWriteSteam A connected write stream
584 IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
588 * Reserved method derived from CCoeControl
590 IMPORT_C virtual void Reserved_2();
596 IMPORT_C void* ExtensionInterface( TUid aInterface );
601 * Reserved method from CAknEdwinSettingPage
604 IMPORT_C virtual void CAknEdwinSettingPage_Reserved_1();
609 TInt iIntegerSettingPageFlags;