wvuing/wvuiave/AppSrc/ccacoloursettingitem.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Setting item for message colour
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_COLOURSETTINGITEM_H
       
    20 #define C_COLOURSETTINGITEM_H
       
    21 
       
    22 #include <aknsettingitemlist.h>
       
    23 
       
    24 class MCASettingSapExt;
       
    25 
       
    26 /**
       
    27  *  Colour setting item.
       
    28  *
       
    29  *  Custom setting item to be used with colour selections.
       
    30  *  Setting value buffer (TBool& aBuffer in constructor)
       
    31  *  tells whether default value is selected (EFalse) or
       
    32  *  user defined colour is used (ETrue). When the default
       
    33  *  value is used setting item shows text qtn_chat_set_colour_default.
       
    34  *  When user defined colour is used the setting items
       
    35  *  value box is coloured with that colour. EditItemL
       
    36  *  method is overridden to launch a colour selection grid.
       
    37  *
       
    38  *
       
    39  *  @lib chat.exe
       
    40  *  @since S60 v3.2
       
    41  */
       
    42 NONSHARABLE_CLASS( CCAColourSettingItem ) : public CAknSettingItem
       
    43     {
       
    44 public:
       
    45 
       
    46     /**
       
    47      * Constructor.
       
    48      * @param aSAPExtension Reference to SAP settings.
       
    49      * @param aBuffer Reference to external settings value buffer.
       
    50      * @param aIdentifier Unique identifier for setting item.
       
    51      */
       
    52     CCAColourSettingItem(
       
    53         MCASettingSapExt& aSAPExtension,
       
    54         TBool& aBuffer,
       
    55         TInt aIdentifier );
       
    56 
       
    57     /**
       
    58      * Symbian 2nd phase constructor.
       
    59      *
       
    60      * NOTE! Use this instead of ConstructL from CAknSettingItem.
       
    61      *       If this is not used CompleteConstructionL() panics!
       
    62      *
       
    63      * @param aKey Key for key-value pair in SAP settings,
       
    64      *             used to get colour information from SAP settings.
       
    65      * @see CAknSettingItem for rest of parameters.
       
    66      */
       
    67     void ConstructL(
       
    68         const TDesC& aKey,
       
    69         const TInt aOrdinal,
       
    70         const TDesC& aSettingTitle,
       
    71         CArrayPtr<CGulIcon>* aIconArray );
       
    72 
       
    73     virtual ~CCAColourSettingItem();
       
    74 
       
    75 // from base class CAknSettingItem
       
    76 
       
    77     /**
       
    78      * From CAknSettingItem.
       
    79      * @see CAknSettingItem
       
    80      *
       
    81      * @since S60 v3.2
       
    82      */
       
    83     void StoreL();
       
    84 
       
    85     /**
       
    86      * From CAknSettingItem.
       
    87      * @see CAknSettingItem
       
    88      *
       
    89      * @since S60 v3.2
       
    90      */
       
    91     void LoadL();
       
    92 
       
    93     /**
       
    94      * From CAknSettingItem.
       
    95      * @see CAknSettingItem
       
    96      *
       
    97      * @since S60 v3.2
       
    98      */
       
    99     void EditItemL( TBool aCalledFromMenu );
       
   100 
       
   101     /**
       
   102      * From CAknSettingItem.
       
   103      * @see CAknSettingItem
       
   104      *
       
   105      * @since S60 v3.2
       
   106      */
       
   107     const TDesC& SettingTextL();
       
   108 
       
   109 protected:
       
   110 
       
   111 // from base class CAknSettingItem
       
   112 
       
   113     /**
       
   114      * From CAknSettingItem.
       
   115      * @see CAknSettingItem
       
   116      *
       
   117      * @since S60 v3.2
       
   118      */
       
   119     void CompleteConstructionL();
       
   120 
       
   121     /**
       
   122      * From CAknSettingItem.
       
   123      * @see CAknSettingItem
       
   124      *
       
   125      * @since S60 v3.2
       
   126      */
       
   127     CFbsBitmap* CreateBitmapL();
       
   128 
       
   129 private:
       
   130 
       
   131     /**
       
   132      * This sets the mask of this setting item's icon array, if it exists,
       
   133      * using the mask from the passed icon.
       
   134      * It returns the bitmap from the aIcon.
       
   135      * The method also takes ownership of aIcon and
       
   136      * may delete it (but not its bitmap).
       
   137      *
       
   138      * @since S60 v3.2
       
   139      * @param aIcon Icon of which the mask is passed through to SetIconMask()
       
   140      *              and bitmap is returned.
       
   141      * @return Bitmap from aIcon. Ownership of the bitmap is
       
   142      *         transfered to the caller.
       
   143      */
       
   144     CFbsBitmap* SetIconMaskAndReturnBitmap( CGulIcon* aIcon );
       
   145 
       
   146 private: // data
       
   147 
       
   148     /**
       
   149      * Reference to external value of setting.
       
   150      */
       
   151     TBool& iExternalValue;
       
   152 
       
   153     /**
       
   154      * Internal setting value.
       
   155      */
       
   156     TBool iInternalValue;
       
   157 
       
   158     /**
       
   159      * Text used when default option selected.
       
   160      * Own.
       
   161      */
       
   162     HBufC* iDefaultText;
       
   163 
       
   164     /**
       
   165      * Key for key-value pair in SAP settings.
       
   166      * Own.
       
   167      */
       
   168     HBufC* iSAPKey;
       
   169 
       
   170     /**
       
   171      * Reference to SAP settings.
       
   172      * Not own.
       
   173      */
       
   174     MCASettingSapExt& iSAPExtension;
       
   175 
       
   176     };
       
   177 
       
   178 #endif // C_COLOURSETTINGITEM_H