|
1 /* |
|
2 * Copyright (c) 2008-2008 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: Implements icon file provider for branding usage. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_CCHUIPLUGINICONFILEPROVIDER_H |
|
21 #define C_CCHUIPLUGINICONFILEPROVIDER_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <AknsItemID.h> |
|
25 #include <AknIconUtils.h> |
|
26 |
|
27 |
|
28 /** |
|
29 * Icon File Provider. |
|
30 * Provides functionality to get icon file handle. Required to use |
|
31 * when handling icon data fetched from branding server. Lifetime of |
|
32 * the file handles must be maintained by using this provider. Otherwise |
|
33 * usage of icon data (even in framework) might lead to a crash. |
|
34 * |
|
35 * @code |
|
36 * CCchUiPluginIconFileProvider* fp = |
|
37 * CCchUiPluginIconFileProvider::NewL( aFile ); |
|
38 * CleanupStack::PushL( fp ); |
|
39 * |
|
40 * AknIconUtils::CreateIconLC( aBitmap, aMask, |
|
41 * *ifp, |
|
42 * bsBitmap.BitmapId(), |
|
43 * bsBitmap.BitmapMaskId() ); |
|
44 * CleanupStack::Pop( fp ); // framework frees via handle |
|
45 * |
|
46 * @endcode |
|
47 * |
|
48 * @lib cchuinotif.lib |
|
49 * @since S60 5.0 |
|
50 */ |
|
51 NONSHARABLE_CLASS( CCchUiPluginIconFileProvider ): |
|
52 public CBase, public MAknIconFileProvider |
|
53 { |
|
54 public: |
|
55 |
|
56 /** |
|
57 * Two-phased constructor. |
|
58 * |
|
59 * @since S60 5.0 |
|
60 * @param aFile File handle. |
|
61 */ |
|
62 static CCchUiPluginIconFileProvider* NewL( RFile& aFile ); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 */ |
|
67 virtual ~CCchUiPluginIconFileProvider(); |
|
68 |
|
69 |
|
70 // from base class MAknIconFileProvider |
|
71 |
|
72 /** |
|
73 * From MAknIconFileProvider. |
|
74 * Returns an open file handle to the icon file. |
|
75 * |
|
76 * @param aFile Icon file should be opened in this file handle, which |
|
77 * is an empty file handle, when the AknIcon framework calls this |
|
78 * method. The AknIcon framework takes care of closing the file handle |
|
79 * after having used it. |
|
80 * @param aType Icon file type. |
|
81 */ |
|
82 void RetrieveIconFileHandleL( RFile& aFile, const TIconFileType aType ); |
|
83 |
|
84 /** |
|
85 * From MAknIconFileProvider. |
|
86 * With this method, AknIcon framework informs that it does not use |
|
87 * this MAknIconFileProvider instance any more. |
|
88 */ |
|
89 void Finished(); |
|
90 |
|
91 private: |
|
92 |
|
93 CCchUiPluginIconFileProvider( RFile& aFile ); |
|
94 |
|
95 |
|
96 private: // data |
|
97 |
|
98 /** |
|
99 * Reference to file handle. |
|
100 * Not own. |
|
101 */ |
|
102 RFile& iFile; |
|
103 }; |
|
104 |
|
105 #endif // C_CCHUIPLUGINICONFILEPROVIDER_H |