williamr@2: /* williamr@2: * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * Support for Setting Item Lists (See Selection Service specification) williamr@2: * Contains setting item classes (whole hierarchy) and the williamr@2: * array classes used to set up the setting item listbox williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #if !defined(__AKNSETTINGITEMLIST_H__) williamr@2: #define __AKNSETTINGITEMLIST_H__ williamr@2: williamr@2: #include williamr@2: williamr@2: #include williamr@2: williamr@2: // For graphics API williamr@2: #include williamr@2: williamr@2: // For CEikFormattedListBox williamr@2: #include williamr@2: williamr@2: // For setting page williamr@2: #include williamr@2: williamr@2: // For query stuff williamr@4: #include williamr@2: williamr@2: williamr@2: // Maximum length of the blanking text williamr@2: const TInt KMaxPasswordBlankingTextLength = 10; williamr@2: williamr@2: class CAknSettingItemExtension; williamr@2: williamr@2: williamr@2: /** williamr@2: * CAknSettingItem is the base class for all setting items. The abstracted functionality williamr@2: * is implemented in this class if possible. williamr@2: * williamr@2: * All array of setting items is held in CAknSettingItemArray, which in turn is owned by williamr@2: * CAknSettingItemList, a listbox type. williamr@2: * williamr@2: */ williamr@2: class CAknSettingItem : public CBase, public MAknSettingPageObserver williamr@2: { williamr@2: williamr@2: friend class CAknSettingItemArray; williamr@2: williamr@2: public: williamr@2: enum TFlags williamr@2: { williamr@2: EIsHidden = 0x1, williamr@2: EHasIcon = 0x2, williamr@2: EIsNumberedStyle = 0x4, williamr@2: ENoProtection = 0x8, williamr@2: EViewOnly = 0x10, williamr@2: EProtected = 0x20 williamr@2: }; williamr@2: williamr@2: // Setting item protection states williamr@2: enum TSettingItemProtection williamr@2: { williamr@2: ENoSettingItemProtection, williamr@2: ESettingItemViewOnly, williamr@2: ESettingItemProtected williamr@2: }; williamr@2: public: williamr@2: /** williamr@2: * Constructor williamr@2: * williamr@2: * @param the unique identifier fo the setting item (not its number) williamr@2: */ williamr@2: IMPORT_C CAknSettingItem( TInt identifier ); williamr@2: williamr@2: /** williamr@2: * Destructor williamr@2: */ williamr@2: IMPORT_C ~CAknSettingItem(); williamr@2: williamr@2: /** williamr@2: * williamr@2: * 2nd-stage constuctor. Resource for setting item is read externally in setting item list williamr@2: * and the values are passed here. williamr@2: */ williamr@2: IMPORT_C void ConstructL( williamr@2: const TBool aIsNumberedStyle, williamr@2: const TInt aOrdinal, williamr@2: const TDesC& aSettingTitle, williamr@2: CArrayPtr* aIconArray, williamr@2: const TInt aSettingPageResource, williamr@2: const TInt aEditorControlType, williamr@2: const TInt aSettingEditorResource = 0, williamr@2: const TInt aAssociatedResource = 0 ); williamr@2: williamr@2: /** williamr@2: * This command externalizes the current setting. The displayed (internal) copy williamr@2: * is transferred to the external copy (the one referenced in the constructor). williamr@2: * williamr@2: * This must be called by the client if he wants this to happen. Note that StoreAllL() williamr@2: * on the setting item list will call this for each setting item. williamr@2: */ williamr@2: IMPORT_C virtual void StoreL(); williamr@2: /* williamr@2: * The external value is transferred to the internal value williamr@2: * This occurs at construction, but may be called by client code when required. williamr@2: */ williamr@2: IMPORT_C virtual void LoadL(); williamr@2: /** williamr@2: * williamr@2: * This launches the setting page williamr@2: * williamr@2: * @param aCalledFromMenu - ignored in this class williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void EditItemL( TBool aCalledFromMenu ); williamr@2: /** williamr@2: * williamr@2: * This method is called by framework in order to update the text in the setting williamr@2: * item. It may be called by the client. williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void UpdateListBoxTextL(); williamr@2: williamr@2: /** williamr@2: * Access to the setting Name williamr@2: *.@return the setting name williamr@2: */ williamr@2: IMPORT_C TPtrC SettingName(); williamr@2: /** williamr@2: * Access to the setting number williamr@2: * @return the setting number williamr@2: */ williamr@2: IMPORT_C TInt SettingNumber() const; williamr@2: /** williamr@2: * Access to the setting visibility williamr@2: * @return ETrue if the setting item is hidden williamr@2: */ williamr@2: IMPORT_C TBool IsHidden() const; williamr@2: /** williamr@2: * Access to the numbering style of the setting item williamr@2: * @return ETrue if it is numbered williamr@2: */ williamr@2: IMPORT_C TBool IsNumberedStyle() const; williamr@2: /** williamr@2: * Set the visibility williamr@2: * @param Set to ETrue to hide the item; EFalse to make it visible williamr@2: * williamr@2: * Note that the setting item array must have be notified of this williamr@2: * by calling CAknSettingItemList::HandleChangeInItemArrayOrVisibility williamr@2: */ williamr@2: IMPORT_C void SetHidden(TBool aHidden ); williamr@2: /* williamr@2: * This method obtains the current value's setting text williamr@2: * williamr@2: * @return Reference to descriptor with the text williamr@2: */ williamr@2: IMPORT_C virtual const TDesC& SettingTextL(); williamr@2: /** williamr@2: * This gives access to the listbox text content at this item (fully decorated) williamr@2: * williamr@2: * @return pointer to listboxtext. No allocation is performed and no change of ownership williamr@2: */ williamr@2: IMPORT_C HBufC* ListBoxText(); williamr@2: /** williamr@2: * Access to the setting item's identifier. This is set in the setting item's constructor williamr@2: * but usually comes via resource in the setting item list read of its resource structure williamr@2: * williamr@2: * @return The identifier of this setting item williamr@2: */ williamr@2: IMPORT_C TInt Identifier() const; williamr@2: /** williamr@2: * Checks if the setting item has a bitmap in its setting contents williamr@2: * @return ETrue if it has a bitmap williamr@2: */ williamr@2: IMPORT_C TBool HasIcon() const; williamr@2: /** williamr@2: * This sets the text to display if the current setting is empty. williamr@2: * williamr@2: * @param text to make display when there is empty setting. A copy is made in the setting item williamr@2: */ williamr@2: IMPORT_C void SetEmptyItemTextL( const TDesC& aEmptyItemText ); williamr@2: IMPORT_C void SetCompulsoryIndTextL( const TDesC& aCompulsoryInd ); williamr@2: williamr@2: // From MAknSettingPageObserver williamr@2: IMPORT_C virtual void HandleSettingPageEventL(CAknSettingPage* aSettingPage,TAknSettingPageEvent aEventType ); williamr@2: /** williamr@2: * Get the index at which this item appears in the listbox williamr@2: * williamr@2: * @return index in listbox williamr@2: */ williamr@2: IMPORT_C TInt VisibleIndex(); williamr@2: williamr@2: /** williamr@2: * Set the flags that are required for some of the setting page constructors williamr@2: * williamr@2: * @param aFlagPattern Flag pattern to set williamr@2: */ williamr@2: IMPORT_C void SetSettingPageFlags( TInt aFlagPattern); williamr@2: williamr@2: /** williamr@2: * Access method for the setting page specific flags williamr@2: * @return the flag pattern williamr@2: */ williamr@2: IMPORT_C TInt SettingPageFlags( ) const; williamr@2: williamr@2: /** williamr@2: * Set the parent lisbox into the setting item williamr@2: * williamr@2: * @since 2.0 williamr@2: * @param aListBox listbox with which the setting item is associated. williamr@2: */ williamr@2: void SetParentListBox( const CEikFormattedCellListBox* aListBox ); williamr@2: williamr@2: /** williamr@2: * Set the protection state of the setting item williamr@2: * williamr@2: * The protection state is for protecting selected settings from editing. williamr@2: * The protection can be set to: williamr@2: * - prohibit opening of the setting page williamr@2: * - allow access to the setting page, but prohibit editing of it williamr@2: * williamr@2: * The protected item is indicated in the setting item list with a lock icon. williamr@2: * If a user tries to open a protected setting item, a notification is shown williamr@2: * to the user. williamr@2: * williamr@2: * The "view only" -mode is only possible for pop-up setting page. williamr@2: * williamr@2: * @since 3.1 williamr@2: * @param aProtected Sets the protection state of the setting item williamr@2: */ williamr@2: IMPORT_C void SetProtectionState( CAknSettingItem::TSettingItemProtection aProtected ); williamr@2: williamr@2: /** williamr@2: * Get the protection state williamr@2: * williamr@2: * See SetProtected for details for the different states. williamr@2: * williamr@2: * @since 3.1 williamr@2: * @return Protection state of the setting item williamr@2: */ williamr@2: IMPORT_C CAknSettingItem::TSettingItemProtection ProtectionState(); williamr@2: williamr@2: protected: williamr@2: williamr@2: williamr@2: /** williamr@2: * Method called by framework to complete the construction. Extra allocations of williamr@2: * memory or extra resource reading can happen here. williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void CompleteConstructionL(); williamr@2: /** williamr@2: * williamr@2: * Method to obtain a new bitmap for the setting content williamr@2: * williamr@2: * This method is usually empty in setting items classes except for volume and slider. williamr@2: * Any derived implementations of this method should call SetIconMask(). williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual CFbsBitmap* CreateBitmapL(); williamr@2: williamr@2: // Utilities williamr@2: /** williamr@2: * williamr@2: * A setting page should know when it is "Editing". This is set in EditItemL williamr@2: * and cleared to 0 when the dialog is finished. williamr@2: * williamr@2: * @param pointer to the currently executing settting page dialog williamr@2: * williamr@2: */ williamr@2: IMPORT_C void SetSettingPage( CAknSettingPage* aSettingPage ); williamr@2: /* williamr@2: * Access to the current setting page williamr@2: * williamr@2: * @return pointer to the currently executing setting page. 0 if there is none williamr@2: */ williamr@2: IMPORT_C CAknSettingPage* SettingPage() const; williamr@2: /** williamr@2: * Performs standard setup on a setting page williamr@2: * williamr@2: */ williamr@2: IMPORT_C void SetUpStandardSettingPageL(); williamr@2: /** williamr@2: * Access to the empty text that has been set, or is default williamr@2: * williamr@2: * @return ref to empty text descriptor williamr@2: */ williamr@2: IMPORT_C TDesC& EmptyItemText() const; // Assumed only needs to be used by SettingTextL williamr@2: williamr@2: /** williamr@2: * Access to the setting page resource id that might have been read by williamr@2: * the setting item resource. williamr@2: * williamr@2: * @return 0 or the setting page resource id williamr@2: */ williamr@2: IMPORT_C TInt SettingPageResourceId() const; williamr@2: /** williamr@2: * Access to the setting page editor's resource id that might have been read by williamr@2: * the setting item resource. williamr@2: * williamr@2: * @return 0 or the setting page editor's id williamr@2: */ williamr@2: IMPORT_C TInt SettingEditorResourceId() const; williamr@2: /** williamr@2: * Returns the associate editor resource. This is an LLINK in the seting item williamr@2: * resource that subclasses can use in CompleteContstructionL williamr@2: * williamr@2: * @return 0 or the extra resource id williamr@2: */ williamr@2: IMPORT_C TInt AssociatedResourceId() const; williamr@2: /** williamr@2: * williamr@2: * @return the control type of the settin page editor williamr@2: * williamr@2: */ williamr@2: TInt EditorControlType() const; williamr@2: williamr@2: /** williamr@2: * This sets the mask of this setting item's icon array, if it exists. williamr@2: * The normal usage of this routine is inside a re-implementation of CAknSettingItem::CreateBitmapL. williamr@2: * It is used to set the mask of the setting item's setting icon as a side effect of a williamr@2: * framework call to CreateBitmapL williamr@2: * williamr@2: * The return value may need to be looked at to decide how to dispose of, for example, an williamr@2: * a CGulIcon that may be holding the mask. williamr@2: * williamr@2: * @since 2.0 williamr@2: * @param aMask bitmap to set as a mask for the CGulIcon in the setting listbox's icon array williamr@2: * @return TBool ETrue if the ownership of aMask has been passed williamr@2: */ williamr@2: IMPORT_C TBool SetIconMask( CFbsBitmap* aMask ); williamr@2: williamr@2: /** williamr@2: * This sets the mask of this setting item's icon array, if it exists, using the mask from the williamr@2: * passed icon. williamr@2: * It returns the bitmap from the aIcon. williamr@2: * The method also takes ownership of aIcon and may delete it (but not its bitmap). williamr@2: * williamr@2: * @since 2.0 williamr@2: * @param aIcon icon of which the mask is passed through to SetIconMask() and bitmap is returned williamr@2: * @return CFbsBitmap* bitmap from aIcon. Ownership of the bitmap is transfered to the caller williamr@2: */ williamr@2: CFbsBitmap* SetIconMaskAndReturnBitmap( CGulIcon* aIcon ); williamr@2: private: williamr@2: /** williamr@2: * This routine causes any bitmaps that are extracted from setting pages to be updated williamr@2: * according to the current (internal) setting value williamr@2: */ williamr@2: void UpdateBitmapL(); williamr@2: williamr@2: /** williamr@2: * Set the index at which the item is to appear in the setting item list williamr@2: * Only needed by CAknSettingItemArray williamr@2: */ williamr@2: void SetVisibleIndex( TInt aVisibleIndex ); williamr@2: williamr@2: /** williamr@2: * Set the ordinal value. This is used for dynamic changing of the ordinal by williamr@2: * CAknSettingItemArray williamr@2: * williamr@2: */ williamr@2: void SetOrdinal( TInt aOrdinal ); williamr@2: williamr@2: /** williamr@2: * williamr@2: * Clean up a setting text for display by replacing all non printing characters williamr@2: * by spaces williamr@2: * williamr@2: */ williamr@2: TPtrC ReplaceNonPrintingCharacters( TDes& aTextToClean ); williamr@2: private: williamr@2: IMPORT_C void CAknSettingItem_Reserved(); williamr@2: williamr@2: private: williamr@2: TUint iFlags; williamr@2: TInt iIdentifier; williamr@2: TInt iOrdinal; williamr@2: TInt iSettingIdentifier; williamr@2: TInt iSettingPageResourceId; williamr@2: TInt iEditorControlType; williamr@2: TInt iSettingEditorResourceId; williamr@2: TInt iAssociatedResourceId; williamr@2: TInt iIconIndex; // Only valid if relevant bit is set in iFlags williamr@2: HBufC* iEmptyItemText; // Owned williamr@2: williamr@2: HBufC* iSettingName; // Owned williamr@2: HBufC* iListBoxText; // Owned williamr@2: HBufC* iCompulsoryText; // Owned williamr@2: williamr@2: williamr@2: // Following are not owned williamr@2: CAknSettingPage* iSettingPage; // This is a ref that is valid when non-0 - when the SP is "up" williamr@2: CArrayPtr* iIconArray; // Reference to the array only ! williamr@2: williamr@2: TInt iVisibleIndex; williamr@2: // Set flags that are in the Setting pages' constructors williamr@2: TInt iSettingPageFlags; williamr@2: williamr@2: // Pointer to the listbox that the setting item is providing data to williamr@2: const CEikFormattedCellListBox* iParentListBox; // Not owned williamr@2: williamr@2: CAknSettingItemExtension* iExtension; williamr@2: }; williamr@2: williamr@2: /** williamr@2: * Support for abstact text setting type. Corresponds to CAknTextSettingPage williamr@2: * williamr@2: */ williamr@2: class CAknTextSettingItem : public CAknSettingItem williamr@2: { williamr@2: public: williamr@2: /* williamr@2: * Constructor williamr@2: * williamr@2: * @param resource identifier for this setting item williamr@2: * @param Setting text williamr@2: * williamr@2: */ williamr@2: IMPORT_C CAknTextSettingItem( TInt aIdentifier, TDes& aText ); williamr@2: williamr@2: /** williamr@2: * Destructor williamr@2: */ williamr@2: IMPORT_C ~CAknTextSettingItem(); williamr@2: williamr@2: /** williamr@2: * This command externalizes the current setting. The displayed (internal) copy williamr@2: * is transferred to the external copy (the one referenced in the constructor). williamr@2: * williamr@2: * This must be called by the client if he wants this to happen. Note that StoreAllL() williamr@2: * on the setting item list will call this for each setting item. williamr@2: */ williamr@2: IMPORT_C virtual void StoreL(); williamr@2: williamr@2: /* williamr@2: * The external value is transferred to the internal value williamr@2: * This occurs at construction, but may be called by client code when required. williamr@2: */ williamr@2: IMPORT_C virtual void LoadL(); // Called from 2nd stage constructors williamr@2: williamr@2: /* williamr@2: * This method obtains the current value's setting text. williamr@2: * williamr@2: * The reference is returned and is not a copy of the text, but refers to the current williamr@2: * internal text value. This is the value that would be externalized if StoreL were called. williamr@2: * An exception to this is if the current text is zero length. In that case a reference to the williamr@2: * empty text is returned (which would not be externalized if StoreL is called). williamr@2: * williamr@2: * @return Reference to descriptor with the current internal text williamr@2: */ williamr@2: IMPORT_C virtual const TDesC& SettingTextL(); williamr@2: williamr@2: /** williamr@2: * williamr@2: * This launches the setting page for text editing williamr@2: * williamr@2: * @param aCalledFromMenu - ignored in this class williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void EditItemL( TBool aCalledFromMenu ); williamr@2: williamr@2: protected: williamr@2: williamr@2: /** williamr@2: * Access for re-implementors to the internal text williamr@2: * williamr@2: * @return reference to a TPtr holding the internal text williamr@2: */ williamr@2: IMPORT_C TPtr& InternalTextPtr(); williamr@2: williamr@2: /** williamr@2: * Access for re-implementors to the external text williamr@2: * williamr@2: * @return TPtrC pointing to the external text williamr@2: */ williamr@2: IMPORT_C TPtrC ExternalText(); williamr@2: williamr@2: /** williamr@2: * Allows re-implementors to set the external text williamr@2: * No change of ownership is implied. williamr@2: * williamr@2: * @param a reference to the external text williamr@2: * williamr@2: */ williamr@2: IMPORT_C void SetExternalText( TDesC& aNewExternalText ); williamr@2: private: williamr@2: IMPORT_C void CAknSettingItem_Reserved(); williamr@2: williamr@2: private: williamr@2: TDes& iExternalText; williamr@2: HBufC* iInternalText; // Owned williamr@2: TPtr iInternalTextPtr; williamr@2: TInt iSpare_Text_1; williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: * williamr@2: * Abstract setting item for integer editing. williamr@2: * williamr@2: * This class is not disposed toward any particular type of setting page williamr@2: * williamr@2: */ williamr@2: class CAknIntegerSettingItem : public CAknSettingItem williamr@2: { williamr@2: public: williamr@2: /* williamr@2: * Constructor williamr@2: * williamr@2: * @param resource identifier for this setting item williamr@2: * @param integer value to edit. williamr@2: * williamr@2: */ williamr@2: IMPORT_C CAknIntegerSettingItem( TInt aIdentifier, TInt& aValue ); williamr@2: IMPORT_C ~CAknIntegerSettingItem(); williamr@2: williamr@2: /** williamr@2: * This command externalizes the current setting. The displayed (internal) copy williamr@2: * is transferred to the external copy (the one referenced in the constructor). williamr@2: * williamr@2: * This must be called by the client if he wants this to happen. Note that StoreAllL() williamr@2: * on the setting item list will call this for each setting item. williamr@2: */ williamr@2: IMPORT_C virtual void StoreL(); williamr@2: /* williamr@2: * The external value is transferred to the internal value williamr@2: * This occurs at construction, but may be called by client code when required. williamr@2: */ williamr@2: IMPORT_C virtual void LoadL(); williamr@2: williamr@2: /* williamr@2: * This method obtains the current value's setting text williamr@2: * williamr@2: * @return Reference to descriptor with the text williamr@2: */ williamr@2: IMPORT_C virtual const TDesC& SettingTextL(); williamr@2: williamr@2: /** williamr@2: * williamr@2: * Pure virtual editItemL williamr@2: * williamr@2: * @param aCalledFromMenu - ignored in this class williamr@2: * williamr@2: */ williamr@2: virtual void EditItemL( TBool aCalledFromMenu ) = 0; williamr@2: williamr@2: protected: williamr@2: /** williamr@2: * Method called by framework to complete the construction. Extra allocations of williamr@2: * memory or extra resource reading can happen here. williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void CompleteConstructionL(); williamr@2: williamr@2: /** williamr@2: * Method to access the internal value. williamr@2: * williamr@2: * @return a reference to the internal integer value williamr@2: */ williamr@2: IMPORT_C TInt& InternalValueRef(); williamr@2: williamr@2: /** williamr@2: * Method to access the external reference to the external value. Note that this class williamr@2: * only accesses the external integer via a copy of a reference to it. williamr@2: * williamr@2: * @return a reference to the external integer value williamr@2: */ williamr@2: IMPORT_C TInt& ExternalValueRef(); williamr@2: williamr@2: /** williamr@2: * Sets the external value's reference. The external vlue is externally owned, so williamr@2: * this does not make a copy. williamr@2: * @param TInt& aValue a reference to the external value williamr@2: */ williamr@2: IMPORT_C void SetExternalValue( TInt& aValue ); williamr@2: private: williamr@2: IMPORT_C void CAknSettingItem_Reserved(); williamr@2: williamr@2: private: williamr@2: TInt iInternalValue; williamr@2: TInt& iExternalValue; williamr@2: HBufC* iInternalText; // Owned williamr@2: TPtr iInternalTextPtr; williamr@2: }; williamr@2: williamr@2: williamr@2: class CAknIntegerEdwinSettingItem : public CAknIntegerSettingItem williamr@2: { williamr@2: public: williamr@2: IMPORT_C CAknIntegerEdwinSettingItem( TInt aIdentifier, TInt& aValue ); williamr@2: /** williamr@2: * williamr@2: * This launches the setting page for editing using the integer edwin class williamr@2: * williamr@2: * @param aCalledFromMenu - ignored in this class williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void EditItemL( TBool aCalledFromMenu ); williamr@2: private: williamr@2: IMPORT_C void CAknSettingItem_Reserved(); williamr@2: }; williamr@2: williamr@2: /** williamr@2: * williamr@2: * Class for holding a password setting item williamr@2: * williamr@2: */ williamr@2: class CAknPasswordSettingItem : public CAknTextSettingItem williamr@2: { williamr@2: public: williamr@2: enum TAknPasswordSettingItemMode williamr@2: { williamr@2: EAlpha, // password held is alphanumeric williamr@2: ENumeric // password is numeric ( digits 0 - 9 only used ) williamr@2: }; williamr@2: williamr@2: /* williamr@2: * Constructor williamr@2: * williamr@2: * @param resource identifier for this setting item williamr@2: * @param password mode; text or numeric williamr@2: * @param password to change williamr@2: */ williamr@2: IMPORT_C CAknPasswordSettingItem( TInt aIdentifier, enum TAknPasswordSettingItemMode aMode, TDes& aPassword ); williamr@2: williamr@2: /* williamr@2: * This method obtains the current value's setting text williamr@2: * williamr@2: * @return Reference to descriptor with the text williamr@2: */ williamr@2: IMPORT_C virtual const TDesC& SettingTextL(); williamr@2: /** williamr@2: * williamr@2: * This launches the setting page for password editing williamr@2: * williamr@2: * @param aCalledFromMenu - ignored in this class williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void EditItemL( TBool aCalledFromMenu ); williamr@2: williamr@2: protected: williamr@2: williamr@2: /** williamr@2: * Method called by framework to complete the construction. Extra allocations of williamr@2: * memory or extra resource reading can happen here. williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void CompleteConstructionL(); williamr@2: private: williamr@2: IMPORT_C void CAknSettingItem_Reserved(); williamr@2: williamr@2: private: williamr@2: TAknPasswordSettingItemMode iPasswordMode; williamr@2: // For holding the text to blank the setting item text williamr@2: TBuf iBlankingText; williamr@2: // For holding the resouce for a password query williamr@2: TInt iOldPasswordQueryResourceId; williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: * An abstract integer setting that uses the volume control as its editor williamr@2: * williamr@2: */ williamr@2: class CAknVolumeSettingItem : public CAknSettingItem williamr@2: { williamr@2: public: williamr@2: /* williamr@2: * Constructor williamr@2: * williamr@2: * @param resource identifier for this setting item williamr@2: * @param volume value. Must be in range 0 to 10, inclusive williamr@2: * williamr@2: */ williamr@2: IMPORT_C CAknVolumeSettingItem( TInt aIdentifier, TInt& aExternalVolume ); williamr@2: williamr@2: /** williamr@2: * This command externalizes the current setting. The displayed (internal) copy williamr@2: * is transferred to the external copy (the one referenced in the constructor). williamr@2: * williamr@2: * This must be called by the client if he wants this to happen. Note that StoreAllL() williamr@2: * on the setting item list will call this for each setting item. williamr@2: */ williamr@2: IMPORT_C virtual void StoreL(); williamr@2: /* williamr@2: * The external value is transferred to the internal value williamr@2: * This occurs at construction, but may be called by client code when required. williamr@2: */ williamr@2: IMPORT_C virtual void LoadL(); williamr@2: /* williamr@2: * This method obtains the current value's setting text williamr@2: * williamr@2: * @return Reference to descriptor with the text williamr@2: */ williamr@2: IMPORT_C virtual const TDesC& SettingTextL(); williamr@2: /** williamr@2: * williamr@2: * This launches the setting page for volume editing williamr@2: * williamr@2: * @param aCalledFromMenu - ignored in this class williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void EditItemL( TBool aCalledFromMenu ); williamr@2: williamr@2: protected: williamr@2: /** williamr@2: * Protected access to the volume value williamr@2: * williamr@2: * @return Reference to the internal volume value williamr@2: */ williamr@2: IMPORT_C TInt& InternalVolumeValue(); // For access to internal value for derived classes williamr@2: williamr@2: //From CAknSettingItem williamr@2: /** williamr@2: * williamr@2: * Obtain a bitmap from the CAknVolume williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual CFbsBitmap* CreateBitmapL(); williamr@2: private: williamr@2: IMPORT_C void CAknSettingItem_Reserved(); williamr@2: williamr@2: private: williamr@2: TInt& iExternalVolume; williamr@2: TInt iInternalVolume; williamr@2: williamr@2: }; williamr@2: williamr@2: /** williamr@2: * Slider control setting item williamr@2: * williamr@2: * williamr@2: */ williamr@2: williamr@2: class CAknSliderSettingItem : public CAknSettingItem williamr@2: { williamr@2: public: williamr@2: /* williamr@2: * Constructor williamr@2: * williamr@2: * @param resource identifier for this setting item williamr@2: * @param Slider value; must be within the minimum and maximum values in resource williamr@2: * williamr@2: */ williamr@2: IMPORT_C CAknSliderSettingItem( TInt aIdentifier, TInt& aExternalSliderValue ); williamr@2: williamr@2: /** williamr@2: * This command externalizes the current setting. The displayed (internal) copy williamr@2: * is transferred to the external copy (the one referenced in the constructor). williamr@2: * williamr@2: * This must be called by the client if he wants this to happen. Note that StoreAllL() williamr@2: * on the setting item list will call this for each setting item. williamr@2: */ williamr@2: IMPORT_C virtual void StoreL(); williamr@2: /* williamr@2: * The external value is transferred to the internal value williamr@2: * This occurs at construction, but may be called by client code when required. williamr@2: */ williamr@2: IMPORT_C virtual void LoadL(); williamr@2: /* williamr@2: * This method obtains the current value's setting text williamr@2: * williamr@2: * @return Reference to descriptor with the text williamr@2: */ williamr@2: IMPORT_C virtual const TDesC& SettingTextL(); williamr@2: /** williamr@2: * williamr@2: * This launches the setting page for slider editing williamr@2: * williamr@2: * @param aCalledFromMenu - ignored in this class williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void EditItemL( TBool aCalledFromMenu ); williamr@2: williamr@2: protected: williamr@2: /** williamr@2: * Method to create a setting page williamr@2: */ williamr@2: IMPORT_C virtual CAknSettingPage* CreateSettingPageL(); williamr@2: williamr@2: /** williamr@2: * Method to contruct the setting page (via CreateSettingPageL), and execute it williamr@2: */ williamr@2: IMPORT_C virtual void CreateAndExecuteSettingPageL(); williamr@2: williamr@2: /** williamr@2: * For access to internal value for derived classes williamr@2: * williamr@2: * @return A ref to the internal value williamr@2: */ williamr@2: IMPORT_C TInt& InternalSliderValue(); williamr@2: williamr@2: // From CAknSettingItem williamr@2: /** williamr@2: * williamr@2: * Obtain a bitmap from the CAknSlider williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual CFbsBitmap* CreateBitmapL(); williamr@2: private: williamr@2: IMPORT_C void CAknSettingItem_Reserved(); williamr@2: williamr@2: private: williamr@2: TInt& iExternalSliderValue; williamr@2: TInt iInternalSliderValue; // required for use in derived classes williamr@2: williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: * williamr@2: * Time or Date Setting Item williamr@2: * williamr@2: * This class combines the time and the date functionality, as determined by a mode williamr@2: * passed to the constructor. williamr@2: * williamr@2: * Time or Date setting pages are launched from here, which use Time or date editor williamr@2: * MFNEs to do the editing. williamr@2: * williamr@2: */ williamr@2: class CAknTimeOrDateSettingItem : public CAknSettingItem williamr@2: { williamr@2: public: williamr@2: enum TAknTimeOrDateSettingItemMode williamr@2: { williamr@2: ETime, williamr@2: EDate williamr@2: }; williamr@2: /* williamr@2: * Constructor williamr@2: * williamr@2: * @param resource identifier for this setting item williamr@2: * @param construct a Time or a Date setting item williamr@2: * @param IP address to be controlled by the setting editing williamr@2: * williamr@2: */ williamr@2: IMPORT_C CAknTimeOrDateSettingItem( TInt aIdentifier, enum TAknTimeOrDateSettingItemMode aMode, TTime& aTime ); williamr@2: /** williamr@2: * Destructor williamr@2: */ williamr@2: IMPORT_C ~CAknTimeOrDateSettingItem(); williamr@2: /** williamr@2: * Method called by framework to complete the construction. Extra allocations of williamr@2: * memory or extra resource reading can happen here. williamr@2: * williamr@2: */ williamr@2: IMPORT_C void CompleteConstructionL( ); williamr@2: williamr@2: /** williamr@2: * This command externalizes the current setting. The displayed (internal) copy williamr@2: * is transferred to the external copy (the one referenced in the constructor). williamr@2: * williamr@2: * This must be called by the client if he wants this to happen. Note that StoreAllL() williamr@2: * on the setting item list will call this for each setting item. williamr@2: */ williamr@2: IMPORT_C virtual void StoreL(); williamr@2: /* williamr@2: * The external value is transferred to the internal value williamr@2: * This occurs at construction, but may be called by client code when required. williamr@2: */ williamr@2: IMPORT_C virtual void LoadL(); williamr@2: /* williamr@2: * This method obtains the current value's setting text williamr@2: * williamr@2: * @return Reference to descriptor with the text williamr@2: */ williamr@2: IMPORT_C virtual const TDesC& SettingTextL(); williamr@2: /** williamr@2: * williamr@2: * This launches the setting page for Time or Date editing williamr@2: * williamr@2: * @param aCalledFromMenu - ignored in this class williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void EditItemL( TBool aCalledFromMenu ); williamr@2: /** williamr@2: * williamr@2: * Set the time or date format string. If this is not called, then a williamr@2: * localized, default string is used williamr@2: * williamr@2: */ williamr@2: IMPORT_C void SetTimeFormatStringL( const TDesC& aTimeFormat ); williamr@2: /** williamr@2: * williamr@2: * Obtain the time format string williamr@2: * williamr@2: * @return A pointer descriptor to the date/time format string williamr@2: */ williamr@2: IMPORT_C const TPtrC TimeFormatString(); williamr@2: private: williamr@2: IMPORT_C void CAknSettingItem_Reserved(); williamr@2: private: williamr@2: TTime& iExternalTime; williamr@2: TTime iInternalTime; williamr@2: HBufC* iInternalText; // Owned williamr@2: TPtr iInternalTextPtr; williamr@2: HBufC* iTimeFormat; williamr@2: TPtr iTimeFormatPtr; williamr@2: TAknTimeOrDateSettingItemMode iTimeOrDateMode; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: * williamr@2: * Time Offset Setting Item williamr@2: * williamr@2: * Time Offset page as launched from here, which use Offset editor williamr@2: * MFNEs to do the editing. williamr@2: * williamr@2: * @lib avkon williamr@2: * @since 2.0 williamr@2: williamr@2: */ williamr@2: class CAknTimeOffsetSettingItem : public CAknSettingItem williamr@2: { williamr@2: public: williamr@2: /* williamr@2: * Constructor williamr@2: * williamr@2: * @param resource identifier for this setting item williamr@2: * @param construct a Time offset setting item williamr@2: * williamr@2: */ williamr@2: IMPORT_C CAknTimeOffsetSettingItem( TInt aIdentifier, TTimeIntervalSeconds& aTime ); williamr@2: /** williamr@2: * Destructor williamr@2: */ williamr@2: IMPORT_C ~CAknTimeOffsetSettingItem(); williamr@2: /** williamr@2: * Method called by framework to complete the construction. Extra allocations of williamr@2: * memory or extra resource reading can happen here. williamr@2: * williamr@2: * @since 2.0 williamr@2: */ williamr@2: IMPORT_C void CompleteConstructionL( ); williamr@2: williamr@2: /** williamr@2: * This command externalizes the current setting. The displayed (internal) copy williamr@2: * is transferred to the external copy (the one referenced in the constructor). williamr@2: * williamr@2: * This must be called by the client if he wants this to happen. Note that StoreAllL() williamr@2: * on the setting item list will call this for each setting item. williamr@2: * williamr@2: * @since 2.0 williamr@2: */ williamr@2: IMPORT_C virtual void StoreL(); williamr@2: /* williamr@2: * The external value is transferred to the internal value williamr@2: * This occurs at construction, but may be called by client code when required. williamr@2: * williamr@2: * @since 2.0 williamr@2: */ williamr@2: IMPORT_C virtual void LoadL(); williamr@2: /* williamr@2: * This method obtains the current value's setting text williamr@2: * williamr@2: * @since 2.0 williamr@2: * @return Reference to descriptor with the text williamr@2: */ williamr@2: IMPORT_C virtual const TDesC& SettingTextL(); williamr@2: /** williamr@2: * williamr@2: * This launches the setting page for Time or Date editing williamr@2: * williamr@2: * @since 2.0 williamr@2: * @param aCalledFromMenu - ignored in this class williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void EditItemL( TBool aCalledFromMenu ); williamr@2: /** williamr@2: * williamr@2: * Set the time or date format string. If this is not called, then a williamr@2: * localized, default string is used williamr@2: * williamr@2: * @since 2.0 williamr@2: */ williamr@2: IMPORT_C void SetTimeFormatStringL( const TDesC& aTimeFormat ); williamr@2: /** williamr@2: * williamr@2: * Obtain the time format string williamr@2: * williamr@2: * @since 2.0 williamr@2: * @return A pointer descriptor to the date/time format string williamr@2: */ williamr@2: IMPORT_C const TPtrC TimeFormatString(); williamr@2: private: williamr@2: IMPORT_C void CAknSettingItem_Reserved(); williamr@2: private: williamr@2: TTimeIntervalSeconds iExternalTime; williamr@2: TTimeIntervalSeconds iInternalTime; williamr@2: HBufC* iInternalText; // Owned williamr@2: TPtr iInternalTextPtr; williamr@2: HBufC* iTimeFormat; williamr@2: TPtr iTimeFormatPtr; williamr@2: williamr@2: TInt iSpare; williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: * williamr@2: * IP Address setting item williamr@2: * williamr@2: * Abstract data type for IP address setting. Launches a CAknIpFieldSettingPage williamr@2: * that in turn uses the CAknIpFieldEditor williamr@2: * williamr@2: */ williamr@2: class CAknIpFieldSettingItem : public CAknSettingItem williamr@2: { williamr@2: public: williamr@2: /* williamr@2: * Constructor williamr@2: * williamr@2: * @param resource identifier for this setting item williamr@2: * @param IP address to be controlled by the setting editing williamr@2: * williamr@2: */ williamr@2: IMPORT_C CAknIpFieldSettingItem( TInt aIdentifier, TInetAddr& aIpAddress ); williamr@2: /** williamr@2: * williamr@2: * Destructor williamr@2: * williamr@2: */ williamr@2: IMPORT_C ~CAknIpFieldSettingItem(); williamr@2: williamr@2: /** williamr@2: * Method called by framework to complete the construction. Extra allocations of williamr@2: * memory or extra resource reading can happen here. williamr@2: * williamr@2: */ williamr@2: IMPORT_C void CompleteConstructionL( ); williamr@2: williamr@2: /** williamr@2: * This command externalizes the current setting. The displayed (internal) copy williamr@2: * is transferred to the external copy (the one referenced in the constructor). williamr@2: * williamr@2: * This must be called by the client if he wants this to happen. Note that StoreAllL() williamr@2: * on the setting item list will call this for each setting item. williamr@2: */ williamr@2: IMPORT_C virtual void StoreL(); williamr@2: /* williamr@2: * The external value is transferred to the internal value williamr@2: * This occurs at construction, but may be called by client code when required. williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void LoadL(); // Called from 2nd stage constructors williamr@2: /* williamr@2: * This method obtains the current value's setting text williamr@2: * williamr@2: * @return Reference to descriptor with the text williamr@2: */ williamr@2: IMPORT_C virtual const TDesC& SettingTextL(); williamr@2: /** williamr@2: * williamr@2: * This launches the setting page for IP address editing williamr@2: * williamr@2: * @param aCalledFromMenu - ignored in this class williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void EditItemL( TBool aCalledFromMenu ); williamr@2: private: williamr@2: IMPORT_C void CAknSettingItem_Reserved(); williamr@2: williamr@2: private: williamr@2: TInetAddr& iExternalIpAddress; williamr@2: TInetAddr iInternalIpAddress; williamr@2: HBufC* iInternalText; // Owned williamr@2: TPtr iInternalTextPtr; williamr@2: }; williamr@2: williamr@2: /** williamr@2: * Base class for a data object to hold a pointer and a corresponding integer value. williamr@2: * This is used to make a template class by CAknEnumeratedItem williamr@2: * williamr@2: */ williamr@2: class CAknEnumeratedItemBase : public CBase williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Construct an item consisting of an integer value and its co-ordinate pointer williamr@2: */ williamr@2: IMPORT_C CAknEnumeratedItemBase( TInt aEnumeratedValue, TAny* aValue ); williamr@2: /** williamr@2: * Destructor williamr@2: */ williamr@2: IMPORT_C ~CAknEnumeratedItemBase(); williamr@2: /** williamr@2: * Access the integer value williamr@2: * williamr@2: * @return the integer value of this item williamr@2: */ williamr@2: IMPORT_C TInt EnumerationValue() const; williamr@2: /** williamr@2: * Set the integer part of the object williamr@2: * williamr@2: * @param aNewValue Value to set williamr@2: */ williamr@2: IMPORT_C void SetEnumerationValue( TInt aNewValue ); williamr@2: /** williamr@2: * Access the pointer part of the object williamr@2: * williamr@2: * @return TAny* pointer to any type williamr@2: */ williamr@2: IMPORT_C TAny* Value() const; williamr@2: /** williamr@2: * Set the pointer part of the object williamr@2: * williamr@2: * @param pointer to store in the object; no copy model, no ownership transfer williamr@2: */ williamr@2: IMPORT_C void SetValue( TAny* aPtr ); williamr@2: private: williamr@2: TInt iEnumerationValue; williamr@2: TAny* iValue; williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: * Makes a template class from CAknEnumeratedItemBase williamr@2: * williamr@2: */ williamr@2: template williamr@2: class CAknEnumeratedItem : public CAknEnumeratedItemBase williamr@2: { williamr@2: public: williamr@2: inline CAknEnumeratedItem( TInt aEnumeratedValue, T* aValue ); williamr@2: inline ~CAknEnumeratedItem(); williamr@2: inline T* Value(); williamr@2: inline void SetValue( T* ); williamr@2: }; williamr@2: williamr@2: williamr@2: template williamr@2: inline CAknEnumeratedItem::CAknEnumeratedItem( TInt aEnumValue, T* aValue ) : williamr@2: CAknEnumeratedItemBase( aEnumValue, (TAny*)aValue) williamr@2: { williamr@2: } williamr@2: williamr@2: template williamr@2: inline CAknEnumeratedItem::~CAknEnumeratedItem() williamr@2: { williamr@2: delete (T*)Value(); williamr@2: } williamr@2: williamr@2: template williamr@2: inline T* CAknEnumeratedItem::Value() williamr@2: { williamr@2: return ( ( T* ) CAknEnumeratedItemBase::Value() ); williamr@2: } williamr@2: williamr@2: template williamr@2: inline void CAknEnumeratedItem::SetValue( T* aNewValue ) williamr@2: { williamr@2: CAknEnumeratedItemBase::SetValue( aNewValue ); williamr@2: } williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: * Definition of CAknEnumeratedText williamr@2: */ williamr@2: typedef CAknEnumeratedItem CAknEnumeratedText; williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: * CAknEnumeratedTextSettingItem williamr@2: * williamr@2: * Abstract Base class for deriving listbox setting page related setting items williamr@2: * williamr@2: * The class provides standard array support for these setting items and their williamr@2: * listboxes. Then approach is centred upon the CAknEnumeratedText type. williamr@2: * williamr@2: * The texts are exposed to the user, and appear in two versions, if desired - the text shown williamr@2: * in the setting list when not being edited, and the "popped-up" version of the texts. williamr@2: * williamr@2: */ williamr@2: class CAknEnumeratedTextSettingItem : public CAknSettingItem williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Constructor. Resource Id for the setting item williamr@2: * williamr@2: */ williamr@2: IMPORT_C CAknEnumeratedTextSettingItem( TInt aResourceId ); williamr@2: williamr@2: /** williamr@2: * Destructor williamr@2: */ williamr@2: IMPORT_C ~CAknEnumeratedTextSettingItem(); williamr@2: williamr@2: // williamr@2: // From CAknSettingItem williamr@2: // williamr@2: protected: williamr@2: williamr@2: /** williamr@2: * williamr@2: * Virtual method called by framework to complete the construction. williamr@2: * In this class, the two arrays, pointers to which can be obtained by calling williamr@2: * EnumeratedTextArray() and PoppedUpTextArray() are created. williamr@2: * williamr@2: */ williamr@2: IMPORT_C void CompleteConstructionL(); williamr@2: williamr@2: private: williamr@2: IMPORT_C void CAknSettingItem_Reserved(); williamr@2: williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Access to the enumerated text array. Texts here are used in the setting item list williamr@2: * display. williamr@2: * No ownership of the array or its contents is transferred williamr@2: * williamr@2: * @return a pointer to an array of HBufC*s williamr@2: */ williamr@2: IMPORT_C CArrayPtr* EnumeratedTextArray() const; williamr@2: williamr@2: /** williamr@2: * Access to the "popped up" array of texts. They may be defined differently from williamr@2: * those in the enumerated text array so that the setting page items can be different williamr@2: * from those displayed in the setting item editing list williamr@2: * No ownership of the array or its contents is transferred williamr@2: * williamr@2: * @return a pointer to an array of HBufC*s williamr@2: */ williamr@2: IMPORT_C CArrayPtr* PoppedUpTextArray() const; williamr@2: williamr@2: /** williamr@2: * Set the enumerated arrays. williamr@2: * Ownership of these arrays and their contents is wholly given over to the setting item williamr@2: * object. The client must call HandleTextArrayUpdateL() after making this call. williamr@2: * williamr@2: * After calling SetEnumeratedTextArrays(), it is the client code's responsibility to ensure that williamr@2: * the current value of the external Tint value corresponds to one of the enumerated texts. This can williamr@2: * be done, for instance, after calling SetEnumeratedTextArrays() by calling IndexFromValue() and williamr@2: * ensuring a return value of a valid index (not -1 ). Otherwise, there will be a panic in williamr@2: * HandleTextArrayUpdateL() when it is called. williamr@2: * williamr@2: * This call transfers the ownership of the arrays, and the items pointed to by the arrays williamr@2: * williamr@2: * @param aEnumeratedTextArray array of Integer-Text pairs to be the new basis for display williamr@2: * This is the master array, and its Count() determines the number of entries to display williamr@2: * @param aPoppedUpTextArray array of Text descriptors that provide versions of the text williamr@2: * to display in the setting page listbox. The array pointer must be valid, but the williamr@2: * array need not contain any entries. Only those entries that need to be different williamr@2: * from those in aEnumeratedTextArray needs be present; williamr@2: */ williamr@2: IMPORT_C void SetEnumeratedTextArrays( CArrayPtr* aEnumeratedTextArray, williamr@2: CArrayPtr* PoppedUpTextArray ); williamr@2: /** williamr@2: * Called to execute any code that might need to run when the text arrays are replaced. williamr@2: * This class has a null implementation williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void HandleTextArrayUpdateL(); williamr@2: williamr@2: /** williamr@2: * Access to the number of items in the arrays williamr@2: * williamr@2: * @return The number of items in the array returned by EnumeratedTextArray() williamr@2: */ williamr@2: IMPORT_C TInt NumberOfItems() const; williamr@2: williamr@2: /** williamr@2: * Routine to find the index in the enumerated text list that corresponds to the value williamr@2: * passed in. williamr@2: * williamr@2: * @param aInputValue value to search for in the enumerated items williamr@2: * @return 0 - based index in the item found. -1 if not found. williamr@2: * williamr@2: */ williamr@2: IMPORT_C TInt IndexFromValue( TInt aInputValue ) const; williamr@2: williamr@2: protected: williamr@2: williamr@2: /** williamr@2: * Implementors of subclasses can call this non-virtual method to set up the list of texts williamr@2: * to be used for the setting page. (Although it is not useful for CAknCheckBoxSettingPage) williamr@2: * The list is constructed from the contents of the two williamr@2: * text arrays, EnumeratedTextArray() and PoppedUpTextArray(). This is usually to be done williamr@2: * "On the fly" immediately prior to the raising of a setting page. williamr@2: */ williamr@2: IMPORT_C void SetSettingPageTextL(); williamr@2: williamr@2: /** williamr@2: * Accessor for the setting page text array williamr@2: */ williamr@2: IMPORT_C CDesCArray* SettingPageTextArray() const; williamr@2: williamr@2: private: williamr@2: williamr@2: /** williamr@2: * The primary text arrays (those set by SetEnumeratedTextArrays) are deleted and their williamr@2: * references zeroed. williamr@2: */ williamr@2: void DeleteAndZeroPrimaryArrays(); williamr@2: williamr@2: private: williamr@2: TInt iTextPopupFlags; williamr@2: CArrayPtr* iEnumeratedTextArray; // Owned and pointed to objects are owned williamr@2: CArrayPtr* iPoppedUpTextArray; // Owned and the HBufCs are owned here williamr@2: TInt iEnumeratedTextArrayResourceId; williamr@2: TInt iPoppedUpTextArrayResourceId; williamr@2: CDesCArrayFlat* iSettingPageText; // Owned williamr@2: HBufC* iSpare; // Formerly space was used by iEmptyText; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: * Setting item type for CAknEnumeratedItems. williamr@2: * williamr@2: * The main use case for this is for list of texts that are being manipulated in the williamr@2: * client source code as a set of enumerations, while the texts, read from resource, williamr@2: * are not strongly exposed to the client. williamr@2: * williamr@2: * They are exposed to the user, and appear in two versions, if desired - the text shown williamr@2: * in the setting list when not being edited, and the "popped-up" version of the texts. williamr@2: * williamr@2: */ williamr@2: class CAknEnumeratedTextPopupSettingItem : public CAknEnumeratedTextSettingItem williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Construct a list, storing in it a resource (to be read at 2nd stage construction) williamr@2: * and a reference to na externally owned integer - the value to be manipulated williamr@2: * williamr@2: */ williamr@2: IMPORT_C CAknEnumeratedTextPopupSettingItem( TInt aResourceId, TInt& aValue ); williamr@2: williamr@2: /** williamr@2: * Destructor williamr@2: */ williamr@2: IMPORT_C ~CAknEnumeratedTextPopupSettingItem(); williamr@2: williamr@2: /** williamr@2: * This command externalizes the current setting. The displayed (internal) copy williamr@2: * is transferred to the external copy (the one referenced in the constructor). williamr@2: * williamr@2: * This must be called by the client if he wants this to happen. Note that StoreAllL() williamr@2: * on the setting item list will call this for each setting item. williamr@2: */ williamr@2: IMPORT_C virtual void StoreL(); williamr@2: williamr@2: /* williamr@2: * The external value is transferred to the internal value williamr@2: * This occurs at construction, but may be called by client code when required. williamr@2: */ williamr@2: IMPORT_C virtual void LoadL(); williamr@2: williamr@2: /* williamr@2: * This method obtains the current value's setting text williamr@2: * williamr@2: * @return Reference to descriptor with the text williamr@2: */ williamr@2: IMPORT_C virtual const TDesC& SettingTextL(); williamr@2: /** williamr@2: * williamr@2: * This launches the setting page for popup list setting page williamr@2: * williamr@2: * @param aCalledFromMenu - ignored in this class williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void EditItemL( TBool aCalledFromMenu ); williamr@2: williamr@2: public: williamr@2: /** williamr@2: * Access to the enumerated text array. Texts here are used in the setting item list williamr@2: * display. williamr@2: * williamr@2: * @return a pointer to an array of HBufC*s williamr@2: */ williamr@2: IMPORT_C CArrayPtr* EnumeratedTextArray() const; williamr@2: williamr@2: /** williamr@2: * Access to the "popped up" array of texts. They may be defined differently from williamr@2: * those in the enumerated text arry williamr@2: * williamr@2: * @return a pointer to an array of HBufC*s williamr@2: */ williamr@2: IMPORT_C CArrayPtr* PoppedUpTextArray() const; williamr@2: williamr@2: protected: williamr@2: /** williamr@2: * Framework method for constructing the launching setting page williamr@2: * @return a constructed CAknSettingPage object on the heap williamr@2: */ williamr@2: IMPORT_C virtual CAknSettingPage* CreateSettingPageL(); williamr@2: williamr@2: /** williamr@2: * Framework method to create and execute setting page williamr@2: */ williamr@2: IMPORT_C virtual void CreateAndExecuteSettingPageL(); williamr@2: williamr@2: /** williamr@2: * Method called by framework to complete the construction. Extra allocations of williamr@2: * memory or extra resource reading can happen here. williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void CompleteConstructionL(); williamr@2: williamr@2: /** williamr@2: * Sets the value of the (unowned) external value using the reference to it held williamr@2: * internally. williamr@2: * Note that this does not change the value of the reference itself. williamr@2: * That is, aNewValue's address is not copied in to be used as the external reference. williamr@2: * @param aNewValue Value to be copied via the external reference. williamr@2: */ williamr@2: IMPORT_C void SetExternalValue( TInt aNewValue ); williamr@2: /** williamr@2: * Sets the internal value. The value of aNewValue is copied into the internal storage williamr@2: * holding the internal value williamr@2: * @param aNewValue williamr@2: */ williamr@2: IMPORT_C void SetInternalValue( TInt aNewValue ); williamr@2: williamr@2: /** williamr@2: * Set the item that is selected in the associated popup. This should be done so williamr@2: * as to keep the selected index consistent with the internal value williamr@2: * williamr@2: * @param aNewIndex williamr@2: */ williamr@2: IMPORT_C void SetSelectedIndex( TInt aNewIndex ); williamr@2: williamr@2: /** williamr@2: * Returns the index in the enumerated item array, given the value of the enumeration williamr@2: * williamr@2: * @param aInputValue Value to look up; Returns -1 if value is not found williamr@2: */ williamr@2: IMPORT_C TInt IndexFromValue( TInt aInputValue ) const ; williamr@2: williamr@2: /** williamr@2: * Get the external value williamr@2: * @return TInt williamr@2: */ williamr@2: IMPORT_C TInt ExternalValue() const; williamr@2: /** williamr@2: * Access the internal value williamr@2: * @return TInt williamr@2: */ williamr@2: IMPORT_C TInt InternalValue() const; williamr@2: /** williamr@2: * Return a reference to the MAknQueryValue that is constructed for the CAknPopupListSettingPage williamr@2: * @return MAknQueryValue williamr@2: */ williamr@2: IMPORT_C MAknQueryValue* QueryValue() const; williamr@2: private: williamr@2: IMPORT_C void CAknSettingItem_Reserved(); williamr@2: williamr@2: private: williamr@2: void SetSettingPageTextL(); williamr@2: void CreateTextArrayL(); williamr@2: void CreateQueryValueL(); williamr@2: void UpdateInternalValuesL(); williamr@2: /** williamr@2: * williamr@2: * This routine looks at the current enumeration values and returns the next integer williamr@2: * higher than the highest enumeration. For internal use only, although it is possible williamr@2: * that clients or derivers might want to use somthing like it. williamr@2: * williamr@2: * @return a new unique value that can be used for extending the enumeration williamr@2: */ williamr@2: TInt FindNextEnumerationValue() const; williamr@2: williamr@2: private: williamr@2: TInt& iExternalValue; williamr@2: TInt iInternalValue; williamr@2: TInt iNumberOfItems; williamr@2: TInt iSelectedIndex; williamr@2: CAknQueryValueText* iQueryValue; williamr@2: CAknQueryValueTextArray* iQueryTextArray; williamr@2: TInt iSpare_EnumeratedTextPopup_1; williamr@2: }; williamr@2: williamr@2: williamr@2: class CAknBinaryPopupSettingItem : public CAknEnumeratedTextPopupSettingItem williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Constructs a binary setting value, given a resource id and a reference to williamr@2: * an externally owned external boolen setting item. williamr@2: * Resource supplied is just as for CAknEnumeratedTextPopupSettingItem williamr@2: * williamr@2: * @param aIdentifier Resource id for the associated values and texts; williamr@2: * williamr@2: */ williamr@2: IMPORT_C CAknBinaryPopupSettingItem( TInt aIdentifier, TBool& aBinaryValue ); williamr@2: williamr@2: /** williamr@2: * This command externalizes the current setting. The displayed (internal) copy williamr@2: * is transferred to the external copy (the one referenced in the constructor). williamr@2: * williamr@2: * This must be called by the client if he wants this to happen. Note that StoreAllL() williamr@2: * on the setting item list will call this for each setting item. williamr@2: */ williamr@2: IMPORT_C virtual void StoreL(); williamr@2: /* williamr@2: * The external value is transferred to the internal value williamr@2: * This occurs at construction, but may be called by client code when required. williamr@2: */ williamr@2: IMPORT_C virtual void LoadL(); williamr@2: /** williamr@2: * williamr@2: * This launches the setting page (or just toggles) the binary setting williamr@2: * williamr@2: * @param aCalledFromMenu - This flag determines if the setting page actually williamr@2: * launches or not. It does not if this flag is EFalse - the value is just toggled williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void EditItemL( TBool aCalledFromMenu ); williamr@2: williamr@2: protected: williamr@2: /** williamr@2: * Method called by framework to complete the construction. Extra allocations of williamr@2: * memory or extra resource reading can happen here. williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void CompleteConstructionL(); williamr@2: private: williamr@2: IMPORT_C void CAknSettingItem_Reserved(); williamr@2: private: williamr@2: TAny* iUnused; williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: * This class can be used as a base class for "Big Settings". The additional williamr@2: * functionality is small - merely to ensure that there is an empty string williamr@2: * in the list box text. williamr@2: * williamr@2: * To derive from this class, the client code is usually expected to add a new constructor, williamr@2: * re-implement StoreL, LoadL() and EditItemL(). williamr@2: * williamr@2: */ williamr@2: class CAknBigSettingItemBase : public CAknSettingItem williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * Contruct the "Big" setting item. The passed resource identifier all that is needed williamr@2: * There is no external value to reference. williamr@2: */ williamr@2: IMPORT_C CAknBigSettingItemBase( TInt aIdentifier ); williamr@2: williamr@2: protected: williamr@2: /* williamr@2: * This method obtains the current value's setting text williamr@2: * williamr@2: * @return Reference to descriptor with the text williamr@2: */ williamr@2: IMPORT_C virtual const TDesC& SettingTextL(); williamr@2: private: williamr@2: IMPORT_C void CAknSettingItem_Reserved(); williamr@2: williamr@2: private: williamr@2: const TDesC& iEmptyString; williamr@2: williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: * This class holds the setting items themselves and also manages the bitmap array williamr@2: */ williamr@2: class CAknSettingItemArray : public CArrayPtrFlat, public MDesCArray williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * CAknSettingItemArray is constructed as a numbered or unnumbered array. williamr@2: * @param aGranularity - number of items to extend when the aarray needs extention williamr@2: * @param aIsNumbered - flags the array as numbered or not williamr@2: * @param aInitialOrdinal - value to start the numbering at williamr@2: */ williamr@2: IMPORT_C CAknSettingItemArray( TInt aGranularity, TBool aIsNumbered, TInt aInitialOrdinal ); williamr@2: /** williamr@2: * Destructor williamr@2: */ williamr@2: IMPORT_C virtual ~CAknSettingItemArray(); williamr@2: williamr@2: // from MDesC16Array williamr@2: /** williamr@2: * Method by which the CAknSetStyleListBox accesses the number of items in the array williamr@2: * @return number of items in the array williamr@2: */ williamr@2: IMPORT_C TInt MdcaCount() const; williamr@2: /** williamr@2: * Method by which the setting item list accesses the text for the aIndex-th item in the williamr@2: * array. williamr@2: * williamr@2: * @param aIndex index at which to access the listbox text williamr@2: * @return Descriptor for this item to be used by the listbox. williamr@2: */ williamr@2: IMPORT_C TPtrC16 MdcaPoint(TInt aIndex) const; williamr@2: // For hidden item support williamr@2: /** williamr@2: * This method returns the true index in the array given the index as would be williamr@2: * calculated by looking at the visible items. williamr@2: * williamr@2: * @param aVisibleIndex - index among the visible items williamr@2: * @return the corresponding "true" index in the array williamr@2: */ williamr@2: IMPORT_C TInt ItemIndexFromVisibleIndex( TInt aVisibleIndex ) const; williamr@2: /** williamr@2: * Update date the mapping of visible indices. To be called when an item is made williamr@2: * visible or invisible. williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void RecalculateVisibleIndicesL(); williamr@2: /** williamr@2: * This is used to update the initial setting number for the top index. The number set williamr@2: * is the for the 0-th "true" or data index. That is, this numbered item may not show up williamr@2: * williamr@2: */ williamr@2: IMPORT_C void SetInitialOrdinal( TInt aInitialOrdinal ); williamr@2: /* williamr@2: * Method used to transfer flags from the CAknSettingItemList to this array williamr@2: */ williamr@2: IMPORT_C void SetFlags( TInt aFlags ); williamr@2: protected: williamr@2: williamr@2: /** williamr@2: * Set the number of visible items. williamr@2: * @param aCount number of items that are visible. williamr@2: */ williamr@2: IMPORT_C void SetVisibleCount( TInt aCount ); williamr@2: /** williamr@2: * Returns the number of visible items williamr@2: * williamr@2: * @return the number of visible items williamr@2: */ williamr@2: IMPORT_C TInt VisibleCount() const; williamr@2: williamr@2: private: williamr@2: TBool iIsNumbered; williamr@2: TInt iInitialOrdinal; williamr@2: TInt iVisibleCount; williamr@2: TInt iFlags; williamr@2: }; williamr@2: williamr@2: williamr@2: class CAknSettingItemList : public CAknControl , public MEikListBoxObserver williamr@2: { williamr@2: public: williamr@2: enum TAknSettingItemStyle williamr@2: { williamr@2: ENumberedStyle, // The setting item list displays number williamr@2: EUnnumberedStyle // The setting item list does not disply number williamr@2: }; williamr@2: williamr@2: public: williamr@2: /** williamr@2: * Constructs the setting item list williamr@2: */ williamr@2: IMPORT_C CAknSettingItemList(); williamr@2: /** williamr@2: * Destructor williamr@2: */ williamr@2: IMPORT_C ~CAknSettingItemList(); williamr@2: williamr@2: // From CCoeControl williamr@2: /** williamr@2: * 2nd-stage construction from resource id williamr@2: */ williamr@2: IMPORT_C void ConstructFromResourceL(TInt aResourceId ); williamr@2: /** williamr@2: * 2nd-stage construction from constructed resource reader williamr@2: */ williamr@2: IMPORT_C void ConstructFromResourceL( TResourceReader& aReader ); williamr@2: williamr@2: /** williamr@2: * @return the number of component controls williamr@2: */ williamr@2: IMPORT_C TInt CountComponentControls() const; williamr@2: /** williamr@2: * @param TInt aId williamr@2: * @return a reference to the component control at index aId williamr@2: */ williamr@2: IMPORT_C CCoeControl* ComponentControl(TInt aId ) const; williamr@2: williamr@2: /** williamr@2: * Handles keys sent to this control williamr@2: */ williamr@2: IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); williamr@2: /** williamr@2: * Take action necessary when the focus is change williamr@2: */ williamr@2: IMPORT_C virtual void FocusChanged(TDrawNow aDrawNow); williamr@2: williamr@2: /** williamr@2: * Handles a change to the control's resources of type aType williamr@2: * which are shared across the environment, e.g. colors or fonts. williamr@2: * williamr@2: * @since 2.0 williamr@2: * @param aType Reason for the "resource" change, usually an system event UID williamr@2: */ williamr@2: IMPORT_C void HandleResourceChange(TInt aType); williamr@2: williamr@2: // from MEikListBoxObserver williamr@2: IMPORT_C virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); williamr@2: williamr@2: public: williamr@2: // Framework methods williamr@2: /** williamr@2: * williamr@2: * This launches the setting page for the current item by calling EditItemL on it williamr@2: * williamr@2: * @param aIndex - current item's (Visible) index in the list williamr@2: * aCalledFromMenu- ignored in most classes; may alter the behaviour williamr@2: * of the setting page williamr@2: */ williamr@2: IMPORT_C virtual void EditItemL(TInt aIndex, TBool aCalledFromMenu); williamr@2: /** williamr@2: * williamr@2: * Calls LoadL() on each item in the MAknSettingItemArray. williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void LoadSettingsL(); williamr@2: /** williamr@2: * This command calls StoreL on all the setting items (hidden or not) williamr@2: * williamr@2: * This must be called by the client if he wants it to occur williamr@2: */ williamr@2: IMPORT_C virtual void StoreSettingsL(); // call StoreL() on each item in MAknSettingItemArray williamr@2: williamr@2: /** williamr@2: * @param aInclude If EFalse, numbering does not include hidden items williamr@2: * Otherwise, they are williamr@2: */ williamr@2: IMPORT_C void SetIncludeHiddenInOrdinal( TBool aInclude ); williamr@2: williamr@2: /** williamr@2: * @return EFalse if the listbox is not numbered style; Not EFalse otherwise williamr@2: */ williamr@2: IMPORT_C TBool IsNumberedStyle(); williamr@2: /** williamr@2: * @return the listbox used by setting item list williamr@2: */ williamr@2: IMPORT_C CEikFormattedCellListBox* ListBox(); // get the listbox williamr@2: /** williamr@2: * @return a pointer to the setting item array; No ownership is transferred williamr@2: */ williamr@2: IMPORT_C CAknSettingItemArray* SettingItemArray() const; williamr@2: /** williamr@2: * Method to be called when the client code has added or removed items or their visibility; williamr@2: * This should be called when a single event's batch of array or visibility changes williamr@2: * is complete in order to avoid more re-draws than is necessary williamr@2: */ williamr@2: IMPORT_C void HandleChangeInItemArrayOrVisibilityL(); williamr@2: /** williamr@2: * From CCoeControl. williamr@2: * Handles pointer events williamr@2: */ williamr@2: IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); williamr@2: williamr@2: protected: williamr@2: /** williamr@2: * Framework method to create a setting item based upon the user id aSettingId. The williamr@2: * client code decides what type to contruct. new (ELeave) must then be used and the resulting williamr@2: * pointer returned. Ownership is thereafter base class's responsiblity. williamr@2: * williamr@2: * @param aSettingId ID to use to determine the type of the setting item williamr@2: * @return a constructed (not 2nd-stage constructed) setting item. williamr@2: */ williamr@2: IMPORT_C virtual CAknSettingItem* CreateSettingItemL( TInt aSettingId ); williamr@2: private: williamr@2: /** williamr@2: * From CAknControl williamr@2: */ williamr@2: IMPORT_C void* ExtensionInterface( TUid aInterface ); williamr@2: williamr@2: private: williamr@2: void UpdateAllListBoxTextsL() const; williamr@2: williamr@2: private: williamr@2: williamr@2: // Owned objects: williamr@2: CEikFormattedCellListBox* iSettingItemListBox; williamr@2: CAknSettingItemArray* iSettingItemArray; williamr@2: williamr@2: // Other non-CBase classes williamr@2: HBufC* iSettingItemListTitle; // Owned williamr@2: williamr@2: // Internal information williamr@2: TInt iFlags; williamr@2: TInt iInitialOrdinal; williamr@2: williamr@2: TInt iSpare_1; williamr@2: TInt iSpare_2; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: williamr@2: #endif