|
1 /* |
|
2 * Copyright (c) 2006 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: Implementation of media key handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_CMPXNOTIFIERDIALOG_H |
|
21 #define C_CMPXNOTIFIERDIALOG_H |
|
22 |
|
23 |
|
24 // INCLUDES |
|
25 #include <coecntrl.h> |
|
26 #include <mpxpskeyobserver.h> // MMPXPSKeyObserver |
|
27 #include <mpxmediakeyhandlerdefs.h> |
|
28 |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class MAknsSkinInstance; |
|
32 class TAknsItemID; |
|
33 class CEikLabel; |
|
34 class CEikImage; |
|
35 class CMPXPSKeyWatcher; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * Music Player playback info popup. |
|
41 * |
|
42 * @lib mpxmediakeyhandler.lib |
|
43 * @since S60 v3.0 |
|
44 */ |
|
45 NONSHARABLE_CLASS( CMPXNotifierDialog ) : public CCoeControl, |
|
46 public MMPXPSKeyObserver |
|
47 { |
|
48 public: |
|
49 |
|
50 enum TMPXPlaybackPopupIcons |
|
51 { |
|
52 EMPXPopupNoneIcon = 0, |
|
53 EMPXPopupPlayIcon, |
|
54 EMPXPopupPauseIcon, |
|
55 EMPXPopupFFIcon, |
|
56 EMPXPopupFRIcon |
|
57 }; |
|
58 |
|
59 enum TMPXPlaybackPopupComponents |
|
60 { |
|
61 EMPXPlayIcon = 0, |
|
62 EMPXPauseIcon, |
|
63 EMPXFFIcon, |
|
64 EMPXFRIcon, |
|
65 EMPXTrackLabel, |
|
66 EMPXTimeLabel, |
|
67 EMPXComponentsCount |
|
68 }; |
|
69 |
|
70 /** |
|
71 * Two-phased constructor. |
|
72 * |
|
73 * @since 3.0 |
|
74 * @return Pointer to newly created object. |
|
75 */ |
|
76 static CMPXNotifierDialog* NewL(); |
|
77 |
|
78 /** |
|
79 * Destructor. |
|
80 */ |
|
81 virtual ~CMPXNotifierDialog(); |
|
82 |
|
83 /** |
|
84 * Shows pop-up dialog. |
|
85 * |
|
86 * @since 3.0 |
|
87 * @param aIcon used icon |
|
88 * @param aTitle song tittle |
|
89 * @param aTime playback time in seconds |
|
90 * @param aMode Mode to determine the popup's behaviour |
|
91 */ |
|
92 void ShowInfoPopupL( |
|
93 TMPXPlaybackPopupIcons aIcon, |
|
94 const TDesC& aTitle, |
|
95 TInt aTime, |
|
96 TMPXPlaybackPopupModes aMode ); |
|
97 |
|
98 /** |
|
99 * Removes pop-up from screen. |
|
100 * |
|
101 * @since 3.0 |
|
102 */ |
|
103 void CancelInfoPopup(); |
|
104 |
|
105 /** |
|
106 * Gets called when orientation change begins |
|
107 */ |
|
108 void NotifyOrientationChangeBegin(); |
|
109 |
|
110 private: |
|
111 |
|
112 /** |
|
113 * C++ default constructor. |
|
114 */ |
|
115 CMPXNotifierDialog(); |
|
116 |
|
117 /** |
|
118 * By default Symbian 2nd phase constructor is private. |
|
119 */ |
|
120 void ConstructL(); |
|
121 |
|
122 /** |
|
123 * Updates pop-up dialog contents. |
|
124 * |
|
125 * @param aIcon used icon |
|
126 * @param aTitle song tittle |
|
127 * @param aTime playback time in seconds |
|
128 */ |
|
129 void UpdateInfoPopupL( |
|
130 TMPXPlaybackPopupIcons aIcon, |
|
131 const TDesC& aTitle, |
|
132 TInt aTime ); |
|
133 |
|
134 /** |
|
135 * Create icons. |
|
136 */ |
|
137 void CreateIconsL(); |
|
138 |
|
139 /** |
|
140 * Constructs skinnable icon. |
|
141 * |
|
142 * @param aImage Pointer to the skinnable icon on return. |
|
143 * @param aSkin Pointer to the current skin instance. |
|
144 * @param aId Item ID of the masked bitmap to be created. |
|
145 * @param aColorId Item ID of the color table. |
|
146 * @param aColorIndex Index in the color table. |
|
147 * @param aBitmapId mbm id of the bitmap |
|
148 * @param aMaskId mbm id of the mask |
|
149 */ |
|
150 void ConstructImageL( |
|
151 CEikImage* aImage, |
|
152 MAknsSkinInstance* aSkin, |
|
153 const TAknsItemID& aId, |
|
154 const TAknsItemID& aColorId, |
|
155 TInt aColorIndex, |
|
156 TInt aBitmapId, |
|
157 TInt aMaskId ); |
|
158 |
|
159 /** |
|
160 * Resize info popup. |
|
161 */ |
|
162 void ResizeInfoPopup(); |
|
163 |
|
164 /** |
|
165 * Sets pop-up layouts. |
|
166 */ |
|
167 void SetLayoutsL( TBool aLong = EFalse ); |
|
168 |
|
169 /** |
|
170 * Show playback icon. |
|
171 * |
|
172 * @param aIcon Icon to be displayed. |
|
173 * @return ETrue if it's ok to displayed. Otherwise, EFalse. |
|
174 */ |
|
175 void ShowIcon( |
|
176 TMPXPlaybackPopupIcons aIcon ); |
|
177 |
|
178 /** |
|
179 * Callback for timer |
|
180 * |
|
181 * @param aPtr Pointer pass to this callback function. |
|
182 * @return Zero if callback function doesn't need to be called again. |
|
183 * Otherwise, non-zero. |
|
184 */ |
|
185 static TInt TimerCallback( TAny* aPtr ); |
|
186 |
|
187 /** |
|
188 * Convert to displayable duration |
|
189 * |
|
190 * @since S60 v3.0 |
|
191 * @param aduration Duration in seconds |
|
192 * @return A heap descriptor that contains displayable duration |
|
193 * (ownership transferred). Caller must destroy this object |
|
194 * after use. |
|
195 */ |
|
196 HBufC* DisplayableDurationL( |
|
197 TInt aDuration ); |
|
198 |
|
199 // from base class CoeControl |
|
200 |
|
201 /** |
|
202 * From CCoeControl. |
|
203 * Draws the control. |
|
204 * |
|
205 * @param aRect The rectangular region of the control to be drawn. |
|
206 */ |
|
207 void Draw( const TRect& aRect ) const; |
|
208 |
|
209 /** |
|
210 * From CoeControl. |
|
211 * Handles a change to the control's resources. |
|
212 * |
|
213 * @param aType A message UID value. |
|
214 */ |
|
215 void HandleResourceChange( TInt aType ); |
|
216 |
|
217 /** |
|
218 * From CCoeControl. |
|
219 * Responds to changes to the size and position of the contents of this |
|
220 * control. |
|
221 */ |
|
222 void SizeChanged(); |
|
223 |
|
224 /** |
|
225 * From CCoeControl. |
|
226 * Gets the number of controls contained in a compound control. |
|
227 * |
|
228 * @return The number of component controls contained by this control. |
|
229 */ |
|
230 TInt CountComponentControls() const; |
|
231 |
|
232 /** |
|
233 * From CCoeControl. |
|
234 * Gets an indexed component of a compound control. |
|
235 * |
|
236 * @param aIndex The index of the control. |
|
237 * @return The component control with an index of aIndex. |
|
238 */ |
|
239 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
240 protected: // from MMPXPSKeyObserver |
|
241 |
|
242 /** |
|
243 * From MMPXPSKeyObserver |
|
244 * Handle PS event |
|
245 * |
|
246 * @param aUid The UID that identifies the property category |
|
247 * @param aKey The property sub-key |
|
248 */ |
|
249 void HandlePSEvent( TUid aUid, TInt aKey ); |
|
250 |
|
251 |
|
252 private: // Data |
|
253 |
|
254 CEikLabel* iSongLabel; // own |
|
255 CEikLabel* iTimeLabel; // own |
|
256 CEikImage* iPlayIcon; // own |
|
257 CEikImage* iPauseIcon; // own |
|
258 CEikImage* iFFIcon; // own |
|
259 CEikImage* iFRIcon; // own |
|
260 CPeriodic* iTimer; // own |
|
261 RWindowGroup iWindowGroup; // own |
|
262 CMPXPSKeyWatcher* iPSKeyWatcher; // own |
|
263 |
|
264 TMPXPlaybackPopupIcons iIconShown; |
|
265 |
|
266 TBool iReopenDialog; |
|
267 }; |
|
268 |
|
269 #endif // C_CMPXNOTIFIERDIALOG_H |
|
270 |
|
271 // End of File |