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 * Header file for Setting page implementations for Date, Time, duration
21 #ifndef __AKNMFNESETTINGPAGE_H__
22 #define __AKNMFNESETTINGPAGE_H__
29 #include <aknsettingpage.h>
32 // FORWARD DECLARATIONS
37 * This class is used as the base for the date, time, duration and Ip editor
38 * setting page types. It performs all the layout.
41 class CAknMfneSettingPage : public CAknSettingPage
47 * Handles pointer events
49 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
53 IMPORT_C virtual ~CAknMfneSettingPage();
57 * Constructor using purely Setting page resource
59 * @param aResourceId Setting page resource Id
61 IMPORT_C CAknMfneSettingPage(TInt ResourceId );
63 * Constructor that allows separate setting page and editor resources
65 * @param aSettingTitleText Text at top of setting pane ; Externally owned
66 * @param aSettingNumber Number at top left (if present)
67 * @param aControlType Determines the type constructed and how its
69 * @param aEditorResourceId Editor resource to use in the setting page
72 IMPORT_C CAknMfneSettingPage( const TDesC* aSettingTitleText,
75 TInt aEditorResourceId,
76 TInt aSettingPageResourceId );
80 * Framework method called when the control needs to be re-laid out
83 IMPORT_C virtual void SizeChanged();
86 * Draws the control. Framework method
88 IMPORT_C void Draw(const TRect& aRect) const;
91 * Type-specific access to control
93 IMPORT_C CEikMfne* Mfne() const;
96 * Implementation of of validity framework method for mfnes.
97 * Checks if the current focused field in the mfne is valid and sets the
98 * setting page validity accordingly.
100 * This method is called in order for the softkeys to be updated
102 IMPORT_C void CheckAndSetDataValidity();
105 * From MCoeControlObserver:
106 * Acts upon changes in the hosted control's state.
108 * This observer method performs
109 * - Updates the value if EUpdateWhenChanged is the setting page's update
111 * - updates CBA labels depending on the data validity
113 * @param aControl The control changing its state (not used)
114 * @param aEventType The type of control event
116 IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl,
117 TCoeEvent aEventType);
121 * 2nd stage construction. This creates the editing buttons in
122 * touch enabled builds.
125 IMPORT_C virtual void ConstructL();
128 * Standard CCoeControl routine to return the number of componentn controls
130 * @param aIndex index at which to return control
132 IMPORT_C TInt CountComponentControls() const;
135 * Standard CCoeControl routine to return the control at a given index
137 * @param aIndex index at which to return control
139 IMPORT_C CCoeControl* ComponentControl(TInt anIndex) const;
143 // Buttons for modifying the value of the active MFNE field with stylus.
144 // The derived classes which require the buttons, must call this class'
145 // ConstructL function in their second phase constructor. This class
146 // takes care of the button positioning and functionality.
147 CAknButton* iIncreaseValueButton;
148 CAknButton* iDecreaseValueButton;
154 IMPORT_C void* ExtensionInterface( TUid aInterface );
157 // Layout information is stored here and not in the derived classes
158 TAknLayoutRect iMfneLayoutRect;
159 TAknLayoutRect iHorizontalShadow;
160 TAknLayoutRect iVerticalShadow;
161 TAknLayoutRect iOutlineFrame;
170 * This class is used for entering Dates in a "Code" setting page
173 class CAknDateSettingPage : public CAknMfneSettingPage
178 * Constructor using purely Setting page resource
180 * @param aResourceId Setting page resource Id
181 * @param aDateValue Reference to a date value set to the initial
184 IMPORT_C CAknDateSettingPage(
189 * Constructor that allows separate setting page and editor resources
191 * This constructor allows the use of setting page using only the editor
192 * resource. Other combinations are also possible
194 * In all cases the number (if supplied i.e. <> 0 ) is used.
196 * Editor Resource Setting Page Resource
197 * present present Both are used
199 * & number overridden)
200 * = 0 present Editor resource is used
202 * (Effectively like the
204 * present = 0 Default Avkon SP
205 * resource if used + this
207 * = 0 = 0 uses default resource
208 * for both SP and editor.
210 * i) control type is present,
211 * ii) a default resource exists ( OK for text, integer, date, time,
214 * Note: The first argument is a TDesC* (rather than TDesC&) because the
215 * other constructor cannot initialize such a member without allocation or
216 * having an internal dummy buffer.
217 * Note that this descriptor must be owned by the client at least until the
220 * Rules for text and numbers: The rules are the same for both:
221 * (non-zero length) text or number other than
222 * EAknSettingPageNoOrdinalDisplayed if given in this constructor will not
223 * override resource (unless that is zero length or
224 * EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number
225 * given via the specific API for setting them, WILL override resource.
226 * It is assumed that number from resource is very rare. Special text is
227 * somewhat more likely.
229 * @param aSettingTitleText Text at top of setting pane; OWNED EXTERNALLY
230 * @param aSettingNumber Number at top left (if present)
231 * @param aControlType Determines the type constructed and how its
233 * @param aEditorResourceId Editor resource to use in the setting page
235 * @param aSettingPageResourceId Setting Page to use (if present)
236 * @param aDateValue reference to date
238 IMPORT_C CAknDateSettingPage(
239 const TDesC* aSettingTitleText,
242 TInt aEditorResourceId,
243 TInt aSettingPageResourceId,
249 * 2nd stage construction. This uses stored values from the conststuctor
250 * to allocate the required aggregate objects, and then set the Date value.
253 IMPORT_C virtual void ConstructL();
256 * Type-specific access to the editor
258 * @return the hosted editor
260 IMPORT_C CEikDateEditor* DateEditor();
265 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
271 IMPORT_C virtual ~CAknDateSettingPage();
274 * This framework method is called when the editor changes its value and the
275 * mode of execution of the setting page is a continuous update mode.
278 IMPORT_C virtual void UpdateSettingL();
281 * Called when the user has accepted the value.
282 * The external value is updated once again, in case we were not in
283 * continuous update mode.
284 * A specific observer event is generated for the observer to say that the
287 IMPORT_C virtual void AcceptSettingL();
290 * The backup value, stored at construction time, is re-loaded into the
291 * referenced Date. An event is sent to the observer saying that the event
294 IMPORT_C virtual void RestoreOriginalSettingL();
297 // CoeControl Framework and reserved methods
302 * Writes the internal state of the control and its components to aStream.
303 * Does nothing in release mode.
304 * Designed to be overidden and base called by subclasses.
306 * @param aWriteSteam A connected write stream
308 IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
312 * Reserved method derived from CCoeControl
314 IMPORT_C virtual void Reserved_2();
320 IMPORT_C void* ExtensionInterface( TUid aInterface );
323 * New reserved methods for CAknSettingPage hierarchy
326 IMPORT_C virtual void CAknSettingPage_Reserved_1();
327 IMPORT_C virtual void CAknSettingPage_Reserved_2();
331 TTime iBackupDateValue;
336 * This class is used for entering Times in a "Code" setting page
339 class CAknTimeSettingPage : public CAknMfneSettingPage
343 * Constructor using purely Setting page resource
345 * @param aResourceId Setting page resource Id
346 * @param aTimeValue Reference to a time value for the initial time
348 IMPORT_C CAknTimeSettingPage(
353 * Constructor that allows separate setting page and editor resources
355 * This constructor allows the use of setting page using only the editor
356 * resource. Other combinations are also possible
358 * In all cases the number (if supplied i.e. <> 0 ) is used.
360 * Editor Resource Setting Page Resource
361 * present present Both are used (but text
362 * & number overridden)
363 * = 0 present Editor resource is used
365 * (Effectively like the
367 * present = 0 Default Avkon SP
368 * resource if used + this
370 * = 0 = 0 uses default resource
371 * for both SP and editor.
373 * i) control type is present,
374 * ii) a default resource exists ( OK for text, integer,
375 * date, time, duration )
377 * Note: The first argument is a TDesC* (rather than TDesC&) because the
378 * other constructor cannot initialize such a member without allocation or
379 * having an internal dummy buffer.
380 * Note that this descriptor must be owned by the client at least until the
383 * Rules for text and numbers: The rules are the same for both:
384 * (non-zero length) text or number other than
385 * EAknSettingPageNoOrdinalDisplayed if given in this constructor will not
386 * override resource (unless that is zero length or
387 * EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number
388 * given via the specific API for setting them, WILL override resource.
389 * It is assumed that number from resource is very rare. Special text is
390 * somewhat more likely.
392 * @param aSettingTitleText Text at top of setting pane
393 * @param aSettingNumber Number at top left (if present)
394 * @param aControlType Determines the type constructed and how its
396 * @param aEditorResourceId Editor resource to use in the setting page
398 * @param aSettingPageResourceId Setting Page to use (if present)
399 * @param aTimeValue reference to a time
401 IMPORT_C CAknTimeSettingPage( const TDesC* aSettingTitleText,
404 TInt aEditorResourceId,
405 TInt aSettingPageResourceId,
409 * Specific 2nd stage contructor for this type. Construction is performed
410 * according to the resources and parameters set in the C++ constructors
413 IMPORT_C virtual void ConstructL();
416 * Type-specific access to the editor
418 IMPORT_C CEikTimeEditor* TimeEditor();
423 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
430 IMPORT_C virtual ~CAknTimeSettingPage();
433 * This framework method is called when the editor changes its value and
434 * the mode of execution of the setting page is a continuous update mode.
437 IMPORT_C virtual void UpdateSettingL();
440 * Called when the user has accepted the value.
441 * The external value is updated once again, in case we were not in
442 * continuous update mode.
443 * A specific observer event is generated for the observer to say that the
446 IMPORT_C virtual void AcceptSettingL();
448 * The backup value, stored at construction time, is re-loaded into the
450 * An event is sent to the observer saying that the event was dismissed.
452 IMPORT_C virtual void RestoreOriginalSettingL();
455 // CoeControl Framework and reserved methods
460 * Writes the internal state of the control and its components to aStream.
461 * Does nothing in release mode.
462 * Designed to be overidden and base called by subclasses.
464 * @param aWriteSteam A connected write stream
466 IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
471 * Reserved method derived from CCoeControl
473 IMPORT_C virtual void Reserved_2();
479 IMPORT_C void* ExtensionInterface( TUid aInterface );
482 * New reserved methods for CAknSettingPage hierarchy
485 IMPORT_C virtual void CAknSettingPage_Reserved_1();
486 IMPORT_C virtual void CAknSettingPage_Reserved_2();
491 TTime iBackupTimeValue;
497 * This class is used for entering duration in a "Code" setting page
500 class CAknDurationSettingPage : public CAknMfneSettingPage
504 * Constructor using purely Setting page resource
506 * @param aResourceId Setting page resource Id
507 * @param aDurationValue Reference to the maintained duration value
509 IMPORT_C CAknDurationSettingPage(
511 TTimeIntervalSeconds& aDurationValue);
513 * Constructor that allows separate setting page and editor resources
515 * This constructor allows the use of setting page using only the editor
516 * resource. Other combinations are also possible
518 * In all cases the number (if supplied i.e. <> 0 ) is used.
520 * Editor Resource Setting Page Resource
521 * present present Both are used
524 * = 0 present Editor resource is used
526 * (Effectively like the
528 * present = 0 Default Avkon SP
529 * resource if used + this
531 * = 0 = 0 uses default resource
532 * for both SP and editor.
534 * i) control type is present,
535 * ii) a default resource exists ( OK for text, integer,
536 * date, time, duration )
538 * Note: The first argument is a TDesC* (rather than TDesC&) because the
539 * other constructor cannot initialize such a member without allocation or
540 * having an internal dummy buffer.
541 * Note that this descriptor must be owned by the client at least until the
544 * Rules for text and numbers: The rules are the same for both:
545 * (non-zero length) text or number other than
546 * EAknSettingPageNoOrdinalDisplayed if given in this constructor will not
547 * override resource (unless that is zero length or
548 * EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number
549 * given via the specific API for setting them, WILL override resource.
550 * It is assumed that number from resource is very rare. Special text is
551 * somewhat more likely.
553 * @param aSettingTitleText Text at top of setting pane; OWNED EXTERNALLY
554 * @param aSettingNumber Number at top left (if present)
555 * @param aControlType Determines the type constructed and how its
557 * @param aEditorResourceId Editor resource to use in the setting page
559 * @param aSettingPageResourceId Setting Page to use (if present)
560 * @param aDurationValue reference to a duration
562 IMPORT_C CAknDurationSettingPage( const TDesC* aSettingTitleText,
565 TInt aEditorResourceId,
566 TInt aSettingPageResourceId,
567 TTimeIntervalSeconds& aDurationValue);
570 * Specific 2nd stage contructor for this type. Construction is performed
571 * according to the resources and parameters set in the C++ constructors
574 IMPORT_C virtual void ConstructL();
576 * Type-specific access to the editor
578 IMPORT_C CEikDurationEditor* DurationEditor();
581 * Handles pointer events
583 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
589 IMPORT_C virtual ~CAknDurationSettingPage();
592 * This framework method is called when the editor changes its value and
593 * the mode of execution of the setting page is a continuous update mode.
596 IMPORT_C virtual void UpdateSettingL();
599 * Called when the user has accepted the value.
600 * The external value is updated once again, in case we were not in
601 * continuous update mode.
602 * A specific observer event is generated for the observer to say that the
605 IMPORT_C virtual void AcceptSettingL();
608 * The backup value, stored at construction time, is re-loaded into the
610 * An event is sent to the observer saying that the event was dismissed.
612 IMPORT_C virtual void RestoreOriginalSettingL();
615 // CoeControl Framework and reserved methods
620 * Writes the internal state of the control and its components to aStream.
621 * Does nothing in release mode.
622 * Designed to be overidden and base called by subclasses.
624 * @param aWriteSteam A connected write stream
626 IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
630 * Reserved method derived from CCoeControl
632 IMPORT_C virtual void Reserved_2();
638 IMPORT_C void* ExtensionInterface( TUid aInterface );
641 * New reserved methods for CAknSettingPage hierarchy
644 IMPORT_C virtual void CAknSettingPage_Reserved_1();
645 IMPORT_C virtual void CAknSettingPage_Reserved_2();
648 TTimeIntervalSeconds& iDurationValue;
649 TTimeIntervalSeconds iBackupDurationValue;
654 * Time offset setting page.
660 class CAknTimeOffsetSettingPage : public CAknMfneSettingPage
664 * Constructor using purely Setting page resource
667 * @param aResourceId Setting page resource Id
668 * @param aTimeOffsetValue Reference to the maintained
671 IMPORT_C CAknTimeOffsetSettingPage(
673 TTimeIntervalSeconds& aTimeOffsetValue);
675 * Constructor that allows separate setting page and editor resources
677 * This constructor allows the use of setting page using only the editor
678 * resource. Other combinations are also possible
680 * In all cases the number (if supplied i.e. <> 0 ) is used.
682 * Editor Resource Setting Page Resource
683 * present present Both are used
686 * = 0 present Editor resource is
687 * used via SP resource
688 * (Effectively like the
690 * present = 0 Default Avkon SP
692 * this editor resource
693 * = 0 = 0 uses default resource
694 * for both SP and editor.
696 * i) control type is present,
697 * ii) a default resource exists ( OK for text, integer,
698 * date, time, duration )
700 * Note: The first argument is a TDesC* (rather than TDesC&) because
701 * the other constructor cannot initialize such a member without allocation
702 * or having an internal dummy buffer.
703 * Note that this descriptor must be owned by the client at least until the
706 * Rules for text and numbers: The rules are the same for both:
707 * (non-zero length) text or number other than
708 * EAknSettingPageNoOrdinalDisplayed if given in this constructor will not
709 * override resource (unless that is zero length or
710 * EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number
711 * given via the specific API for setting them, WILL override resource.
712 * It is assumed that number from resource is very rare. Special text is
713 * somewhat more likely.
716 * @param aSettingTitleText Text at top of setting pane; OWNED EXTERNALLY
717 * @param aSettingNumber Number at top left (if present)
718 * @param aControlType Determines the type constructed
719 * and how its resource is read
720 * @param aEditorResourceId Editor resource to use in the setting page
722 * @param aSettingPageResourceId Setting Page to use (if present)
723 * @param aTimeOffsetValue reference to time offset
725 IMPORT_C CAknTimeOffsetSettingPage( const TDesC* aSettingTitleText,
728 TInt aEditorResourceId,
729 TInt aSettingPageResourceId,
730 TTimeIntervalSeconds& aTimeOffsetValue);
733 * Specific 2nd stage contructor for this type. Construction is performed
734 * according to the resources and parameters set in the C++ constructors
737 IMPORT_C virtual void ConstructL();
739 * Type-specific access to the editor
741 IMPORT_C CEikTimeOffsetEditor* TimeOffsetEditor();
745 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
751 IMPORT_C virtual ~CAknTimeOffsetSettingPage();
754 * This framework method is called when the editor changes its
755 * value and the mode of execution of the setting page is a continuous
760 IMPORT_C virtual void UpdateSettingL();
763 * Called when the user has accepted the value.
764 * The external value is updated once again, in case we were not in
765 * continuous update mode.
766 * A specific observer event is generated for the observer to say that the
771 IMPORT_C virtual void AcceptSettingL();
774 * The backup value, stored at construction time, is re-loaded into the
776 * An event is sent to the observer saying that the event was dismissed.
780 IMPORT_C virtual void RestoreOriginalSettingL();
783 // CoeControl Framework and reserved methods
788 * Writes the internal state of the control and its components to aStream.
789 * Does nothing in release mode.
790 * Designed to be overidden and base called by subclasses.
793 * @param aWriteSteam A connected write stream
795 IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
799 * Reserved method derived from CCoeControl
803 IMPORT_C virtual void Reserved_2();
809 IMPORT_C void* ExtensionInterface( TUid aInterface );
812 * New reserved methods for CAknSettingPage hierarchy
815 IMPORT_C virtual void CAknSettingPage_Reserved_1();
816 IMPORT_C virtual void CAknSettingPage_Reserved_2();
819 TTimeIntervalSeconds& iTimeOffsetValue;
820 TTimeIntervalSeconds iBackupTimeOffsetValue;
825 * Setting page class for entering an IP Address
828 class CAknIpFieldSettingPage : public CAknMfneSettingPage
832 * Constructor using purely Setting page resource
834 * @param aResourceId Setting page resource Id
835 * @param aIpAddress Reference to the maintained IP address
837 IMPORT_C CAknIpFieldSettingPage(
839 TInetAddr& aIpAddress);
841 * Constructor that allows separate setting page and editor resources
843 * This constructor allows the use of setting page using only the editor
844 * resource. Other combinations are also possible
846 * In all cases the number (if supplied i.e. <> 0 ) is used.
848 * Editor Resource Setting Page Resource
849 * present present Both are used (but text
850 * & number overridden)
851 * = 0 present Editor resource is
852 * used via SP resource
853 * (Effectively like the
855 * present = 0 Default Avkon SP
856 * resource if used + this
858 * = 0 = 0 uses default resource
859 * for both SP and editor.
861 * i) control type is present,
862 * ii) a default resource exists ( OK for text, integer,
863 * date, time, duration )
865 * Note: The first argument is a TDesC* (rather than TDesC&) because the
866 * other constructor cannot initialize such a member without allocation
867 * or having an internal dummy buffer.
868 * Note that this descriptor must be owned by the client at least until
871 * Rules for text and numbers: The rules are the same for both:
872 * (non-zero length) text or number other than
873 * EAknSettingPageNoOrdinalDisplayed if given in this constructor will not
874 * override resource (unless that is zero length or
875 * EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number
876 * given via the specific API for setting them, WILL override resource.
877 * It is assumed that number from resource is very rare. Special text is
878 * somewhat more likely.
880 * @param aSettingTitleText Text at top of setting pane; OWNED EXTERNALLY
881 * @param aSettingNumber Number at top left (if present)
882 * @param aControlType Determines the type constructed and how its
884 * @param aEditorResourceId Editor resource to use in the setting page
886 * @param aSettingPageResourceId Setting Page to use (if present)
887 * @param aIpAddress reference to a duration
889 IMPORT_C CAknIpFieldSettingPage( const TDesC* aSettingTitleText,
892 TInt aEditorResourceId,
893 TInt aSettingPageResourceId,
894 TInetAddr& aIpAddress);
897 * Specific 2nd stage contructor for this type. Construction is performed
898 * according to the resources and parameters set in the C++ constructors
901 IMPORT_C virtual void ConstructL();
903 * Type-specific access to the editor
905 IMPORT_C CAknIpFieldEditor* IpFieldEditor();
910 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
916 IMPORT_C virtual ~CAknIpFieldSettingPage();
919 * This framework method is called when the editor changes its value and
920 * the mode of execution of the setting page is a continuous update mode.
923 IMPORT_C virtual void UpdateSettingL();
926 * Called when the user has accepted the value.
927 * The external value is updated once again, in case we were not in
928 * continuous update mode.
929 * A specific observer event is generated for the observer to say that the
932 IMPORT_C virtual void AcceptSettingL();
935 * The backup value, stored at construction time, is re-loaded into
936 * the referenced Date.
937 * An event is sent to the observer saying that the event was dismissed.
939 IMPORT_C virtual void RestoreOriginalSettingL();
942 // CoeControl Framework and reserved methods
947 * Writes the internal state of the control and its components to aStream.
948 * Does nothing in release mode.
949 * Designed to be overidden and base called by subclasses.
951 * @param aWriteSteam A connected write stream
953 IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
958 * Reserved method derived from CCoeControl
960 IMPORT_C virtual void Reserved_2();
966 IMPORT_C void* ExtensionInterface( TUid aInterface );
969 * New reserved methods for CAknSettingPage hierarchy
972 IMPORT_C virtual void CAknSettingPage_Reserved_1();
973 IMPORT_C virtual void CAknSettingPage_Reserved_2();
976 TInetAddr& iIpAddress;
977 TInetAddr iBackupIpAddress; // Not a reference