widgetmanager/inc/wmiconfileprovider.h
changeset 1 5315654608de
parent 0 f72a12da539e
child 2 08c6ee43b396
equal deleted inserted replaced
0:f72a12da539e 1:5315654608de
     1 /*
       
     2 * Copyright (c) 2009 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 * CWmIconFileProvider declaration
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef WMICONFILEPROVIDER_H_
       
    20 #define WMICONFILEPROVIDER_H_
       
    21 
       
    22 // INCLUDES
       
    23 #include <f32file.h>
       
    24 #include <AknIconUtils.h>
       
    25 
       
    26 // CLASS DECLARATIONS
       
    27 
       
    28 /**
       
    29 * CWmIconFileProvider
       
    30 */
       
    31 NONSHARABLE_CLASS( CWmIconFileProvider ) : public CBase,
       
    32                             public MAknIconFileProvider 
       
    33     {	
       
    34 public:	
       
    35 	/**
       
    36     * Two-phased constructor.
       
    37     *
       
    38     * @param aFs A handle to a file server session.
       
    39     * @return New instance of CWmIconFileProvider.
       
    40     */
       
    41 	static CWmIconFileProvider* NewL( RFs& aFs );	
       
    42 	
       
    43     /**
       
    44     * Destructor.
       
    45     */
       
    46 	~CWmIconFileProvider();
       
    47 
       
    48     /**
       
    49     * @return icon file name.
       
    50     */
       
    51     inline const TDesC& IconFileName();
       
    52 
       
    53     /**
       
    54     * Setter for icon file name.
       
    55     */
       
    56     void SetIconFile( const TDesC& aFileName );
       
    57         
       
    58     
       
    59 private:
       
    60 	//from MAknIconFileProvider
       
    61 	
       
    62     /**
       
    63     * Returns an open file handle to the icon file.
       
    64     * This method should leave if an icon file with specified type does
       
    65     * not exist. That may be the case e.g. with MBM file,
       
    66     * if there are no bitmap icons.
       
    67     *
       
    68     * Note! RFs::ShareProtected must be called to the RFs instance used
       
    69     * for opening the file.
       
    70     *
       
    71     * @param aFile Icon file should be opened in this file handle, which
       
    72     * is an empty file handle, when the AknIcon framework calls this method.
       
    73     * The AknIcon framework takes care of closing the file handle after
       
    74     * having used it.
       
    75     * @param aType Icon file type.
       
    76     */
       
    77 	void RetrieveIconFileHandleL( RFile& aFile, const TIconFileType aType );
       
    78     
       
    79     /**
       
    80     * With this method, AknIcon framework informs that it does not use
       
    81     * this MAknIconFileProvider instance any more. After this call,
       
    82     * it is ok to delete the object. This can be implemented simply
       
    83     * e.g. by deleting self in this callback.
       
    84     * Normally, this callback is invoked when the icon in question
       
    85     * is deleted.
       
    86     * Note, however, that if the same MAknIconFileProvider instance is
       
    87     * supplied in multiple CreateIcon calls, then it must be accessible
       
    88     * by AknIcon framework until it has signalled a matching amount
       
    89     * of these callbacks.
       
    90     */
       
    91     void Finished();
       
    92     
       
    93 private:
       
    94     /**
       
    95     * Constructor
       
    96     *
       
    97     * @param aFs A handle to a file server session.
       
    98     */
       
    99     CWmIconFileProvider( RFs& aFs );
       
   100     
       
   101     /** 2nd phase constructor */
       
   102     void ConstructL();
       
   103     
       
   104 private: // data
       
   105     
       
   106     /** the file session */
       
   107     RFs& iFs;
       
   108     
       
   109     /** A buffer that can contain the name of a file. */
       
   110     TFileName iFileName;
       
   111     
       
   112     /** used for file session */
       
   113     RFile iFile;
       
   114     };
       
   115 
       
   116 #include "wmiconfileprovider.inl"
       
   117 #endif // WMICONFILEPROVIDER_H_