uiresources_pub/skins_api/inc/AknsControlContext.h
changeset 0 05e9090e2422
equal deleted inserted replaced
-1:000000000000 0:05e9090e2422
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  Defines a public interface class MAknsControlContext and 
       
    15 *                related enumerations.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef AKNSCONTROLCONTEXT_H
       
    21 #define AKNSCONTROLCONTEXT_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <AknsConstants.h>
       
    25 #include <AknsItemID.h>
       
    26 #include <coemop.h>
       
    27 
       
    28 // DATA TYPES
       
    29 
       
    30 /** 
       
    31 * Skin parameter types for MAknsControlContext::SupplySkinParameter.
       
    32 *
       
    33 * @since 2.0
       
    34 */
       
    35 enum TAknsCCParameter
       
    36     {
       
    37     // This enumeration is intentionally empty.
       
    38     };
       
    39 
       
    40 /** 
       
    41 * Values for skin object types (given as aObject parameter for 
       
    42 * MAknsControlContext::SupplySkinObject).
       
    43 *
       
    44 * @since 2.0
       
    45 */
       
    46 enum TAknsCCObject
       
    47     {
       
    48 
       
    49     /**
       
    50     * Item ID for layout background.
       
    51     *
       
    52     * MAknsControlContext::SupplySkinObject
       
    53     * should return a pointer to TAknsBackground or @c NULL (default used).
       
    54     *
       
    55     * @since 2.0
       
    56     */
       
    57     EAknsCCOBackground              = 0,
       
    58     
       
    59     /**
       
    60     * Pointer to parent context.
       
    61     *
       
    62     * MAknsControlContext::SupplySkinObject
       
    63     * should return a pointer to the parent context (of type 
       
    64     * @c MAknsControlContext) or @c NULL (no parent context).
       
    65     *
       
    66     * @since 2.6
       
    67     */
       
    68     EAknsCCOParentContext           = 1
       
    69     };
       
    70 
       
    71 /**
       
    72 * Control context type enumeration.
       
    73 *
       
    74 * @since 2.0
       
    75 */
       
    76 enum TAknsControlContextType
       
    77     {
       
    78 
       
    79     /**
       
    80     * Unknown type. The control context can only be assumed to be compatible
       
    81     * with MAknsControlContext.
       
    82     *
       
    83     * @since 2.0
       
    84     */
       
    85     EAknsControlContextTypeUnknown  = 0,
       
    86 
       
    87     /**
       
    88     * The control context type for CAknsBasicBackgroundControlContext
       
    89     * (and derived types).
       
    90     *
       
    91     * @since 2.0
       
    92     */
       
    93     EAknsControlContextTypeBasic    = 1,
       
    94 
       
    95     /**
       
    96     * The control context type for CAknsLayeredBackgroundControlContext
       
    97     * (and derived types).
       
    98     *
       
    99     * @since 2.0
       
   100     */
       
   101     EAknsControlContextTypeLayered  = 2,
       
   102 
       
   103     /**
       
   104     * The control context type for CAknsListBoxBackgroundControlContext
       
   105     * (and derived types).
       
   106     *
       
   107     * @since 2.0
       
   108     */
       
   109     EAknsControlContextTypeListBox  = 3,
       
   110 
       
   111     /**
       
   112     * The control context type for CAknsFrameBackgroundControlContext
       
   113     * (and derived types).
       
   114     *
       
   115     * @since 2.0
       
   116     */
       
   117     EAknsControlContextTypeFrame    = 4,
       
   118 
       
   119     /**
       
   120     * The control context type for CAknsCombinedBackgroundControlContext
       
   121     * (and derived types).
       
   122     *
       
   123     * @since 3.2
       
   124     */
       
   125     EAknsControlContextTypeCombined = 5,
       
   126 
       
   127     /**
       
   128     * The control context type for CAknsMaskedFrameBackgroundControlContext
       
   129     * (and derived types).
       
   130     *
       
   131     * @since 3.2
       
   132     */
       
   133     EAknsControlContextTypeMasked = 6
       
   134     };
       
   135 
       
   136 // CLASS DECLARATIONS
       
   137 
       
   138 /**
       
   139 * Interface that provides context specific skin parameters.
       
   140 * This interface is used by AknsDrawUtils to query context specific parameters,
       
   141 * such as background override. Application should instantiate a class that 
       
   142 * implements this interface and provide pointer to it using 
       
   143 * @c MObjectProvider::MopSupplyObject in the appropriate control. 
       
   144 *
       
   145 * This is a public class with exported functions.
       
   146 * The class is not intended for user derivation - concrete classes implementing
       
   147 * the interface are provided by the library. See 
       
   148 * @c CAknsBasicBackgroundControlContext and 
       
   149 * @c CAknsListBoxBackgroundControlContext for further details.
       
   150 *
       
   151 * @lib AknSkins.lib
       
   152 *
       
   153 * @since 2.0
       
   154 */
       
   155 class MAknsControlContext
       
   156     {
       
   157     public: // Type UID
       
   158         /**         
       
   159         * Type ID declaration.
       
   160         * Type ID is used to make it possible to retrieve control context
       
   161         * through @c MObjectProvider::MopSupplyObject interface.        
       
   162         */
       
   163         DECLARE_TYPE_ID(0x10005a29)
       
   164 
       
   165     public: // Destructor
       
   166 
       
   167         /**
       
   168         * Destructor.
       
   169         * Destructor is provided only to enable deletion using base class
       
   170         * pointer. Caller should never delete control context retrieved through
       
   171         * @c MObjectProvider interface.
       
   172         */
       
   173         inline virtual ~MAknsControlContext() {}
       
   174 
       
   175     public: // New functions
       
   176 
       
   177         /**
       
   178         * Provides context specific integer parameter.
       
   179         *
       
   180         * @since 2.0
       
   181         *
       
   182         * @param aParam Type of the parameter to be retrieved. Possible values
       
   183         *   are defined in ::TAknsCCParameter enumeration.
       
   184         *
       
   185         * @return Integer value as defined in ::TAknsCCParameter for the 
       
   186         *   particular parameter. For unknown or unhandled values zero must be
       
   187         *   returned.        
       
   188         */
       
   189         virtual TInt SupplySkinParameter( TAknsCCParameter aParam ) =0;
       
   190 
       
   191         /**
       
   192         * Provides context specific object.
       
   193         *
       
   194         * @since 2.0
       
   195         *
       
   196         * @param aObject Type of the object to be retrieved. Possible values 
       
   197         *   are defined in ::TAknsCCObject enumeration.
       
   198         *
       
   199         * @return Pointer to object as defined in ::TAknsCCObject for that 
       
   200         *   specific aObject parameter value. For unknown or unhandled values
       
   201         *   @c NULL must be returned.        
       
   202         */
       
   203         virtual TAny* SupplySkinObject( TAknsCCObject aObject ) =0;
       
   204 
       
   205         /**
       
   206         * Determines whether this control context is compatible with the
       
   207         * given derived type.
       
   208         *
       
   209         * @since 2.0
       
   210         *
       
   211         * @param aType Type of the derived control context class (one of
       
   212         *   the values in TAknsControlContextType).
       
   213         *
       
   214         * @return ETrue if this control context instance is compatible with
       
   215         *   the given type (i.e. can be casted to the corresponding concrete
       
   216         *   class). EFalse otherwise.
       
   217         */
       
   218         virtual TBool IsCompatibleWithType( 
       
   219             const TAknsControlContextType aType ) const =0;
       
   220 
       
   221         /**
       
   222         * Updates the control context, if necessary.
       
   223         * This method is called by the framework before drawing with the 
       
   224         * context.
       
   225         *
       
   226         * Base class implementation returns 0.
       
   227         *
       
   228         * @since 2.6
       
   229         *
       
   230         * @return Return value reserved for future use. Currently returns 0.
       
   231         */
       
   232         virtual TInt UpdateContext();
       
   233 
       
   234     protected: // Reserved virtual functions
       
   235 
       
   236         /**
       
   237         * Reserved for future use.
       
   238         *
       
   239         * @since 2.0
       
   240         */
       
   241         virtual TInt Reserved2();
       
   242 
       
   243     public: // New functions
       
   244 
       
   245         /**
       
   246         * Returns type UID pointer that can be used in MopSupplyObject.
       
   247         *
       
   248         * @since 2.0
       
   249         *
       
   250         * @param aId Type UID, should be the same that was given as aId
       
   251         *   parameter of MopSupplyObject.
       
   252         *
       
   253         * @param aContext Pointer to an MAknsControlContext instance.
       
   254         *
       
   255         * @return Type UID pointer containing aContext, or @c NULL type UID
       
   256         *   pointer if given type UID does not match MAknsControlContext or
       
   257         *   aContext is @c NULL.
       
   258         */
       
   259         IMPORT_C static TTypeUid::Ptr SupplyMopObject( TTypeUid aId, 
       
   260             MAknsControlContext* aContext );
       
   261 
       
   262     };
       
   263 
       
   264 #endif      // AKNSCONTROLCONTEXT_H   
       
   265 
       
   266 // End of File