63
|
1 |
/*
|
|
2 |
* Copyright (c) 2009-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: UI status control
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CCAPPSTATUSCONTROL_H_
|
|
20 |
#define CCAPPSTATUSCONTROL_H_
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <coecntrl.h>
|
|
24 |
#include <spbcontentprovider.h>
|
|
25 |
#include <ccaextensionfactory.h>
|
|
26 |
|
|
27 |
|
|
28 |
// FORWARD DECLARATIONS
|
|
29 |
class CEikImage;
|
|
30 |
class CEikLabel;
|
|
31 |
class CFbsBitmap;
|
|
32 |
class CAknIcon;
|
|
33 |
class MVPbkContactLink;
|
|
34 |
class CAknsFrameBackgroundControlContext;
|
|
35 |
class MTouchFeedback;
|
|
36 |
|
|
37 |
// CLASS DECLARATION
|
|
38 |
/**
|
|
39 |
* Class for observing click events to status control
|
|
40 |
*
|
|
41 |
* since s60 9.2
|
|
42 |
**/
|
|
43 |
class MCCAStatusControlObserver
|
|
44 |
{
|
|
45 |
public:
|
|
46 |
virtual void StatusClickedL() = 0;
|
|
47 |
|
|
48 |
protected:
|
|
49 |
virtual ~MCCAStatusControlObserver() {}
|
|
50 |
};
|
|
51 |
|
|
52 |
/**
|
|
53 |
* Class implements the status control
|
|
54 |
*
|
|
55 |
* @lib ccapputil.lib
|
|
56 |
* @since S60 9.2
|
|
57 |
*/
|
|
58 |
NONSHARABLE_CLASS( CCCAppStatusControl ) :
|
|
59 |
public CCoeControl,
|
|
60 |
public MSpbContentProviderObserver,
|
|
61 |
public MCCAStatusProviderObserver
|
|
62 |
{
|
|
63 |
public: // Construction & destruction
|
|
64 |
|
|
65 |
enum TContactType
|
|
66 |
{
|
|
67 |
ENormalContact = 0x01,
|
|
68 |
EMyCardContact = 0x02
|
|
69 |
};
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Two-phased constructor.
|
|
73 |
*/
|
|
74 |
IMPORT_C static CCCAppStatusControl* NewL(
|
|
75 |
CSpbContentProvider& aContentProvider,
|
|
76 |
MCCAStatusControlObserver& aObserver,
|
|
77 |
CCCAppStatusControl::TContactType aContactType );
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Destructor.
|
|
81 |
*/
|
|
82 |
~CCCAppStatusControl();
|
|
83 |
|
|
84 |
public: // New implementation
|
|
85 |
|
|
86 |
/**
|
|
87 |
* Sets the link object
|
|
88 |
*
|
|
89 |
* @aLink Link to current contact
|
|
90 |
*/
|
|
91 |
IMPORT_C void SetContactLinkL(
|
|
92 |
MVPbkContactLink& aLink );
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Change buttons state between pressed and released.
|
|
96 |
*
|
|
97 |
* @param aPressed ETrue to make the button pressed
|
|
98 |
*/
|
|
99 |
void SetPressed( TBool aPressed );
|
|
100 |
|
|
101 |
/**
|
|
102 |
* Set the default status icon
|
|
103 |
*
|
|
104 |
* @aDefaultStatusIcon Default status icon
|
|
105 |
*/
|
|
106 |
IMPORT_C void SetDefaultStatusIconL( CGulIcon* aDefaultStatusIcon );
|
|
107 |
|
|
108 |
/**
|
|
109 |
* Set the default status text
|
|
110 |
*
|
|
111 |
* @aDefaultStatusText Default status text
|
|
112 |
*/
|
|
113 |
IMPORT_C void SetDefaultStatusTextL( HBufC* aDefaultStatusText );
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Set the CCA statusprovider
|
|
117 |
*
|
|
118 |
* @aCCAStatusProvider ECom status provider
|
|
119 |
*/
|
|
120 |
IMPORT_C void SetStatusProvider( MCCAStatusProvider* aCCAStatusProvider );
|
|
121 |
|
|
122 |
public: // From CCoeControl
|
|
123 |
|
|
124 |
/**
|
|
125 |
* From CCoeControl
|
|
126 |
*/
|
|
127 |
TInt CountComponentControls() const;
|
|
128 |
|
|
129 |
/**
|
|
130 |
* From CCoeControl
|
|
131 |
*/
|
|
132 |
CCoeControl* ComponentControl( TInt aIndex ) const;
|
|
133 |
|
|
134 |
/**
|
|
135 |
* From CoeControl
|
|
136 |
*/
|
|
137 |
void SizeChanged();
|
|
138 |
|
|
139 |
/**
|
|
140 |
* From CoeControl
|
|
141 |
*/
|
|
142 |
void HandlePointerEventL( const TPointerEvent& aPointerEvent );
|
|
143 |
|
|
144 |
/**
|
|
145 |
* From CoeControl
|
|
146 |
*/
|
|
147 |
void SetContainerWindowL( const CCoeControl& aContainer );
|
|
148 |
|
|
149 |
/**
|
|
150 |
* From CoeControl
|
|
151 |
*/
|
|
152 |
void Draw( const TRect& aRect ) const;
|
|
153 |
|
|
154 |
public: // From MSpbContentProviderObserver
|
|
155 |
|
|
156 |
/**
|
|
157 |
* From MSpbContentProviderObserver
|
|
158 |
*/
|
|
159 |
void ContentUpdated(
|
|
160 |
MVPbkContactLink& aLink,
|
|
161 |
MSpbContentProviderObserver::TSpbContentEvent aEvent );
|
|
162 |
|
|
163 |
public: // From MCCAStatusProviderObserver
|
|
164 |
|
|
165 |
/*
|
|
166 |
* From MCCAStatusProviderObserver
|
|
167 |
*/
|
|
168 |
void StatusEvent(
|
|
169 |
MCCAStatusProviderObserver::TCCAStatusProviderObserverEvent aEvent,
|
|
170 |
const MVPbkContactLink* aLink = NULL );
|
|
171 |
|
|
172 |
private: // New functions
|
|
173 |
|
|
174 |
/**
|
|
175 |
* Wraps the status text to fit into the space allocated for it.
|
|
176 |
*/
|
|
177 |
TInt RewrapStatusTextL();
|
|
178 |
|
|
179 |
/**
|
|
180 |
* Show default status icon and text
|
|
181 |
*/
|
|
182 |
void ShowDefaultContentL();
|
|
183 |
|
|
184 |
/**
|
|
185 |
* Handle status update event
|
|
186 |
*
|
|
187 |
* @param aLink contact which has the status updated
|
|
188 |
* @param aEvent
|
|
189 |
*/
|
|
190 |
void DoStatusUpdateL(
|
|
191 |
MVPbkContactLink& aLink,
|
|
192 |
MSpbContentProviderObserver::TSpbContentEvent aEvent );
|
|
193 |
|
|
194 |
/*
|
|
195 |
* Update contact status from ECom plugin
|
|
196 |
* @param aLink contact which has the status updated
|
|
197 |
*/
|
|
198 |
void UpdateCCAStatusL( MVPbkContactLink* aLink );
|
|
199 |
|
|
200 |
void SetVariableLayouts( TInt aOption );
|
|
201 |
|
|
202 |
inline void RewrapStatusTextToArrayL(
|
|
203 |
TDes& aStatusText,
|
|
204 |
CArrayFix<TPtrC>& aTxtArray );
|
|
205 |
|
|
206 |
protected: // construction
|
|
207 |
|
|
208 |
/**
|
|
209 |
* Constructor for performing 1st stage construction
|
|
210 |
*/
|
|
211 |
CCCAppStatusControl(
|
|
212 |
CSpbContentProvider& aContentProvider,
|
|
213 |
MCCAStatusControlObserver& aObserver,
|
|
214 |
CCCAppStatusControl::TContactType aContactType );
|
|
215 |
|
|
216 |
/**
|
|
217 |
* Constructor for performing 2nd stage construction
|
|
218 |
*/
|
|
219 |
void ConstructL();
|
|
220 |
|
|
221 |
protected: // enums
|
|
222 |
|
|
223 |
/**
|
|
224 |
* Internal states
|
|
225 |
*/
|
|
226 |
enum TStatusControlState
|
|
227 |
{
|
|
228 |
// Show nothing
|
|
229 |
EStateUndefined,
|
|
230 |
// Default content shown
|
|
231 |
EStateDefaultContent,
|
|
232 |
// Status content shown
|
|
233 |
EStateStatusContent
|
|
234 |
};
|
|
235 |
|
|
236 |
protected: // data
|
|
237 |
|
|
238 |
/**
|
|
239 |
* Own. Status service icon control
|
|
240 |
*/
|
|
241 |
CEikImage* iStatusImage;
|
|
242 |
|
|
243 |
/**
|
|
244 |
* Own. Status text label control
|
|
245 |
*/
|
|
246 |
CEikLabel* iStatusLabel1;
|
|
247 |
CEikLabel* iStatusLabel2;
|
|
248 |
|
|
249 |
/**
|
|
250 |
* Own. The status service bitmap
|
|
251 |
*/
|
|
252 |
CGulIcon* iStatusIcon;
|
|
253 |
|
|
254 |
/**
|
|
255 |
* The status icon size on UI
|
|
256 |
*/
|
|
257 |
TSize iStatusIconSize;
|
|
258 |
|
|
259 |
/**
|
|
260 |
* Own. Current status text
|
|
261 |
*/
|
|
262 |
HBufC* iStatusText;
|
|
263 |
|
|
264 |
/**
|
|
265 |
* Own. Default status text
|
|
266 |
*/
|
|
267 |
HBufC* iDefaultStatusText;
|
|
268 |
|
|
269 |
/**
|
|
270 |
* Ref, Not owned. Status provider for updating the status and icon.
|
|
271 |
*/
|
|
272 |
CSpbContentProvider& iContentProvider;
|
|
273 |
|
|
274 |
/**
|
|
275 |
* Observes clikcs to statustext
|
|
276 |
*/
|
|
277 |
MCCAStatusControlObserver& iObserver;
|
|
278 |
|
|
279 |
/// Own.
|
|
280 |
MVPbkContactLink* iLink;
|
|
281 |
|
|
282 |
// Own.
|
|
283 |
CGulIcon* iDefaultIcon;
|
|
284 |
|
|
285 |
/**
|
|
286 |
* Own. Button background graphics context (button effect)
|
|
287 |
*/
|
|
288 |
CAknsFrameBackgroundControlContext* iBgContext;
|
|
289 |
|
|
290 |
/**
|
|
291 |
* Flag for pressed down state
|
|
292 |
*/
|
|
293 |
TBool iPressed;
|
|
294 |
|
|
295 |
/**
|
|
296 |
* Not own (singleton). Tactile feedback interface
|
|
297 |
*/
|
|
298 |
MTouchFeedback* iTouchFeedBack;
|
|
299 |
|
|
300 |
/*
|
|
301 |
* Current control state.
|
|
302 |
*/
|
|
303 |
TStatusControlState iState;
|
|
304 |
|
|
305 |
// Own. ECOM plugin tatus provider
|
|
306 |
MCCAStatusProvider* iCCAStatusProvider;
|
|
307 |
|
|
308 |
// Current contact type.
|
|
309 |
CCCAppStatusControl::TContactType iContactType;
|
|
310 |
};
|
|
311 |
|
|
312 |
#endif // CCAPPSTATUSCONTROL_H_
|