williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description:
|
williamr@2
|
15 |
* Phonebook icon info class definition.
|
williamr@2
|
16 |
*
|
williamr@2
|
17 |
*/
|
williamr@2
|
18 |
|
williamr@2
|
19 |
|
williamr@2
|
20 |
#ifndef __PbkIconInfo_H__
|
williamr@2
|
21 |
#define __PbkIconInfo_H__
|
williamr@2
|
22 |
|
williamr@2
|
23 |
// INCLUDES
|
williamr@2
|
24 |
#include <e32base.h> // CBase
|
williamr@2
|
25 |
#include <PbkIconId.hrh> // TPbkIconId
|
williamr@2
|
26 |
#include <AknsItemID.h> // TAknsItemID
|
williamr@2
|
27 |
|
williamr@2
|
28 |
// FORWARD DECLARATIONS
|
williamr@2
|
29 |
class TResourceReader;
|
williamr@2
|
30 |
class CCoeEnv;
|
williamr@2
|
31 |
class CGulIcon;
|
williamr@2
|
32 |
class CPbkIconInfoContainer;
|
williamr@2
|
33 |
class MAknsSkinInstance;
|
williamr@2
|
34 |
|
williamr@2
|
35 |
// CLASS DECLARATION
|
williamr@2
|
36 |
|
williamr@2
|
37 |
/**
|
williamr@2
|
38 |
* Phonebook icon information encapsulating class.
|
williamr@2
|
39 |
* @see CPbkIconInfoContainer
|
williamr@2
|
40 |
* @deprecated
|
williamr@2
|
41 |
*/
|
williamr@2
|
42 |
class TPbkIconInfo
|
williamr@2
|
43 |
{
|
williamr@2
|
44 |
public: // interface
|
williamr@2
|
45 |
/**
|
williamr@2
|
46 |
* Returns the unique Phonebook icon id of this icon.
|
williamr@2
|
47 |
* @return The unique Phonebook icon id of this icon.
|
williamr@2
|
48 |
*/
|
williamr@2
|
49 |
IMPORT_C TPbkIconId PbkIconInfoId() const;
|
williamr@2
|
50 |
|
williamr@2
|
51 |
/**
|
williamr@2
|
52 |
* Returns the bitmap file name of this icon.
|
williamr@2
|
53 |
* @return The bitmap file name of this icon.
|
williamr@2
|
54 |
*/
|
williamr@2
|
55 |
IMPORT_C const TDesC& MbmFileName() const;
|
williamr@2
|
56 |
|
williamr@2
|
57 |
/**
|
williamr@2
|
58 |
* Returns this icon's id in the bitmap file.
|
williamr@2
|
59 |
* @return This icon's id in the bitmap file.
|
williamr@2
|
60 |
*/
|
williamr@2
|
61 |
IMPORT_C TInt IconId() const;
|
williamr@2
|
62 |
|
williamr@2
|
63 |
/**
|
williamr@2
|
64 |
* Returns this icon's mask id in the bitmap file.
|
williamr@2
|
65 |
* @return This icon's mask id in the bitmap file.
|
williamr@2
|
66 |
*/
|
williamr@2
|
67 |
IMPORT_C TInt MaskId() const;
|
williamr@2
|
68 |
|
williamr@2
|
69 |
/**
|
williamr@2
|
70 |
* Returns this icon's skin id.
|
williamr@2
|
71 |
* @return This icon's skin id.
|
williamr@2
|
72 |
*/
|
williamr@2
|
73 |
IMPORT_C TAknsItemID SkinId() const;
|
williamr@2
|
74 |
|
williamr@2
|
75 |
/**
|
williamr@2
|
76 |
* Returns this icon's color table id.
|
williamr@2
|
77 |
* @return This icon's color table id.
|
williamr@2
|
78 |
*/
|
williamr@2
|
79 |
TAknsItemID ColorId() const;
|
williamr@2
|
80 |
|
williamr@2
|
81 |
/**
|
williamr@2
|
82 |
* Returns this icon's index in the color table.
|
williamr@2
|
83 |
* @return This icon's index in the color table.
|
williamr@2
|
84 |
*/
|
williamr@2
|
85 |
TInt ColorIndex() const;
|
williamr@2
|
86 |
|
williamr@2
|
87 |
/**
|
williamr@2
|
88 |
* Returns this icon's index in the color table.
|
williamr@2
|
89 |
* @return This icon's index in the color table.
|
williamr@2
|
90 |
*/
|
williamr@2
|
91 |
TInt DefaultColorIndex() const;
|
williamr@2
|
92 |
|
williamr@2
|
93 |
private: // Interface for CPbkIconInfoContainer
|
williamr@2
|
94 |
friend class CPbkIconInfoContainer;
|
williamr@2
|
95 |
TPbkIconInfo();
|
williamr@2
|
96 |
~TPbkIconInfo();
|
williamr@2
|
97 |
void ReadFromResourceLC(TResourceReader& aReader);
|
williamr@2
|
98 |
void Destroy();
|
williamr@2
|
99 |
|
williamr@2
|
100 |
private: // Unimplemented functions
|
williamr@2
|
101 |
/// Private, unimplemented copy constructor
|
williamr@2
|
102 |
TPbkIconInfo(const TPbkIconInfo&);
|
williamr@2
|
103 |
/// Private, unimplemented assignment operator
|
williamr@2
|
104 |
TPbkIconInfo& operator=(const TPbkIconInfo&);
|
williamr@2
|
105 |
|
williamr@2
|
106 |
private: // data members
|
williamr@2
|
107 |
// Own: unique phonebook icon id
|
williamr@2
|
108 |
TPbkIconId iPbkIconInfoId;
|
williamr@2
|
109 |
// Own: Icon bitmap
|
williamr@2
|
110 |
TInt iIconId;
|
williamr@2
|
111 |
// Own: mask bitmap
|
williamr@2
|
112 |
TInt iMaskId;
|
williamr@2
|
113 |
// Ref: Mbm file name
|
williamr@2
|
114 |
HBufC* iMbmFileName;
|
williamr@2
|
115 |
/// Own: SkinId
|
williamr@2
|
116 |
TAknsItemID iSkinId;
|
williamr@2
|
117 |
/// Own: ColorId
|
williamr@2
|
118 |
TAknsItemID iColorId;
|
williamr@2
|
119 |
/// Own: Color index
|
williamr@2
|
120 |
TInt iColorIndex;
|
williamr@2
|
121 |
/// Own: Default color index
|
williamr@2
|
122 |
TInt iDefaultColorIndex;
|
williamr@2
|
123 |
};
|
williamr@2
|
124 |
|
williamr@2
|
125 |
|
williamr@2
|
126 |
/**
|
williamr@2
|
127 |
* Collection of phonebook icon info objects.
|
williamr@2
|
128 |
* @see TPbkIconInfo
|
williamr@2
|
129 |
* @deprecated
|
williamr@2
|
130 |
*/
|
williamr@2
|
131 |
class CPbkIconInfoContainer : public CBase
|
williamr@2
|
132 |
{
|
williamr@2
|
133 |
public: // Constructors and destructor
|
williamr@2
|
134 |
/**
|
williamr@2
|
135 |
* Creates a new instance of this class intialized with Phonebook
|
williamr@2
|
136 |
* default icon info from PbkView.rsc. Note that PbkView.rsc has to
|
williamr@2
|
137 |
* be loaded, see RPbkViewResourceFile.
|
williamr@2
|
138 |
*
|
williamr@2
|
139 |
* @param aCoeEnv Optional CCoeEnv instance. This function performs
|
williamr@2
|
140 |
* faster if this parameter is provided.
|
williamr@2
|
141 |
* @return A new instance of this class.
|
williamr@2
|
142 |
*/
|
williamr@2
|
143 |
IMPORT_C static CPbkIconInfoContainer* NewL(CCoeEnv* aCoeEnv=NULL);
|
williamr@2
|
144 |
|
williamr@2
|
145 |
/**
|
williamr@2
|
146 |
* Creates a new instance of this class.
|
williamr@2
|
147 |
*
|
williamr@2
|
148 |
* @param aReader Resource reader initialized to point to an array
|
williamr@2
|
149 |
* of PBK_ICON_INFO resources.
|
williamr@2
|
150 |
* @return A new instance of this class.
|
williamr@2
|
151 |
*/
|
williamr@2
|
152 |
IMPORT_C static CPbkIconInfoContainer* NewL(TResourceReader& aReader);
|
williamr@2
|
153 |
|
williamr@2
|
154 |
/**
|
williamr@2
|
155 |
* Creates a new instance of this class.
|
williamr@2
|
156 |
*
|
williamr@2
|
157 |
* @param aResourceId Resource id of an array of PBK_ICON_INFO
|
williamr@2
|
158 |
* resources. Phonebook default icon info
|
williamr@2
|
159 |
* array's resource id is R_PBK_ICON_INFO_ARRAY
|
williamr@2
|
160 |
* in PbkView.rsc.
|
williamr@2
|
161 |
* @param aCoeEnv Optional CCoeEnv instance. This function performs
|
williamr@2
|
162 |
* faster if this parameter is provided.
|
williamr@2
|
163 |
* @return A new instance of this class.
|
williamr@2
|
164 |
*/
|
williamr@2
|
165 |
IMPORT_C static CPbkIconInfoContainer* NewL
|
williamr@2
|
166 |
(TInt aResourceId, CCoeEnv* aCoeEnv=NULL);
|
williamr@2
|
167 |
|
williamr@2
|
168 |
/**
|
williamr@2
|
169 |
* Destructor.
|
williamr@2
|
170 |
*/
|
williamr@2
|
171 |
~CPbkIconInfoContainer();
|
williamr@2
|
172 |
|
williamr@2
|
173 |
public: // Interface
|
williamr@2
|
174 |
/**
|
williamr@2
|
175 |
* Finds a particular TPbkIconInfo in the container.
|
williamr@2
|
176 |
*
|
williamr@2
|
177 |
* @param aIconId Id of the icon info to search.
|
williamr@2
|
178 |
* @return Matching icon info or NULL if not found.
|
williamr@2
|
179 |
*/
|
williamr@2
|
180 |
IMPORT_C const TPbkIconInfo* Find(TPbkIconId aIconId) const;
|
williamr@2
|
181 |
|
williamr@2
|
182 |
/**
|
williamr@2
|
183 |
* Creates and returns a CGulIcon object corresponding to the aIconId.
|
williamr@2
|
184 |
* ownership of the returned object is transferred to the client. Returns
|
williamr@2
|
185 |
* NULL if icon id is not in the array.
|
williamr@2
|
186 |
*
|
williamr@2
|
187 |
* @param aIconId Phonebook icon id.
|
williamr@2
|
188 |
* @return Icon object corresponding to the icon id. NULL if not found.
|
williamr@2
|
189 |
*/
|
williamr@2
|
190 |
IMPORT_C CGulIcon* LoadBitmapL(TPbkIconId aIconId) const;
|
williamr@2
|
191 |
|
williamr@2
|
192 |
/**
|
williamr@2
|
193 |
* Appends new icon info elements from aResourceId. The resource must
|
williamr@2
|
194 |
* be of PBK_ICON_INFO type.
|
williamr@2
|
195 |
*
|
williamr@2
|
196 |
* @param aResourceId Resource id for icon infos to be added.
|
williamr@2
|
197 |
*/
|
williamr@2
|
198 |
IMPORT_C void AppendIconsFromResourceL(TInt aResourceId);
|
williamr@2
|
199 |
|
williamr@2
|
200 |
private: // Implementation
|
williamr@2
|
201 |
CPbkIconInfoContainer();
|
williamr@2
|
202 |
void ConstructL(TResourceReader& aReader);
|
williamr@2
|
203 |
void DoAppendIconsFromResourceL(TResourceReader& aReader);
|
williamr@2
|
204 |
|
williamr@2
|
205 |
private: // data members
|
williamr@2
|
206 |
/// Own: array of icon infos
|
williamr@2
|
207 |
RArray<TPbkIconInfo> iIconArray;
|
williamr@2
|
208 |
};
|
williamr@2
|
209 |
|
williamr@2
|
210 |
/**
|
williamr@2
|
211 |
* Phonebook icon utilility class. This class is a helper class
|
williamr@2
|
212 |
* for loading skinned bitmaps.
|
williamr@2
|
213 |
*/
|
williamr@2
|
214 |
class PbkIconUtils
|
williamr@2
|
215 |
{
|
williamr@2
|
216 |
public:
|
williamr@2
|
217 |
/**
|
williamr@2
|
218 |
* Creates a skinned icon from the aIconInfo information.
|
williamr@2
|
219 |
* @param aSkin Pointer to a skin instance.
|
williamr@2
|
220 |
* @param aBitmap Bitmap to set.
|
williamr@2
|
221 |
* @param aMask Mask to set.
|
williamr@2
|
222 |
* @param aIconInfo Bitmap and mask information.
|
williamr@2
|
223 |
*/
|
williamr@2
|
224 |
IMPORT_C static void CreateIconL(
|
williamr@2
|
225 |
MAknsSkinInstance* aSkin,
|
williamr@2
|
226 |
CFbsBitmap*& aBitmap,
|
williamr@2
|
227 |
CFbsBitmap*& aMask,
|
williamr@2
|
228 |
const TPbkIconInfo& aIconInfo);
|
williamr@2
|
229 |
|
williamr@2
|
230 |
/**
|
williamr@2
|
231 |
* Creates a skinned icon from the aIconInfo information.
|
williamr@2
|
232 |
* @param aSkin Pointer to a skin instance.
|
williamr@2
|
233 |
* @param aBitmap Bitmap to set.
|
williamr@2
|
234 |
* @param aMask Mask to set.
|
williamr@2
|
235 |
* @param aIconInfo Bitmap and mask information.
|
williamr@2
|
236 |
*/
|
williamr@2
|
237 |
IMPORT_C static void CreateIconLC(
|
williamr@2
|
238 |
MAknsSkinInstance* aSkin,
|
williamr@2
|
239 |
CFbsBitmap*& aBitmap,
|
williamr@2
|
240 |
CFbsBitmap*& aMask,
|
williamr@2
|
241 |
const TPbkIconInfo& aIconInfo);
|
williamr@2
|
242 |
private:
|
williamr@2
|
243 |
PbkIconUtils();
|
williamr@2
|
244 |
~PbkIconUtils();
|
williamr@2
|
245 |
};
|
williamr@2
|
246 |
|
williamr@2
|
247 |
|
williamr@2
|
248 |
#endif // __PbkIconInfo_H__
|
williamr@2
|
249 |
|
williamr@2
|
250 |
// End of File
|