|
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 * CWmWidgetData declaration |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef WMWIDGETDATA_H |
|
21 #define WMWIDGETDATA_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32std.h> |
|
25 #include <e32base.h> |
|
26 #include <f32file.h> |
|
27 #include <bamdesca.h> |
|
28 #include <hscontentinfo.h> |
|
29 |
|
30 #include "wmimageconverter.h" |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CDictionaryFileStore; |
|
34 class MWmWidgetDataObserver; |
|
35 class CFbsBitmap; |
|
36 class CHsContentInfo; |
|
37 class CWmPersistentWidgetOrder; |
|
38 class RWidgetRegistryClientSession; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 /** |
|
42 * CWmWidgetData is a representation of a widget in CWmListBox. it |
|
43 * stores all data required for drawing the item in a list box, and |
|
44 * handling the list item. |
|
45 */ |
|
46 NONSHARABLE_CLASS( CWmWidgetData ) |
|
47 : public CBase |
|
48 , public MConverterObserver |
|
49 { |
|
50 |
|
51 public: // types |
|
52 |
|
53 /** widget type */ |
|
54 enum TWidgetType |
|
55 { |
|
56 EUnknown, |
|
57 ENative, |
|
58 ECps // wrt widgets included in this category |
|
59 }; |
|
60 |
|
61 public: // construction |
|
62 /** |
|
63 * Two-phased constructor. |
|
64 * @param aHsContentInfo |
|
65 * @param aRegistryClientSession |
|
66 */ |
|
67 static CWmWidgetData* NewL( |
|
68 CHsContentInfo& aHsContentInfo, |
|
69 RWidgetRegistryClientSession* aRegistryClientSession ); |
|
70 |
|
71 /** |
|
72 * Two-phased constructor. |
|
73 * @param aHsContentInfo |
|
74 * @param aRegistryClientSession |
|
75 */ |
|
76 static CWmWidgetData* NewLC( |
|
77 CHsContentInfo& aHsContentInfo, |
|
78 RWidgetRegistryClientSession* aRegistryClientSession ); |
|
79 |
|
80 /** Destructor. */ |
|
81 ~CWmWidgetData(); |
|
82 |
|
83 private: // private construction |
|
84 /** Constructor for performing 1st stage construction */ |
|
85 CWmWidgetData(); |
|
86 |
|
87 /** 2nd phase constructor */ |
|
88 void ConstructL( |
|
89 CHsContentInfo& aHsContentInfo, |
|
90 RWidgetRegistryClientSession* aRegistryClientSession ); |
|
91 |
|
92 public: // external handles |
|
93 |
|
94 /** |
|
95 * sets an observer for callbacks |
|
96 * |
|
97 * @param aObserver notifications when changes occur in widget data |
|
98 */ |
|
99 void SetObserver( MWmWidgetDataObserver* aObserver ); |
|
100 |
|
101 /** |
|
102 * persistent widget order handle, which is used in comparing |
|
103 */ |
|
104 void SetPersistentWidgetOrder( |
|
105 const CWmPersistentWidgetOrder* aPersistentWidgetOrder ); |
|
106 |
|
107 /** |
|
108 * set logo rect size |
|
109 */ |
|
110 void SetLogoSize( const TSize& aSize ); |
|
111 |
|
112 /** |
|
113 * Init logo re-creation |
|
114 */ |
|
115 void ReCreateLogo( const TSize& aSize ); |
|
116 |
|
117 public: // comparing / sorting |
|
118 /** whether this object represents the same widget as aContentInfo */ |
|
119 TBool EqualsTo( CHsContentInfo& aContentInfo ); |
|
120 |
|
121 /** comparator function for sort by name (compare two names)*/ |
|
122 static TInt CompareByName( |
|
123 const CWmWidgetData& aDataOne, |
|
124 const CWmWidgetData& aDataTwo ); |
|
125 |
|
126 /** |
|
127 * comparator function for sorting by stored order |
|
128 **/ |
|
129 static TInt CompareByPersistentWidgetOrder( |
|
130 const CWmWidgetData& aDataOne, |
|
131 const CWmWidgetData& aDataTwo ); |
|
132 |
|
133 public: // methods to read the content |
|
134 |
|
135 /** the HsContent info */ |
|
136 inline CHsContentInfo& HsContentInfo(); |
|
137 |
|
138 /** the HsContent info */ |
|
139 inline const CHsContentInfo& HsContentInfo() const; |
|
140 |
|
141 /** widget name */ |
|
142 inline const TDesC& Name() const; |
|
143 |
|
144 /** widget description */ |
|
145 inline const TDesC& Description() const; |
|
146 |
|
147 /** widget uid */ |
|
148 inline TUid Uid() const; |
|
149 |
|
150 /** cps widget publisher id */ |
|
151 inline const TDesC& PublisherId() const; |
|
152 |
|
153 /** cps widget publisher uid */ |
|
154 TUid PublisherUid(); |
|
155 |
|
156 /** widget type */ |
|
157 inline TWidgetType WidgetType() const; |
|
158 |
|
159 /** running install animation index */ |
|
160 inline TInt InstallAnimationIndex() const; |
|
161 |
|
162 /** the logo bitmap */ |
|
163 inline const CFbsBitmap* LogoImage(); |
|
164 |
|
165 /** the logo bitmap */ |
|
166 inline const CFbsBitmap* LogoImageMask(); |
|
167 |
|
168 /** whether the widget data is valid or not */ |
|
169 inline TBool IsValid(); |
|
170 |
|
171 /** sets the widget data validity */ |
|
172 inline void SetValid( TBool aValid ); |
|
173 |
|
174 protected: // from MConverterObserver |
|
175 |
|
176 /** image conversin completed */ |
|
177 void NotifyCompletion( TInt aError ); |
|
178 |
|
179 private: // new functions |
|
180 |
|
181 /** fetches publisher uid from widget registry*/ |
|
182 void FetchPublisherUidL( |
|
183 RWidgetRegistryClientSession* aRegistryClientSession ); |
|
184 |
|
185 /** Converts uid to TUid from TDesC8 */ |
|
186 TUid UidFromString( const TDesC8& aUidString ) const; |
|
187 |
|
188 /** Logo icon string handling */ |
|
189 static TInt HandleAsyncIconString( TAny* aPtr ); |
|
190 void HandleIconStringL( const TDesC& aIconStr ); |
|
191 void FireDataChanged(); |
|
192 |
|
193 private: // data members |
|
194 |
|
195 /* instance of the CIdle class for async iconStr handling*/ |
|
196 CIdle* iIdle; |
|
197 |
|
198 /* the image converter utility */ |
|
199 CWmImageConverter* iImageConverter; |
|
200 |
|
201 /* observes this widget representation (NOT OWNED) */ |
|
202 MWmWidgetDataObserver* iObserver; |
|
203 |
|
204 /* rotating animation index */ |
|
205 TInt iInstallAnimationIndex; |
|
206 |
|
207 /** the widget logo bitmap */ |
|
208 CFbsBitmap* iLogoImage; |
|
209 |
|
210 /** the widget logo mask */ |
|
211 CFbsBitmap* iLogoImageMask; |
|
212 |
|
213 /** The CHsContentInfo that corresponds to this list row */ |
|
214 CHsContentInfo* iHsContentInfo; |
|
215 |
|
216 /** type oif the widget */ |
|
217 TWidgetType iWidgetType; |
|
218 |
|
219 /** persistent order of widgets (used in sorting) */ |
|
220 const CWmPersistentWidgetOrder* iPersistentWidgetOrder; |
|
221 |
|
222 /** wrt widget publisher uid */ |
|
223 TUid iPublisherUid; |
|
224 |
|
225 /** size of logo rect in list item */ |
|
226 TSize iLogoSize; |
|
227 |
|
228 /** validity of the widget - used during list refresh */ |
|
229 TBool iValid; |
|
230 |
|
231 }; |
|
232 |
|
233 |
|
234 /** |
|
235 * Pointer array of widget data objects. |
|
236 * Also acts as an adapter to a descriptor array, providing the |
|
237 * widget names as descriptor array elements. |
|
238 */ |
|
239 NONSHARABLE_CLASS( RWidgetDataValues ) : public RPointerArray<CWmWidgetData>, |
|
240 public MDesCArray |
|
241 { |
|
242 protected: // from MDesCArray |
|
243 /** returns number of items in the pointer array */ |
|
244 inline TInt MdcaCount() const; |
|
245 |
|
246 /** returns the pointed widget name */ |
|
247 inline TPtrC16 MdcaPoint(TInt aIndex) const; |
|
248 |
|
249 }; |
|
250 |
|
251 #include "wmwidgetdata.inl" |
|
252 #endif // WMWIDGETDATA_H |