epoc32/include/mw/aknsdatacontext.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  Defines a public interface class MAknsDataContext.
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#ifndef AKNSDATACONTEXT_H
williamr@2
    20
#define AKNSDATACONTEXT_H
williamr@2
    21
williamr@2
    22
//  INCLUDES
williamr@2
    23
#include <AknsConstants.h>
williamr@2
    24
#include <AknsItemID.h>
williamr@2
    25
#include <coemop.h>
williamr@2
    26
williamr@2
    27
// CLASS DECLARATION
williamr@2
    28
williamr@2
    29
/**
williamr@2
    30
* Interface that provides context sensitive control over data allocation.
williamr@2
    31
* MAknsDataContext can be used to indicate need for specific skin items
williamr@2
    32
* and thus to ensure that they are allocated before first use.
williamr@2
    33
*
williamr@2
    34
* This is a public class with exported functions.
williamr@2
    35
* The class is not usually intended for user derivation - concrete classes
williamr@2
    36
* implementing the interface are provided by the library.
williamr@2
    37
* See @c AknsUtils::CreateDataContextForContainerL() for further 
williamr@2
    38
* details.
williamr@2
    39
*
williamr@2
    40
* @lib AknSkins.lib
williamr@2
    41
*
williamr@2
    42
* @since 2.0
williamr@2
    43
*/
williamr@2
    44
class MAknsDataContext 
williamr@2
    45
    {
williamr@2
    46
    public: // Type UID
williamr@2
    47
        /**         
williamr@2
    48
        * Type ID declaration.
williamr@2
    49
        * Type ID is used to make it possible to retrieve data context
williamr@2
    50
        * through @c MObjectProvider::MopSupplyObject interface.
williamr@2
    51
        */
williamr@2
    52
        DECLARE_TYPE_ID(0x10005a28)
williamr@2
    53
williamr@2
    54
    public:  // Constructors and destructor    
williamr@2
    55
williamr@2
    56
        /**
williamr@2
    57
        * Destructor.
williamr@2
    58
        * Destructor is only provided to enable deletion using base class
williamr@2
    59
        * pointer. Caller should never delete context retrieved using
williamr@2
    60
        * @c MObjectProvider interface.
williamr@2
    61
        */
williamr@2
    62
        inline virtual ~MAknsDataContext() {}
williamr@2
    63
        
williamr@2
    64
    public: // New functions
williamr@2
    65
williamr@2
    66
        /**
williamr@2
    67
        * Reserves and allocates specified item.
williamr@2
    68
        * Instructs the data context that the specified item will be used
williamr@2
    69
        * by caller and should be allocated and cached by skin instance.
williamr@2
    70
        * Any control using cached skin items should reserve them, preferably
williamr@2
    71
        * in @c ConstructL(), by calling this method.
williamr@2
    72
        * Note that reservation does not guarantee that the item will be
williamr@2
    73
        * available in cache - it's only a tentative request for allocation.
williamr@2
    74
        *
williamr@2
    75
        * @since 2.0
williamr@2
    76
        *
williamr@2
    77
        * @param aID Item ID of the item to be reserved.
williamr@2
    78
        *
williamr@2
    79
        * @par Exceptions:
williamr@2
    80
        *   If item data allocation fails, function leaves with error code.
williamr@2
    81
        */
williamr@2
    82
        virtual void ReserveItemL( const TAknsItemID& aID ) =0;
williamr@2
    83
williamr@2
    84
		/**
williamr@2
    85
        * Indicates that specified item will no longer be used.
williamr@2
    86
        * Instructs the data context that the specified item will not
williamr@2
    87
        * be used by caller anymore. Exact behavior (e.g. whether cached
williamr@2
    88
        * instance is deallocated) depends on the cache policy of data
williamr@2
    89
        * context and skin instance. Controls should not usually call this
williamr@2
    90
        * method, but instead allow data context (in most cases implemented
williamr@2
    91
        * by a container) go out of scope. 
williamr@2
    92
        *
williamr@2
    93
        * @since 2.0
williamr@2
    94
        * 
williamr@2
    95
        * @param aID Item ID of the item to be released.
williamr@2
    96
        */
williamr@2
    97
        virtual void ReleaseItem( const TAknsItemID& aID ) =0;
williamr@2
    98
williamr@2
    99
    protected: // Reserved virtual functions
williamr@2
   100
williamr@2
   101
        /**
williamr@2
   102
        * Reserved for future use.
williamr@2
   103
        *
williamr@2
   104
        * @since 2.0
williamr@2
   105
        */
williamr@2
   106
        virtual TInt Reserved1();
williamr@2
   107
williamr@2
   108
        /**
williamr@2
   109
        * Reserved for future use.
williamr@2
   110
        *
williamr@2
   111
        * @since 2.0
williamr@2
   112
        */
williamr@2
   113
        virtual TInt Reserved2();
williamr@2
   114
williamr@2
   115
    public: // New functions
williamr@2
   116
williamr@2
   117
        /**
williamr@2
   118
        * Returns type UID pointer that can be used in MopSupplyObject.
williamr@2
   119
        *
williamr@2
   120
        * @since 2.0
williamr@2
   121
        *
williamr@2
   122
        * @param aId Type UID, should be the same that was given as aId
williamr@2
   123
        *   parameter of MopSupplyObject.
williamr@2
   124
        *
williamr@2
   125
        * @param aContext Pointer to an MAknsDataContext instance.
williamr@2
   126
        *
williamr@2
   127
        * @return Type UID pointer containing aContext, or @c NULL type UID
williamr@2
   128
        *   pointer if given type UID does not match MAknsDataContext or
williamr@2
   129
        *   aContext is @c NULL.
williamr@2
   130
        */
williamr@2
   131
        IMPORT_C static TTypeUid::Ptr SupplyMopObject( TTypeUid aId, 
williamr@2
   132
            MAknsDataContext* aContext );
williamr@2
   133
williamr@2
   134
    };
williamr@2
   135
williamr@2
   136
#endif // AKNSDATACONTEXT_H
williamr@2
   137
            
williamr@2
   138
// End of File