2 * Copyright (c) 2002-2007 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.
14 * Description: Defines a public interface class MAknsControlContext and
15 * related enumerations.
20 #ifndef AKNSCONTROLCONTEXT_H
21 #define AKNSCONTROLCONTEXT_H
24 #include <AknsConstants.h>
25 #include <AknsItemID.h>
31 * Skin parameter types for MAknsControlContext::SupplySkinParameter.
37 // This enumeration is intentionally empty.
41 * Values for skin object types (given as aObject parameter for
42 * MAknsControlContext::SupplySkinObject).
50 * Item ID for layout background.
52 * MAknsControlContext::SupplySkinObject
53 * should return a pointer to TAknsBackground or @c NULL (default used).
57 EAknsCCOBackground = 0,
60 * Pointer to parent context.
62 * MAknsControlContext::SupplySkinObject
63 * should return a pointer to the parent context (of type
64 * @c MAknsControlContext) or @c NULL (no parent context).
68 EAknsCCOParentContext = 1
72 * Control context type enumeration.
76 enum TAknsControlContextType
80 * Unknown type. The control context can only be assumed to be compatible
81 * with MAknsControlContext.
85 EAknsControlContextTypeUnknown = 0,
88 * The control context type for CAknsBasicBackgroundControlContext
89 * (and derived types).
93 EAknsControlContextTypeBasic = 1,
96 * The control context type for CAknsLayeredBackgroundControlContext
97 * (and derived types).
101 EAknsControlContextTypeLayered = 2,
104 * The control context type for CAknsListBoxBackgroundControlContext
105 * (and derived types).
109 EAknsControlContextTypeListBox = 3,
112 * The control context type for CAknsFrameBackgroundControlContext
113 * (and derived types).
117 EAknsControlContextTypeFrame = 4,
120 * The control context type for CAknsCombinedBackgroundControlContext
121 * (and derived types).
125 EAknsControlContextTypeCombined = 5,
128 * The control context type for CAknsMaskedFrameBackgroundControlContext
129 * (and derived types).
133 EAknsControlContextTypeMasked = 6
136 // CLASS DECLARATIONS
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.
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.
155 class MAknsControlContext
159 * Type ID declaration.
160 * Type ID is used to make it possible to retrieve control context
161 * through @c MObjectProvider::MopSupplyObject interface.
163 DECLARE_TYPE_ID(0x10005a29)
165 public: // 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.
173 inline virtual ~MAknsControlContext() {}
175 public: // New functions
178 * Provides context specific integer parameter.
182 * @param aParam Type of the parameter to be retrieved. Possible values
183 * are defined in ::TAknsCCParameter enumeration.
185 * @return Integer value as defined in ::TAknsCCParameter for the
186 * particular parameter. For unknown or unhandled values zero must be
189 virtual TInt SupplySkinParameter( TAknsCCParameter aParam ) =0;
192 * Provides context specific object.
196 * @param aObject Type of the object to be retrieved. Possible values
197 * are defined in ::TAknsCCObject enumeration.
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.
203 virtual TAny* SupplySkinObject( TAknsCCObject aObject ) =0;
206 * Determines whether this control context is compatible with the
207 * given derived type.
211 * @param aType Type of the derived control context class (one of
212 * the values in TAknsControlContextType).
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.
218 virtual TBool IsCompatibleWithType(
219 const TAknsControlContextType aType ) const =0;
222 * Updates the control context, if necessary.
223 * This method is called by the framework before drawing with the
226 * Base class implementation returns 0.
230 * @return Return value reserved for future use. Currently returns 0.
232 virtual TInt UpdateContext();
234 protected: // Reserved virtual functions
237 * Reserved for future use.
241 virtual TInt Reserved2();
243 public: // New functions
246 * Returns type UID pointer that can be used in MopSupplyObject.
250 * @param aId Type UID, should be the same that was given as aId
251 * parameter of MopSupplyObject.
253 * @param aContext Pointer to an MAknsControlContext instance.
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.
259 IMPORT_C static TTypeUid::Ptr SupplyMopObject( TTypeUid aId,
260 MAknsControlContext* aContext );
264 #endif // AKNSCONTROLCONTEXT_H