sdkcreationmw/sdkexamples/cppexamples/S60Ex/helperfunctions/IconFileProvider.h
author rajpuroh
Mon, 08 Mar 2010 12:09:11 +0530
changeset 0 b26acd06ea60
permissions -rw-r--r--
First Contribution of SDK components
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     1
/*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     2
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     3
* All rights reserved.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     4
* This component and the accompanying materials are made available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     6
* which accompanies this distribution, and is available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     8
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     9
* Initial Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    11
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    12
* Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    13
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    14
* Description: 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    15
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    16
*/
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    17
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    18
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    19
#ifndef ICONFILEPROVIDER_H
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    20
#define ICONFILEPROVIDER_H
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    21
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    22
#include <akniconutils.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    23
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    24
/**
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    25
*  CIconFileProvider class.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    26
*  This class is used to provide a icon file handle to MAknIconFileProvider.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    27
*  With this class it is possible to use icons from application's private
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    28
*  folder.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    29
*/
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    30
class CIconFileProvider : public CBase,
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    31
                          public MAknIconFileProvider
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    32
    {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    33
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    34
    public:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    35
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    36
    	/**
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    37
        * Two-phased constructor.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    38
        * @param aSession File server session.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    39
        * @param aFilename Full path to the icon file
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    40
        */
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    41
    	static CIconFileProvider* NewL(RFs aSession, const TDesC& aFilename);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    42
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    43
    	/**
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    44
        * Destructor.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    45
        */
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    46
    	~CIconFileProvider();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    47
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    48
    private: //from MAknIconFileProvider
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    49
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    50
    	/**
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    51
        * Returns an open file handle to the icon file.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    52
        * @param aFile Icon file should be opened in this file handle, which
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    53
        *              is an empty file handle, when the AknIcon framework
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    54
        *              calls this method. The AknIcon framework takes care of
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    55
        *              closing the file handle after having used it.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    56
        * @param aType Icon file type.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    57
        */
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    58
    	void RetrieveIconFileHandleL( RFile& aFile, const TIconFileType aType );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    59
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    60
    	/**
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    61
        * With this method, AknIcon framework informs that it does not use
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    62
        * this MAknIconFileProvider instance any more.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    63
        */
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    64
        void Finished();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    65
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    66
    private:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    67
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    68
        /**
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    69
        * C++ default constructor.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    70
        * @param aSession. File server session.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    71
        */
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    72
    	CIconFileProvider(RFs aSession);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    73
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    74
        /**
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    75
        * 2nd phase constructor.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    76
        * @param aFilename. Full path to the icon file.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    77
        */
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    78
        void ConstructL( const TDesC& aFilename);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    79
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    80
    private: // Data
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    81
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    82
        /**
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    83
        * File server
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    84
        */
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    85
        RFs iSession;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    86
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    87
        /**
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    88
        * Icon file name.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    89
        *
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    90
        * Owned.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    91
        */
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    92
        HBufC* iFilename;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    93
    };
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    94
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    95
#endif // ICONFILEPROVIDER