sdkcreationmw/sdkexamples/cppexamples/S60Ex/helperfunctions/IconFileProvider.h
changeset 0 b26acd06ea60
equal deleted inserted replaced
-1:000000000000 0:b26acd06ea60
       
     1 /*
       
     2 * Copyright (c) 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ICONFILEPROVIDER_H
       
    20 #define ICONFILEPROVIDER_H
       
    21 
       
    22 #include <akniconutils.h>
       
    23 
       
    24 /**
       
    25 *  CIconFileProvider class.
       
    26 *  This class is used to provide a icon file handle to MAknIconFileProvider.
       
    27 *  With this class it is possible to use icons from application's private
       
    28 *  folder.
       
    29 */
       
    30 class CIconFileProvider : public CBase,
       
    31                           public MAknIconFileProvider
       
    32     {
       
    33 
       
    34     public:
       
    35 
       
    36     	/**
       
    37         * Two-phased constructor.
       
    38         * @param aSession File server session.
       
    39         * @param aFilename Full path to the icon file
       
    40         */
       
    41     	static CIconFileProvider* NewL(RFs aSession, const TDesC& aFilename);
       
    42 
       
    43     	/**
       
    44         * Destructor.
       
    45         */
       
    46     	~CIconFileProvider();
       
    47 
       
    48     private: //from MAknIconFileProvider
       
    49 
       
    50     	/**
       
    51         * Returns an open file handle to the icon file.
       
    52         * @param aFile Icon file should be opened in this file handle, which
       
    53         *              is an empty file handle, when the AknIcon framework
       
    54         *              calls this method. The AknIcon framework takes care of
       
    55         *              closing the file handle after having used it.
       
    56         * @param aType Icon file type.
       
    57         */
       
    58     	void RetrieveIconFileHandleL( RFile& aFile, const TIconFileType aType );
       
    59 
       
    60     	/**
       
    61         * With this method, AknIcon framework informs that it does not use
       
    62         * this MAknIconFileProvider instance any more.
       
    63         */
       
    64         void Finished();
       
    65 
       
    66     private:
       
    67 
       
    68         /**
       
    69         * C++ default constructor.
       
    70         * @param aSession. File server session.
       
    71         */
       
    72     	CIconFileProvider(RFs aSession);
       
    73 
       
    74         /**
       
    75         * 2nd phase constructor.
       
    76         * @param aFilename. Full path to the icon file.
       
    77         */
       
    78         void ConstructL( const TDesC& aFilename);
       
    79 
       
    80     private: // Data
       
    81 
       
    82         /**
       
    83         * File server
       
    84         */
       
    85         RFs iSession;
       
    86 
       
    87         /**
       
    88         * Icon file name.
       
    89         *
       
    90         * Owned.
       
    91         */
       
    92         HBufC* iFilename;
       
    93     };
       
    94 
       
    95 #endif // ICONFILEPROVIDER