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 * Support for Setting Item Lists (See Selection Service specification)
16 * Contains setting item classes (whole hierarchy) and the
17 * array classes used to set up the setting item listbox
22 #if !defined(__AKNSETTINGITEMLIST_H__)
23 #define __AKNSETTINGITEMLIST_H__
27 #include <AknControl.h>
32 // For CEikFormattedListBox
36 #include <aknsettingpage.h>
39 #include <AknQueryValueText.h>
42 // Maximum length of the blanking text
43 const TInt KMaxPasswordBlankingTextLength = 10;
45 class CAknSettingItemExtension;
49 * CAknSettingItem is the base class for all setting items. The abstracted functionality
50 * is implemented in this class if possible.
52 * All array of setting items is held in CAknSettingItemArray, which in turn is owned by
53 * CAknSettingItemList, a listbox type.
56 class CAknSettingItem : public CBase, public MAknSettingPageObserver
59 friend class CAknSettingItemArray;
66 EIsNumberedStyle = 0x4,
72 // Setting item protection states
73 enum TSettingItemProtection
75 ENoSettingItemProtection,
83 * @param the unique identifier fo the setting item (not its number)
85 IMPORT_C CAknSettingItem( TInt identifier );
90 IMPORT_C ~CAknSettingItem();
94 * 2nd-stage constuctor. Resource for setting item is read externally in setting item list
95 * and the values are passed here.
97 IMPORT_C void ConstructL(
98 const TBool aIsNumberedStyle,
100 const TDesC& aSettingTitle,
101 CArrayPtr<CGulIcon>* aIconArray,
102 const TInt aSettingPageResource,
103 const TInt aEditorControlType,
104 const TInt aSettingEditorResource = 0,
105 const TInt aAssociatedResource = 0 );
108 * This command externalizes the current setting. The displayed (internal) copy
109 * is transferred to the external copy (the one referenced in the constructor).
111 * This must be called by the client if he wants this to happen. Note that StoreAllL()
112 * on the setting item list will call this for each setting item.
114 IMPORT_C virtual void StoreL();
116 * The external value is transferred to the internal value
117 * This occurs at construction, but may be called by client code when required.
119 IMPORT_C virtual void LoadL();
122 * This launches the setting page
124 * @param aCalledFromMenu - ignored in this class
127 IMPORT_C virtual void EditItemL( TBool aCalledFromMenu );
130 * This method is called by framework in order to update the text in the setting
131 * item. It may be called by the client.
134 IMPORT_C virtual void UpdateListBoxTextL();
137 * Access to the setting Name
138 *.@return the setting name
140 IMPORT_C TPtrC SettingName();
142 * Access to the setting number
143 * @return the setting number
145 IMPORT_C TInt SettingNumber() const;
147 * Access to the setting visibility
148 * @return ETrue if the setting item is hidden
150 IMPORT_C TBool IsHidden() const;
152 * Access to the numbering style of the setting item
153 * @return ETrue if it is numbered
155 IMPORT_C TBool IsNumberedStyle() const;
158 * @param Set to ETrue to hide the item; EFalse to make it visible
160 * Note that the setting item array must have be notified of this
161 * by calling CAknSettingItemList::HandleChangeInItemArrayOrVisibility
163 IMPORT_C void SetHidden(TBool aHidden );
165 * This method obtains the current value's setting text
167 * @return Reference to descriptor with the text
169 IMPORT_C virtual const TDesC& SettingTextL();
171 * This gives access to the listbox text content at this item (fully decorated)
173 * @return pointer to listboxtext. No allocation is performed and no change of ownership
175 IMPORT_C HBufC* ListBoxText();
177 * Access to the setting item's identifier. This is set in the setting item's constructor
178 * but usually comes via resource in the setting item list read of its resource structure
180 * @return The identifier of this setting item
182 IMPORT_C TInt Identifier() const;
184 * Checks if the setting item has a bitmap in its setting contents
185 * @return ETrue if it has a bitmap
187 IMPORT_C TBool HasIcon() const;
189 * This sets the text to display if the current setting is empty.
191 * @param text to make display when there is empty setting. A copy is made in the setting item
193 IMPORT_C void SetEmptyItemTextL( const TDesC& aEmptyItemText );
194 IMPORT_C void SetCompulsoryIndTextL( const TDesC& aCompulsoryInd );
196 // From MAknSettingPageObserver
197 IMPORT_C virtual void HandleSettingPageEventL(CAknSettingPage* aSettingPage,TAknSettingPageEvent aEventType );
199 * Get the index at which this item appears in the listbox
201 * @return index in listbox
203 IMPORT_C TInt VisibleIndex();
206 * Set the flags that are required for some of the setting page constructors
208 * @param aFlagPattern Flag pattern to set
210 IMPORT_C void SetSettingPageFlags( TInt aFlagPattern);
213 * Access method for the setting page specific flags
214 * @return the flag pattern
216 IMPORT_C TInt SettingPageFlags( ) const;
219 * Set the parent lisbox into the setting item
222 * @param aListBox listbox with which the setting item is associated.
224 void SetParentListBox( const CEikFormattedCellListBox* aListBox );
227 * Set the protection state of the setting item
229 * The protection state is for protecting selected settings from editing.
230 * The protection can be set to:
231 * - prohibit opening of the setting page
232 * - allow access to the setting page, but prohibit editing of it
234 * The protected item is indicated in the setting item list with a lock icon.
235 * If a user tries to open a protected setting item, a notification is shown
238 * The "view only" -mode is only possible for pop-up setting page.
241 * @param aProtected Sets the protection state of the setting item
243 IMPORT_C void SetProtectionState( CAknSettingItem::TSettingItemProtection aProtected );
246 * Get the protection state
248 * See SetProtected for details for the different states.
251 * @return Protection state of the setting item
253 IMPORT_C CAknSettingItem::TSettingItemProtection ProtectionState();
259 * Method called by framework to complete the construction. Extra allocations of
260 * memory or extra resource reading can happen here.
263 IMPORT_C virtual void CompleteConstructionL();
266 * Method to obtain a new bitmap for the setting content
268 * This method is usually empty in setting items classes except for volume and slider.
269 * Any derived implementations of this method should call SetIconMask().
272 IMPORT_C virtual CFbsBitmap* CreateBitmapL();
277 * A setting page should know when it is "Editing". This is set in EditItemL
278 * and cleared to 0 when the dialog is finished.
280 * @param pointer to the currently executing settting page dialog
283 IMPORT_C void SetSettingPage( CAknSettingPage* aSettingPage );
285 * Access to the current setting page
287 * @return pointer to the currently executing setting page. 0 if there is none
289 IMPORT_C CAknSettingPage* SettingPage() const;
291 * Performs standard setup on a setting page
294 IMPORT_C void SetUpStandardSettingPageL();
296 * Access to the empty text that has been set, or is default
298 * @return ref to empty text descriptor
300 IMPORT_C TDesC& EmptyItemText() const; // Assumed only needs to be used by SettingTextL
303 * Access to the setting page resource id that might have been read by
304 * the setting item resource.
306 * @return 0 or the setting page resource id
308 IMPORT_C TInt SettingPageResourceId() const;
310 * Access to the setting page editor's resource id that might have been read by
311 * the setting item resource.
313 * @return 0 or the setting page editor's id
315 IMPORT_C TInt SettingEditorResourceId() const;
317 * Returns the associate editor resource. This is an LLINK in the seting item
318 * resource that subclasses can use in CompleteContstructionL
320 * @return 0 or the extra resource id
322 IMPORT_C TInt AssociatedResourceId() const;
325 * @return the control type of the settin page editor
328 TInt EditorControlType() const;
331 * This sets the mask of this setting item's icon array, if it exists.
332 * The normal usage of this routine is inside a re-implementation of CAknSettingItem::CreateBitmapL.
333 * It is used to set the mask of the setting item's setting icon as a side effect of a
334 * framework call to CreateBitmapL
336 * The return value may need to be looked at to decide how to dispose of, for example, an
337 * a CGulIcon that may be holding the mask.
340 * @param aMask bitmap to set as a mask for the CGulIcon in the setting listbox's icon array
341 * @return TBool ETrue if the ownership of aMask has been passed
343 IMPORT_C TBool SetIconMask( CFbsBitmap* aMask );
346 * This sets the mask of this setting item's icon array, if it exists, using the mask from the
348 * It returns the bitmap from the aIcon.
349 * The method also takes ownership of aIcon and may delete it (but not its bitmap).
352 * @param aIcon icon of which the mask is passed through to SetIconMask() and bitmap is returned
353 * @return CFbsBitmap* bitmap from aIcon. Ownership of the bitmap is transfered to the caller
355 CFbsBitmap* SetIconMaskAndReturnBitmap( CGulIcon* aIcon );
358 * This routine causes any bitmaps that are extracted from setting pages to be updated
359 * according to the current (internal) setting value
361 void UpdateBitmapL();
364 * Set the index at which the item is to appear in the setting item list
365 * Only needed by CAknSettingItemArray
367 void SetVisibleIndex( TInt aVisibleIndex );
370 * Set the ordinal value. This is used for dynamic changing of the ordinal by
371 * CAknSettingItemArray
374 void SetOrdinal( TInt aOrdinal );
378 * Clean up a setting text for display by replacing all non printing characters
382 TPtrC ReplaceNonPrintingCharacters( TDes& aTextToClean );
384 IMPORT_C void CAknSettingItem_Reserved();
390 TInt iSettingIdentifier;
391 TInt iSettingPageResourceId;
392 TInt iEditorControlType;
393 TInt iSettingEditorResourceId;
394 TInt iAssociatedResourceId;
395 TInt iIconIndex; // Only valid if relevant bit is set in iFlags
396 HBufC* iEmptyItemText; // Owned
398 HBufC* iSettingName; // Owned
399 HBufC* iListBoxText; // Owned
400 HBufC* iCompulsoryText; // Owned
403 // Following are not owned
404 CAknSettingPage* iSettingPage; // This is a ref that is valid when non-0 - when the SP is "up"
405 CArrayPtr<CGulIcon>* iIconArray; // Reference to the array only !
408 // Set flags that are in the Setting pages' constructors
409 TInt iSettingPageFlags;
411 // Pointer to the listbox that the setting item is providing data to
412 const CEikFormattedCellListBox* iParentListBox; // Not owned
414 CAknSettingItemExtension* iExtension;
418 * Support for abstact text setting type. Corresponds to CAknTextSettingPage
421 class CAknTextSettingItem : public CAknSettingItem
427 * @param resource identifier for this setting item
428 * @param Setting text
431 IMPORT_C CAknTextSettingItem( TInt aIdentifier, TDes& aText );
436 IMPORT_C ~CAknTextSettingItem();
439 * This command externalizes the current setting. The displayed (internal) copy
440 * is transferred to the external copy (the one referenced in the constructor).
442 * This must be called by the client if he wants this to happen. Note that StoreAllL()
443 * on the setting item list will call this for each setting item.
445 IMPORT_C virtual void StoreL();
448 * The external value is transferred to the internal value
449 * This occurs at construction, but may be called by client code when required.
451 IMPORT_C virtual void LoadL(); // Called from 2nd stage constructors
454 * This method obtains the current value's setting text.
456 * The reference is returned and is not a copy of the text, but refers to the current
457 * internal text value. This is the value that would be externalized if StoreL were called.
458 * An exception to this is if the current text is zero length. In that case a reference to the
459 * empty text is returned (which would not be externalized if StoreL is called).
461 * @return Reference to descriptor with the current internal text
463 IMPORT_C virtual const TDesC& SettingTextL();
467 * This launches the setting page for text editing
469 * @param aCalledFromMenu - ignored in this class
472 IMPORT_C virtual void EditItemL( TBool aCalledFromMenu );
477 * Access for re-implementors to the internal text
479 * @return reference to a TPtr holding the internal text
481 IMPORT_C TPtr& InternalTextPtr();
484 * Access for re-implementors to the external text
486 * @return TPtrC pointing to the external text
488 IMPORT_C TPtrC ExternalText();
491 * Allows re-implementors to set the external text
492 * No change of ownership is implied.
494 * @param a reference to the external text
497 IMPORT_C void SetExternalText( TDesC& aNewExternalText );
499 IMPORT_C void CAknSettingItem_Reserved();
503 HBufC* iInternalText; // Owned
504 TPtr iInternalTextPtr;
511 * Abstract setting item for integer editing.
513 * This class is not disposed toward any particular type of setting page
516 class CAknIntegerSettingItem : public CAknSettingItem
522 * @param resource identifier for this setting item
523 * @param integer value to edit.
526 IMPORT_C CAknIntegerSettingItem( TInt aIdentifier, TInt& aValue );
527 IMPORT_C ~CAknIntegerSettingItem();
530 * This command externalizes the current setting. The displayed (internal) copy
531 * is transferred to the external copy (the one referenced in the constructor).
533 * This must be called by the client if he wants this to happen. Note that StoreAllL()
534 * on the setting item list will call this for each setting item.
536 IMPORT_C virtual void StoreL();
538 * The external value is transferred to the internal value
539 * This occurs at construction, but may be called by client code when required.
541 IMPORT_C virtual void LoadL();
544 * This method obtains the current value's setting text
546 * @return Reference to descriptor with the text
548 IMPORT_C virtual const TDesC& SettingTextL();
552 * Pure virtual editItemL
554 * @param aCalledFromMenu - ignored in this class
557 virtual void EditItemL( TBool aCalledFromMenu ) = 0;
561 * Method called by framework to complete the construction. Extra allocations of
562 * memory or extra resource reading can happen here.
565 IMPORT_C virtual void CompleteConstructionL();
568 * Method to access the internal value.
570 * @return a reference to the internal integer value
572 IMPORT_C TInt& InternalValueRef();
575 * Method to access the external reference to the external value. Note that this class
576 * only accesses the external integer via a copy of a reference to it.
578 * @return a reference to the external integer value
580 IMPORT_C TInt& ExternalValueRef();
583 * Sets the external value's reference. The external vlue is externally owned, so
584 * this does not make a copy.
585 * @param TInt& aValue a reference to the external value
587 IMPORT_C void SetExternalValue( TInt& aValue );
589 IMPORT_C void CAknSettingItem_Reserved();
593 TInt& iExternalValue;
594 HBufC* iInternalText; // Owned
595 TPtr iInternalTextPtr;
599 class CAknIntegerEdwinSettingItem : public CAknIntegerSettingItem
602 IMPORT_C CAknIntegerEdwinSettingItem( TInt aIdentifier, TInt& aValue );
605 * This launches the setting page for editing using the integer edwin class
607 * @param aCalledFromMenu - ignored in this class
610 IMPORT_C virtual void EditItemL( TBool aCalledFromMenu );
612 IMPORT_C void CAknSettingItem_Reserved();
617 * Class for holding a password setting item
620 class CAknPasswordSettingItem : public CAknTextSettingItem
623 enum TAknPasswordSettingItemMode
625 EAlpha, // password held is alphanumeric
626 ENumeric // password is numeric ( digits 0 - 9 only used )
632 * @param resource identifier for this setting item
633 * @param password mode; text or numeric
634 * @param password to change
636 IMPORT_C CAknPasswordSettingItem( TInt aIdentifier, enum TAknPasswordSettingItemMode aMode, TDes& aPassword );
639 * This method obtains the current value's setting text
641 * @return Reference to descriptor with the text
643 IMPORT_C virtual const TDesC& SettingTextL();
646 * This launches the setting page for password editing
648 * @param aCalledFromMenu - ignored in this class
651 IMPORT_C virtual void EditItemL( TBool aCalledFromMenu );
656 * Method called by framework to complete the construction. Extra allocations of
657 * memory or extra resource reading can happen here.
660 IMPORT_C virtual void CompleteConstructionL();
662 IMPORT_C void CAknSettingItem_Reserved();
665 TAknPasswordSettingItemMode iPasswordMode;
666 // For holding the text to blank the setting item text
667 TBuf<KMaxPasswordBlankingTextLength> iBlankingText;
668 // For holding the resouce for a password query
669 TInt iOldPasswordQueryResourceId;
674 * An abstract integer setting that uses the volume control as its editor
677 class CAknVolumeSettingItem : public CAknSettingItem
683 * @param resource identifier for this setting item
684 * @param volume value. Must be in range 0 to 10, inclusive
687 IMPORT_C CAknVolumeSettingItem( TInt aIdentifier, TInt& aExternalVolume );
690 * This command externalizes the current setting. The displayed (internal) copy
691 * is transferred to the external copy (the one referenced in the constructor).
693 * This must be called by the client if he wants this to happen. Note that StoreAllL()
694 * on the setting item list will call this for each setting item.
696 IMPORT_C virtual void StoreL();
698 * The external value is transferred to the internal value
699 * This occurs at construction, but may be called by client code when required.
701 IMPORT_C virtual void LoadL();
703 * This method obtains the current value's setting text
705 * @return Reference to descriptor with the text
707 IMPORT_C virtual const TDesC& SettingTextL();
710 * This launches the setting page for volume editing
712 * @param aCalledFromMenu - ignored in this class
715 IMPORT_C virtual void EditItemL( TBool aCalledFromMenu );
719 * Protected access to the volume value
721 * @return Reference to the internal volume value
723 IMPORT_C TInt& InternalVolumeValue(); // For access to internal value for derived classes
725 //From CAknSettingItem
728 * Obtain a bitmap from the CAknVolume
731 IMPORT_C virtual CFbsBitmap* CreateBitmapL();
733 IMPORT_C void CAknSettingItem_Reserved();
736 TInt& iExternalVolume;
737 TInt iInternalVolume;
742 * Slider control setting item
747 class CAknSliderSettingItem : public CAknSettingItem
753 * @param resource identifier for this setting item
754 * @param Slider value; must be within the minimum and maximum values in resource
757 IMPORT_C CAknSliderSettingItem( TInt aIdentifier, TInt& aExternalSliderValue );
760 * This command externalizes the current setting. The displayed (internal) copy
761 * is transferred to the external copy (the one referenced in the constructor).
763 * This must be called by the client if he wants this to happen. Note that StoreAllL()
764 * on the setting item list will call this for each setting item.
766 IMPORT_C virtual void StoreL();
768 * The external value is transferred to the internal value
769 * This occurs at construction, but may be called by client code when required.
771 IMPORT_C virtual void LoadL();
773 * This method obtains the current value's setting text
775 * @return Reference to descriptor with the text
777 IMPORT_C virtual const TDesC& SettingTextL();
780 * This launches the setting page for slider editing
782 * @param aCalledFromMenu - ignored in this class
785 IMPORT_C virtual void EditItemL( TBool aCalledFromMenu );
789 * Method to create a setting page
791 IMPORT_C virtual CAknSettingPage* CreateSettingPageL();
794 * Method to contruct the setting page (via CreateSettingPageL), and execute it
796 IMPORT_C virtual void CreateAndExecuteSettingPageL();
799 * For access to internal value for derived classes
801 * @return A ref to the internal value
803 IMPORT_C TInt& InternalSliderValue();
805 // From CAknSettingItem
808 * Obtain a bitmap from the CAknSlider
811 IMPORT_C virtual CFbsBitmap* CreateBitmapL();
813 IMPORT_C void CAknSettingItem_Reserved();
816 TInt& iExternalSliderValue;
817 TInt iInternalSliderValue; // required for use in derived classes
824 * Time or Date Setting Item
826 * This class combines the time and the date functionality, as determined by a mode
827 * passed to the constructor.
829 * Time or Date setting pages are launched from here, which use Time or date editor
830 * MFNEs to do the editing.
833 class CAknTimeOrDateSettingItem : public CAknSettingItem
836 enum TAknTimeOrDateSettingItemMode
844 * @param resource identifier for this setting item
845 * @param construct a Time or a Date setting item
846 * @param IP address to be controlled by the setting editing
849 IMPORT_C CAknTimeOrDateSettingItem( TInt aIdentifier, enum TAknTimeOrDateSettingItemMode aMode, TTime& aTime );
853 IMPORT_C ~CAknTimeOrDateSettingItem();
855 * Method called by framework to complete the construction. Extra allocations of
856 * memory or extra resource reading can happen here.
859 IMPORT_C void CompleteConstructionL( );
862 * This command externalizes the current setting. The displayed (internal) copy
863 * is transferred to the external copy (the one referenced in the constructor).
865 * This must be called by the client if he wants this to happen. Note that StoreAllL()
866 * on the setting item list will call this for each setting item.
868 IMPORT_C virtual void StoreL();
870 * The external value is transferred to the internal value
871 * This occurs at construction, but may be called by client code when required.
873 IMPORT_C virtual void LoadL();
875 * This method obtains the current value's setting text
877 * @return Reference to descriptor with the text
879 IMPORT_C virtual const TDesC& SettingTextL();
882 * This launches the setting page for Time or Date editing
884 * @param aCalledFromMenu - ignored in this class
887 IMPORT_C virtual void EditItemL( TBool aCalledFromMenu );
890 * Set the time or date format string. If this is not called, then a
891 * localized, default string is used
894 IMPORT_C void SetTimeFormatStringL( const TDesC& aTimeFormat );
897 * Obtain the time format string
899 * @return A pointer descriptor to the date/time format string
901 IMPORT_C const TPtrC TimeFormatString();
903 IMPORT_C void CAknSettingItem_Reserved();
905 TTime& iExternalTime;
907 HBufC* iInternalText; // Owned
908 TPtr iInternalTextPtr;
911 TAknTimeOrDateSettingItemMode iTimeOrDateMode;
918 * Time Offset Setting Item
920 * Time Offset page as launched from here, which use Offset editor
921 * MFNEs to do the editing.
927 class CAknTimeOffsetSettingItem : public CAknSettingItem
933 * @param resource identifier for this setting item
934 * @param construct a Time offset setting item
937 IMPORT_C CAknTimeOffsetSettingItem( TInt aIdentifier, TTimeIntervalSeconds& aTime );
941 IMPORT_C ~CAknTimeOffsetSettingItem();
943 * Method called by framework to complete the construction. Extra allocations of
944 * memory or extra resource reading can happen here.
948 IMPORT_C void CompleteConstructionL( );
951 * This command externalizes the current setting. The displayed (internal) copy
952 * is transferred to the external copy (the one referenced in the constructor).
954 * This must be called by the client if he wants this to happen. Note that StoreAllL()
955 * on the setting item list will call this for each setting item.
959 IMPORT_C virtual void StoreL();
961 * The external value is transferred to the internal value
962 * This occurs at construction, but may be called by client code when required.
966 IMPORT_C virtual void LoadL();
968 * This method obtains the current value's setting text
971 * @return Reference to descriptor with the text
973 IMPORT_C virtual const TDesC& SettingTextL();
976 * This launches the setting page for Time or Date editing
979 * @param aCalledFromMenu - ignored in this class
982 IMPORT_C virtual void EditItemL( TBool aCalledFromMenu );
985 * Set the time or date format string. If this is not called, then a
986 * localized, default string is used
990 IMPORT_C void SetTimeFormatStringL( const TDesC& aTimeFormat );
993 * Obtain the time format string
996 * @return A pointer descriptor to the date/time format string
998 IMPORT_C const TPtrC TimeFormatString();
1000 IMPORT_C void CAknSettingItem_Reserved();
1002 TTimeIntervalSeconds iExternalTime;
1003 TTimeIntervalSeconds iInternalTime;
1004 HBufC* iInternalText; // Owned
1005 TPtr iInternalTextPtr;
1007 TPtr iTimeFormatPtr;
1015 * IP Address setting item
1017 * Abstract data type for IP address setting. Launches a CAknIpFieldSettingPage
1018 * that in turn uses the CAknIpFieldEditor
1021 class CAknIpFieldSettingItem : public CAknSettingItem
1027 * @param resource identifier for this setting item
1028 * @param IP address to be controlled by the setting editing
1031 IMPORT_C CAknIpFieldSettingItem( TInt aIdentifier, TInetAddr& aIpAddress );
1037 IMPORT_C ~CAknIpFieldSettingItem();
1040 * Method called by framework to complete the construction. Extra allocations of
1041 * memory or extra resource reading can happen here.
1044 IMPORT_C void CompleteConstructionL( );
1047 * This command externalizes the current setting. The displayed (internal) copy
1048 * is transferred to the external copy (the one referenced in the constructor).
1050 * This must be called by the client if he wants this to happen. Note that StoreAllL()
1051 * on the setting item list will call this for each setting item.
1053 IMPORT_C virtual void StoreL();
1055 * The external value is transferred to the internal value
1056 * This occurs at construction, but may be called by client code when required.
1059 IMPORT_C virtual void LoadL(); // Called from 2nd stage constructors
1061 * This method obtains the current value's setting text
1063 * @return Reference to descriptor with the text
1065 IMPORT_C virtual const TDesC& SettingTextL();
1068 * This launches the setting page for IP address editing
1070 * @param aCalledFromMenu - ignored in this class
1073 IMPORT_C virtual void EditItemL( TBool aCalledFromMenu );
1075 IMPORT_C void CAknSettingItem_Reserved();
1078 TInetAddr& iExternalIpAddress;
1079 TInetAddr iInternalIpAddress;
1080 HBufC* iInternalText; // Owned
1081 TPtr iInternalTextPtr;
1085 * Base class for a data object to hold a pointer and a corresponding integer value.
1086 * This is used to make a template class by CAknEnumeratedItem
1089 class CAknEnumeratedItemBase : public CBase
1093 * Construct an item consisting of an integer value and its co-ordinate pointer
1095 IMPORT_C CAknEnumeratedItemBase( TInt aEnumeratedValue, TAny* aValue );
1099 IMPORT_C ~CAknEnumeratedItemBase();
1101 * Access the integer value
1103 * @return the integer value of this item
1105 IMPORT_C TInt EnumerationValue() const;
1107 * Set the integer part of the object
1109 * @param aNewValue Value to set
1111 IMPORT_C void SetEnumerationValue( TInt aNewValue );
1113 * Access the pointer part of the object
1115 * @return TAny* pointer to any type
1117 IMPORT_C TAny* Value() const;
1119 * Set the pointer part of the object
1121 * @param pointer to store in the object; no copy model, no ownership transfer
1123 IMPORT_C void SetValue( TAny* aPtr );
1125 TInt iEnumerationValue;
1131 * Makes a template class from CAknEnumeratedItemBase
1135 class CAknEnumeratedItem : public CAknEnumeratedItemBase
1138 inline CAknEnumeratedItem( TInt aEnumeratedValue, T* aValue );
1139 inline ~CAknEnumeratedItem();
1141 inline void SetValue( T* );
1146 inline CAknEnumeratedItem<T>::CAknEnumeratedItem( TInt aEnumValue, T* aValue ) :
1147 CAknEnumeratedItemBase( aEnumValue, (TAny*)aValue)
1152 inline CAknEnumeratedItem<T>::~CAknEnumeratedItem()
1158 inline T* CAknEnumeratedItem<T>::Value()
1160 return ( ( T* ) CAknEnumeratedItemBase::Value() );
1164 inline void CAknEnumeratedItem<T>::SetValue( T* aNewValue )
1166 CAknEnumeratedItemBase::SetValue( aNewValue );
1172 * Definition of CAknEnumeratedText
1174 typedef CAknEnumeratedItem<HBufC> CAknEnumeratedText;
1179 * CAknEnumeratedTextSettingItem
1181 * Abstract Base class for deriving listbox setting page related setting items
1183 * The class provides standard array support for these setting items and their
1184 * listboxes. Then approach is centred upon the CAknEnumeratedText type.
1186 * The texts are exposed to the user, and appear in two versions, if desired - the text shown
1187 * in the setting list when not being edited, and the "popped-up" version of the texts.
1190 class CAknEnumeratedTextSettingItem : public CAknSettingItem
1194 * Constructor. Resource Id for the setting item
1197 IMPORT_C CAknEnumeratedTextSettingItem( TInt aResourceId );
1202 IMPORT_C ~CAknEnumeratedTextSettingItem();
1205 // From CAknSettingItem
1211 * Virtual method called by framework to complete the construction.
1212 * In this class, the two arrays, pointers to which can be obtained by calling
1213 * EnumeratedTextArray() and PoppedUpTextArray() are created.
1216 IMPORT_C void CompleteConstructionL();
1219 IMPORT_C void CAknSettingItem_Reserved();
1224 * Access to the enumerated text array. Texts here are used in the setting item list
1226 * No ownership of the array or its contents is transferred
1228 * @return a pointer to an array of HBufC*s
1230 IMPORT_C CArrayPtr<CAknEnumeratedText>* EnumeratedTextArray() const;
1233 * Access to the "popped up" array of texts. They may be defined differently from
1234 * those in the enumerated text array so that the setting page items can be different
1235 * from those displayed in the setting item editing list
1236 * No ownership of the array or its contents is transferred
1238 * @return a pointer to an array of HBufC*s
1240 IMPORT_C CArrayPtr<HBufC>* PoppedUpTextArray() const;
1243 * Set the enumerated arrays.
1244 * Ownership of these arrays and their contents is wholly given over to the setting item
1245 * object. The client must call HandleTextArrayUpdateL() after making this call.
1247 * After calling SetEnumeratedTextArrays(), it is the client code's responsibility to ensure that
1248 * the current value of the external Tint value corresponds to one of the enumerated texts. This can
1249 * be done, for instance, after calling SetEnumeratedTextArrays() by calling IndexFromValue() and
1250 * ensuring a return value of a valid index (not -1 ). Otherwise, there will be a panic in
1251 * HandleTextArrayUpdateL() when it is called.
1253 * This call transfers the ownership of the arrays, and the items pointed to by the arrays
1255 * @param aEnumeratedTextArray array of Integer-Text pairs to be the new basis for display
1256 * This is the master array, and its Count() determines the number of entries to display
1257 * @param aPoppedUpTextArray array of Text descriptors that provide versions of the text
1258 * to display in the setting page listbox. The array pointer must be valid, but the
1259 * array need not contain any entries. Only those entries that need to be different
1260 * from those in aEnumeratedTextArray needs be present;
1262 IMPORT_C void SetEnumeratedTextArrays( CArrayPtr<CAknEnumeratedText>* aEnumeratedTextArray,
1263 CArrayPtr<HBufC>* PoppedUpTextArray );
1265 * Called to execute any code that might need to run when the text arrays are replaced.
1266 * This class has a null implementation
1269 IMPORT_C virtual void HandleTextArrayUpdateL();
1272 * Access to the number of items in the arrays
1274 * @return The number of items in the array returned by EnumeratedTextArray()
1276 IMPORT_C TInt NumberOfItems() const;
1279 * Routine to find the index in the enumerated text list that corresponds to the value
1282 * @param aInputValue value to search for in the enumerated items
1283 * @return 0 - based index in the item found. -1 if not found.
1286 IMPORT_C TInt IndexFromValue( TInt aInputValue ) const;
1291 * Implementors of subclasses can call this non-virtual method to set up the list of texts
1292 * to be used for the setting page. (Although it is not useful for CAknCheckBoxSettingPage)
1293 * The list is constructed from the contents of the two
1294 * text arrays, EnumeratedTextArray() and PoppedUpTextArray(). This is usually to be done
1295 * "On the fly" immediately prior to the raising of a setting page.
1297 IMPORT_C void SetSettingPageTextL();
1300 * Accessor for the setting page text array
1302 IMPORT_C CDesCArray* SettingPageTextArray() const;
1307 * The primary text arrays (those set by SetEnumeratedTextArrays) are deleted and their
1308 * references zeroed.
1310 void DeleteAndZeroPrimaryArrays();
1313 TInt iTextPopupFlags;
1314 CArrayPtr<CAknEnumeratedText>* iEnumeratedTextArray; // Owned and pointed to objects are owned
1315 CArrayPtr<HBufC>* iPoppedUpTextArray; // Owned and the HBufCs are owned here
1316 TInt iEnumeratedTextArrayResourceId;
1317 TInt iPoppedUpTextArrayResourceId;
1318 CDesCArrayFlat* iSettingPageText; // Owned
1319 HBufC* iSpare; // Formerly space was used by iEmptyText;
1325 * Setting item type for CAknEnumeratedItems.
1327 * The main use case for this is for list of texts that are being manipulated in the
1328 * client source code as a set of enumerations, while the texts, read from resource,
1329 * are not strongly exposed to the client.
1331 * They are exposed to the user, and appear in two versions, if desired - the text shown
1332 * in the setting list when not being edited, and the "popped-up" version of the texts.
1335 class CAknEnumeratedTextPopupSettingItem : public CAknEnumeratedTextSettingItem
1339 * Construct a list, storing in it a resource (to be read at 2nd stage construction)
1340 * and a reference to na externally owned integer - the value to be manipulated
1343 IMPORT_C CAknEnumeratedTextPopupSettingItem( TInt aResourceId, TInt& aValue );
1348 IMPORT_C ~CAknEnumeratedTextPopupSettingItem();
1351 * This command externalizes the current setting. The displayed (internal) copy
1352 * is transferred to the external copy (the one referenced in the constructor).
1354 * This must be called by the client if he wants this to happen. Note that StoreAllL()
1355 * on the setting item list will call this for each setting item.
1357 IMPORT_C virtual void StoreL();
1360 * The external value is transferred to the internal value
1361 * This occurs at construction, but may be called by client code when required.
1363 IMPORT_C virtual void LoadL();
1366 * This method obtains the current value's setting text
1368 * @return Reference to descriptor with the text
1370 IMPORT_C virtual const TDesC& SettingTextL();
1373 * This launches the setting page for popup list setting page
1375 * @param aCalledFromMenu - ignored in this class
1378 IMPORT_C virtual void EditItemL( TBool aCalledFromMenu );
1382 * Access to the enumerated text array. Texts here are used in the setting item list
1385 * @return a pointer to an array of HBufC*s
1387 IMPORT_C CArrayPtr<CAknEnumeratedText>* EnumeratedTextArray() const;
1390 * Access to the "popped up" array of texts. They may be defined differently from
1391 * those in the enumerated text arry
1393 * @return a pointer to an array of HBufC*s
1395 IMPORT_C CArrayPtr<HBufC>* PoppedUpTextArray() const;
1399 * Framework method for constructing the launching setting page
1400 * @return a constructed CAknSettingPage object on the heap
1402 IMPORT_C virtual CAknSettingPage* CreateSettingPageL();
1405 * Framework method to create and execute setting page
1407 IMPORT_C virtual void CreateAndExecuteSettingPageL();
1410 * Method called by framework to complete the construction. Extra allocations of
1411 * memory or extra resource reading can happen here.
1414 IMPORT_C virtual void CompleteConstructionL();
1417 * Sets the value of the (unowned) external value using the reference to it held
1419 * Note that this does not change the value of the reference itself.
1420 * That is, aNewValue's address is not copied in to be used as the external reference.
1421 * @param aNewValue Value to be copied via the external reference.
1423 IMPORT_C void SetExternalValue( TInt aNewValue );
1425 * Sets the internal value. The value of aNewValue is copied into the internal storage
1426 * holding the internal value
1429 IMPORT_C void SetInternalValue( TInt aNewValue );
1432 * Set the item that is selected in the associated popup. This should be done so
1433 * as to keep the selected index consistent with the internal value
1437 IMPORT_C void SetSelectedIndex( TInt aNewIndex );
1440 * Returns the index in the enumerated item array, given the value of the enumeration
1442 * @param aInputValue Value to look up; Returns -1 if value is not found
1444 IMPORT_C TInt IndexFromValue( TInt aInputValue ) const ;
1447 * Get the external value
1450 IMPORT_C TInt ExternalValue() const;
1452 * Access the internal value
1455 IMPORT_C TInt InternalValue() const;
1457 * Return a reference to the MAknQueryValue that is constructed for the CAknPopupListSettingPage
1458 * @return MAknQueryValue
1460 IMPORT_C MAknQueryValue* QueryValue() const;
1462 IMPORT_C void CAknSettingItem_Reserved();
1465 void SetSettingPageTextL();
1466 void CreateTextArrayL();
1467 void CreateQueryValueL();
1468 void UpdateInternalValuesL();
1471 * This routine looks at the current enumeration values and returns the next integer
1472 * higher than the highest enumeration. For internal use only, although it is possible
1473 * that clients or derivers might want to use somthing like it.
1475 * @return a new unique value that can be used for extending the enumeration
1477 TInt FindNextEnumerationValue() const;
1480 TInt& iExternalValue;
1481 TInt iInternalValue;
1482 TInt iNumberOfItems;
1483 TInt iSelectedIndex;
1484 CAknQueryValueText* iQueryValue;
1485 CAknQueryValueTextArray* iQueryTextArray;
1486 TInt iSpare_EnumeratedTextPopup_1;
1490 class CAknBinaryPopupSettingItem : public CAknEnumeratedTextPopupSettingItem
1494 * Constructs a binary setting value, given a resource id and a reference to
1495 * an externally owned external boolen setting item.
1496 * Resource supplied is just as for CAknEnumeratedTextPopupSettingItem
1498 * @param aIdentifier Resource id for the associated values and texts;
1501 IMPORT_C CAknBinaryPopupSettingItem( TInt aIdentifier, TBool& aBinaryValue );
1504 * This command externalizes the current setting. The displayed (internal) copy
1505 * is transferred to the external copy (the one referenced in the constructor).
1507 * This must be called by the client if he wants this to happen. Note that StoreAllL()
1508 * on the setting item list will call this for each setting item.
1510 IMPORT_C virtual void StoreL();
1512 * The external value is transferred to the internal value
1513 * This occurs at construction, but may be called by client code when required.
1515 IMPORT_C virtual void LoadL();
1518 * This launches the setting page (or just toggles) the binary setting
1520 * @param aCalledFromMenu - This flag determines if the setting page actually
1521 * launches or not. It does not if this flag is EFalse - the value is just toggled
1524 IMPORT_C virtual void EditItemL( TBool aCalledFromMenu );
1528 * Method called by framework to complete the construction. Extra allocations of
1529 * memory or extra resource reading can happen here.
1532 IMPORT_C virtual void CompleteConstructionL();
1534 IMPORT_C void CAknSettingItem_Reserved();
1541 * This class can be used as a base class for "Big Settings". The additional
1542 * functionality is small - merely to ensure that there is an empty string
1543 * in the list box text.
1545 * To derive from this class, the client code is usually expected to add a new constructor,
1546 * re-implement StoreL, LoadL() and EditItemL().
1549 class CAknBigSettingItemBase : public CAknSettingItem
1553 * Contruct the "Big" setting item. The passed resource identifier all that is needed
1554 * There is no external value to reference.
1556 IMPORT_C CAknBigSettingItemBase( TInt aIdentifier );
1560 * This method obtains the current value's setting text
1562 * @return Reference to descriptor with the text
1564 IMPORT_C virtual const TDesC& SettingTextL();
1566 IMPORT_C void CAknSettingItem_Reserved();
1569 const TDesC& iEmptyString;
1575 * This class holds the setting items themselves and also manages the bitmap array
1577 class CAknSettingItemArray : public CArrayPtrFlat<CAknSettingItem>, public MDesCArray
1581 * CAknSettingItemArray is constructed as a numbered or unnumbered array.
1582 * @param aGranularity - number of items to extend when the aarray needs extention
1583 * @param aIsNumbered - flags the array as numbered or not
1584 * @param aInitialOrdinal - value to start the numbering at
1586 IMPORT_C CAknSettingItemArray( TInt aGranularity, TBool aIsNumbered, TInt aInitialOrdinal );
1590 IMPORT_C virtual ~CAknSettingItemArray();
1592 // from MDesC16Array
1594 * Method by which the CAknSetStyleListBox accesses the number of items in the array
1595 * @return number of items in the array
1597 IMPORT_C TInt MdcaCount() const;
1599 * Method by which the setting item list accesses the text for the aIndex-th item in the
1602 * @param aIndex index at which to access the listbox text
1603 * @return Descriptor for this item to be used by the listbox.
1605 IMPORT_C TPtrC16 MdcaPoint(TInt aIndex) const;
1606 // For hidden item support
1608 * This method returns the true index in the array given the index as would be
1609 * calculated by looking at the visible items.
1611 * @param aVisibleIndex - index among the visible items
1612 * @return the corresponding "true" index in the array
1614 IMPORT_C TInt ItemIndexFromVisibleIndex( TInt aVisibleIndex ) const;
1616 * Update date the mapping of visible indices. To be called when an item is made
1617 * visible or invisible.
1620 IMPORT_C virtual void RecalculateVisibleIndicesL();
1622 * This is used to update the initial setting number for the top index. The number set
1623 * is the for the 0-th "true" or data index. That is, this numbered item may not show up
1626 IMPORT_C void SetInitialOrdinal( TInt aInitialOrdinal );
1628 * Method used to transfer flags from the CAknSettingItemList to this array
1630 IMPORT_C void SetFlags( TInt aFlags );
1634 * Set the number of visible items.
1635 * @param aCount number of items that are visible.
1637 IMPORT_C void SetVisibleCount( TInt aCount );
1639 * Returns the number of visible items
1641 * @return the number of visible items
1643 IMPORT_C TInt VisibleCount() const;
1647 TInt iInitialOrdinal;
1653 class CAknSettingItemList : public CAknControl , public MEikListBoxObserver
1656 enum TAknSettingItemStyle
1658 ENumberedStyle, // The setting item list displays number
1659 EUnnumberedStyle // The setting item list does not disply number
1664 * Constructs the setting item list
1666 IMPORT_C CAknSettingItemList();
1670 IMPORT_C ~CAknSettingItemList();
1674 * 2nd-stage construction from resource id
1676 IMPORT_C void ConstructFromResourceL(TInt aResourceId );
1678 * 2nd-stage construction from constructed resource reader
1680 IMPORT_C void ConstructFromResourceL( TResourceReader& aReader );
1683 * @return the number of component controls
1685 IMPORT_C TInt CountComponentControls() const;
1688 * @return a reference to the component control at index aId
1690 IMPORT_C CCoeControl* ComponentControl(TInt aId ) const;
1693 * Handles keys sent to this control
1695 IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
1697 * Take action necessary when the focus is change
1699 IMPORT_C virtual void FocusChanged(TDrawNow aDrawNow);
1702 * Handles a change to the control's resources of type aType
1703 * which are shared across the environment, e.g. colors or fonts.
1706 * @param aType Reason for the "resource" change, usually an system event UID
1708 IMPORT_C void HandleResourceChange(TInt aType);
1710 // from MEikListBoxObserver
1711 IMPORT_C virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
1714 // Framework methods
1717 * This launches the setting page for the current item by calling EditItemL on it
1719 * @param aIndex - current item's (Visible) index in the list
1720 * aCalledFromMenu- ignored in most classes; may alter the behaviour
1721 * of the setting page
1723 IMPORT_C virtual void EditItemL(TInt aIndex, TBool aCalledFromMenu);
1726 * Calls LoadL() on each item in the MAknSettingItemArray.
1729 IMPORT_C virtual void LoadSettingsL();
1731 * This command calls StoreL on all the setting items (hidden or not)
1733 * This must be called by the client if he wants it to occur
1735 IMPORT_C virtual void StoreSettingsL(); // call StoreL() on each item in MAknSettingItemArray
1738 * @param aInclude If EFalse, numbering does not include hidden items
1739 * Otherwise, they are
1741 IMPORT_C void SetIncludeHiddenInOrdinal( TBool aInclude );
1744 * @return EFalse if the listbox is not numbered style; Not EFalse otherwise
1746 IMPORT_C TBool IsNumberedStyle();
1748 * @return the listbox used by setting item list
1750 IMPORT_C CEikFormattedCellListBox* ListBox(); // get the listbox
1752 * @return a pointer to the setting item array; No ownership is transferred
1754 IMPORT_C CAknSettingItemArray* SettingItemArray() const;
1756 * Method to be called when the client code has added or removed items or their visibility;
1757 * This should be called when a single event's batch of array or visibility changes
1758 * is complete in order to avoid more re-draws than is necessary
1760 IMPORT_C void HandleChangeInItemArrayOrVisibilityL();
1763 * Handles pointer events
1765 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1769 * Framework method to create a setting item based upon the user id aSettingId. The
1770 * client code decides what type to contruct. new (ELeave) must then be used and the resulting
1771 * pointer returned. Ownership is thereafter base class's responsiblity.
1773 * @param aSettingId ID to use to determine the type of the setting item
1774 * @return a constructed (not 2nd-stage constructed) setting item.
1776 IMPORT_C virtual CAknSettingItem* CreateSettingItemL( TInt aSettingId );
1781 IMPORT_C void* ExtensionInterface( TUid aInterface );
1784 void UpdateAllListBoxTextsL() const;
1789 CEikFormattedCellListBox* iSettingItemListBox;
1790 CAknSettingItemArray* iSettingItemArray;
1792 // Other non-CBase classes
1793 HBufC* iSettingItemListTitle; // Owned
1795 // Internal information
1797 TInt iInitialOrdinal;