|
1 /* |
|
2 * Copyright (c) 2002-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: Defines a internal static utility class AknsJavaUtils. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef AKNSJAVAUTILS_H |
|
20 #define AKNSJAVAUTILS_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <AknIconUtils.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CFbsBitmap; |
|
28 class RApaLsSession; |
|
29 |
|
30 // TYPE DEFINITIONS |
|
31 |
|
32 // CLASS DECLARATION |
|
33 |
|
34 /** |
|
35 * Static utility class to support creating scalable Java midlet icons. |
|
36 * |
|
37 * This is an internal class. |
|
38 * The class is not intended for derivation outside the library. |
|
39 * |
|
40 * @lib AknSkins.lib |
|
41 * |
|
42 * @since 3.2 |
|
43 */ |
|
44 NONSHARABLE_CLASS( AknsJavaUtils) |
|
45 { |
|
46 |
|
47 public: // New functions |
|
48 /** |
|
49 * Creates an independent (in terms of instance ownership) copy of a |
|
50 * masked bitmap by the given bitmap and mask ID. |
|
51 * |
|
52 * |
|
53 * @since 3.2 |
|
54 * |
|
55 * @lib AknSkins.lib |
|
56 * |
|
57 * @param aApaSession ApaSession (caller owns). |
|
58 * |
|
59 * @param aAppUid Application UID. Identifies the Java icon .mif file. |
|
60 * |
|
61 * |
|
62 * @param aBitmap If method succeeds, set to point to the |
|
63 * newly constructed bitmap. Ownership of the bitmap is transferred |
|
64 * to the caller. |
|
65 * |
|
66 * @param aMask If method succeeds, set to point to the newly |
|
67 * constructed mask bitmap. Ownership of the bitmap is transferred |
|
68 * to the caller. |
|
69 * |
|
70 * @param aFileBitmapId ID of the bitmap in the file. |
|
71 * |
|
72 * @param aFileMaskId ID of the mask in the file. |
|
73 * |
|
74 * @par Exceptions: |
|
75 * If data construction fails or bitmap is not found, the function |
|
76 * leaves with an error code. |
|
77 */ |
|
78 static void CreateIconLC( |
|
79 RApaLsSession& aApaSession, |
|
80 TUid aAppUid, |
|
81 CFbsBitmap*& aBitmap, CFbsBitmap*& aMask, |
|
82 TInt aFileBitmapId, TInt aFileMaskId ); |
|
83 |
|
84 /** |
|
85 * Returns if the aIconFilename is java icon file name or not. |
|
86 * |
|
87 * @since 3.2 |
|
88 * |
|
89 * @param aIconFilename icon file name. |
|
90 * |
|
91 * @return ETrue if aIconFilename is java icon otherwise EFalse. |
|
92 * |
|
93 * @internal |
|
94 */ |
|
95 static TBool IsJavaIcon(const TDesC& aIconFilename); |
|
96 |
|
97 private: |
|
98 |
|
99 NONSHARABLE_CLASS( CJavaIconFileProvider): public CBase, public MAknIconFileProvider |
|
100 { |
|
101 |
|
102 public: // Constructors and destructor |
|
103 |
|
104 /** |
|
105 * Two-phased constructor. |
|
106 */ |
|
107 static CJavaIconFileProvider* NewL( RApaLsSession& aApaSession, TUid aAppUid); |
|
108 |
|
109 virtual ~CJavaIconFileProvider() {} |
|
110 |
|
111 |
|
112 private: // Constructor |
|
113 |
|
114 /** |
|
115 * C++ default constructor. |
|
116 */ |
|
117 CJavaIconFileProvider(); |
|
118 |
|
119 CJavaIconFileProvider(RApaLsSession& aApaSession, TUid aAppUid): |
|
120 iApaSession(aApaSession), iAppUid(aAppUid){} |
|
121 |
|
122 private: // From CAknIconManager |
|
123 /** |
|
124 * Returns an open file handle to the icon file. |
|
125 * This method should leave if an icon file with specified type does |
|
126 * not exist. That may be the case e.g. with MBM file, |
|
127 * if there are no bitmap icons. |
|
128 * |
|
129 * Note! RFs::ShareProtected must be called to the RFs instance used |
|
130 * for opening the file. |
|
131 * |
|
132 * @param aFile Icon file should be opened in this file handle, which |
|
133 * is an empty file handle, when the AknIcon framework calls this method. |
|
134 * The AknIcon framework takes care of closing the file handle after |
|
135 * having used it. |
|
136 * @param aType Icon file type. |
|
137 */ |
|
138 void RetrieveIconFileHandleL(RFile& aFile, const TIconFileType aType ); |
|
139 |
|
140 /** |
|
141 * With this method, AknIcon framework informs that it does not use |
|
142 * this MAknIconFileProvider instance any more. After this call, |
|
143 * it is ok to delete the object. This can be implemented simply |
|
144 * e.g. by deleting self in this callback. |
|
145 * Normally, this callback is invoked when the icon in question |
|
146 * is deleted. |
|
147 * Note, however, that if the same MAknIconFileProvider instance is |
|
148 * supplied in multiple CreateIcon calls, then it must be accessible |
|
149 * by AknIcon framework until it has signalled a matching amount |
|
150 * of these callbacks. |
|
151 */ |
|
152 void Finished(); |
|
153 |
|
154 private: |
|
155 TUid iAppUid; // UID of Java Midlet |
|
156 RApaLsSession& iApaSession; // ApaSession not owned |
|
157 }; |
|
158 |
|
159 private: // Prohibited constructors and destructor |
|
160 |
|
161 // Construction prohibited (static class) |
|
162 AknsJavaUtils(); |
|
163 // Destruction prohibited (static class) |
|
164 ~AknsJavaUtils(); |
|
165 }; |
|
166 |
|
167 #endif // AKNSJAVAUTILS_H |
|
168 |
|
169 // End of File |