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: Defines a public interface class MAknsDataContext. williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef AKNSDATACONTEXT_H williamr@2: #define AKNSDATACONTEXT_H williamr@2: williamr@2: // INCLUDES williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: // CLASS DECLARATION williamr@2: williamr@2: /** williamr@2: * Interface that provides context sensitive control over data allocation. williamr@2: * MAknsDataContext can be used to indicate need for specific skin items williamr@2: * and thus to ensure that they are allocated before first use. williamr@2: * williamr@2: * This is a public class with exported functions. williamr@2: * The class is not usually intended for user derivation - concrete classes williamr@2: * implementing the interface are provided by the library. williamr@2: * See @c AknsUtils::CreateDataContextForContainerL() for further williamr@2: * details. williamr@2: * williamr@2: * @lib AknSkins.lib williamr@2: * williamr@2: * @since 2.0 williamr@2: */ williamr@2: class MAknsDataContext williamr@2: { williamr@2: public: // Type UID williamr@2: /** williamr@2: * Type ID declaration. williamr@2: * Type ID is used to make it possible to retrieve data context williamr@2: * through @c MObjectProvider::MopSupplyObject interface. williamr@2: */ williamr@2: DECLARE_TYPE_ID(0x10005a28) williamr@2: williamr@2: public: // Constructors and destructor williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: * Destructor is only provided to enable deletion using base class williamr@2: * pointer. Caller should never delete context retrieved using williamr@2: * @c MObjectProvider interface. williamr@2: */ williamr@2: inline virtual ~MAknsDataContext() {} williamr@2: williamr@2: public: // New functions williamr@2: williamr@2: /** williamr@2: * Reserves and allocates specified item. williamr@2: * Instructs the data context that the specified item will be used williamr@2: * by caller and should be allocated and cached by skin instance. williamr@2: * Any control using cached skin items should reserve them, preferably williamr@2: * in @c ConstructL(), by calling this method. williamr@2: * Note that reservation does not guarantee that the item will be williamr@2: * available in cache - it's only a tentative request for allocation. williamr@2: * williamr@2: * @since 2.0 williamr@2: * williamr@2: * @param aID Item ID of the item to be reserved. williamr@2: * williamr@2: * @par Exceptions: williamr@2: * If item data allocation fails, function leaves with error code. williamr@2: */ williamr@2: virtual void ReserveItemL( const TAknsItemID& aID ) =0; williamr@2: williamr@2: /** williamr@2: * Indicates that specified item will no longer be used. williamr@2: * Instructs the data context that the specified item will not williamr@2: * be used by caller anymore. Exact behavior (e.g. whether cached williamr@2: * instance is deallocated) depends on the cache policy of data williamr@2: * context and skin instance. Controls should not usually call this williamr@2: * method, but instead allow data context (in most cases implemented williamr@2: * by a container) go out of scope. williamr@2: * williamr@2: * @since 2.0 williamr@2: * williamr@2: * @param aID Item ID of the item to be released. williamr@2: */ williamr@2: virtual void ReleaseItem( const TAknsItemID& aID ) =0; williamr@2: williamr@2: protected: // Reserved virtual functions williamr@2: williamr@2: /** williamr@2: * Reserved for future use. williamr@2: * williamr@2: * @since 2.0 williamr@2: */ williamr@2: virtual TInt Reserved1(); williamr@2: williamr@2: /** williamr@2: * Reserved for future use. williamr@2: * williamr@2: * @since 2.0 williamr@2: */ williamr@2: virtual TInt Reserved2(); williamr@2: williamr@2: public: // New functions williamr@2: williamr@2: /** williamr@2: * Returns type UID pointer that can be used in MopSupplyObject. williamr@2: * williamr@2: * @since 2.0 williamr@2: * williamr@2: * @param aId Type UID, should be the same that was given as aId williamr@2: * parameter of MopSupplyObject. williamr@2: * williamr@2: * @param aContext Pointer to an MAknsDataContext instance. williamr@2: * williamr@2: * @return Type UID pointer containing aContext, or @c NULL type UID williamr@2: * pointer if given type UID does not match MAknsDataContext or williamr@2: * aContext is @c NULL. williamr@2: */ williamr@2: IMPORT_C static TTypeUid::Ptr SupplyMopObject( TTypeUid aId, williamr@2: MAknsDataContext* aContext ); williamr@2: williamr@2: }; williamr@2: williamr@2: #endif // AKNSDATACONTEXT_H williamr@2: williamr@2: // End of File