|
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: MPX Screen Saver Plugin implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CMPXSCREENSAVERPLUGIN_H |
|
20 #define C_CMPXSCREENSAVERPLUGIN_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <ScreensaverpluginIntDef.h> |
|
24 #include <screensaverplugin.h> |
|
25 #include <mpxplaybackobserver.h> |
|
26 |
|
27 // CLASS DECLARATION |
|
28 class CEikonEnv; |
|
29 class MMPXPlaybackUtility; |
|
30 class MAknsSkinInstance; |
|
31 class TAknsItemID; |
|
32 class CMPXScreenSaverPluginContainer; |
|
33 class MProfileEngine; |
|
34 class MProfile; |
|
35 |
|
36 /** |
|
37 * Screen saver plugin for music player now playing view |
|
38 * @lib mpxscreensaverplugin.lib |
|
39 * @since 3.0 |
|
40 */ |
|
41 |
|
42 class CMPXScreenSaverPlugin: public CScreensaverPluginInterfaceDefinition, |
|
43 public MMPXPlaybackObserver, |
|
44 public MMPXPlaybackCallback |
|
45 { |
|
46 public: |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 * @since 3.1 |
|
51 */ |
|
52 static CMPXScreenSaverPlugin* NewL(); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CMPXScreenSaverPlugin(); |
|
58 |
|
59 public: // Functions From CScreensaverPluginInterfaceDefinition |
|
60 |
|
61 /** |
|
62 * From MScreensaverPlugin, Method called by ScreenSaver Application |
|
63 * when an animation file is configured as a Screen Saver. |
|
64 * @param aHost Screen saver plugin host. |
|
65 * @since 3.1 |
|
66 */ |
|
67 virtual TInt InitializeL( MScreensaverPluginHost *aHost ); |
|
68 |
|
69 /** |
|
70 * From MScreensaverPlugin, Method called by ScreenSaver Application |
|
71 * when Screen Saver is activated. |
|
72 * @since 3.1 |
|
73 */ |
|
74 virtual TInt Draw( CWindowGc& aGc ); |
|
75 |
|
76 /** |
|
77 * From MScreensaverPlugin, Method called by ScreenSaver Application |
|
78 * before the InitializeL. |
|
79 * @since 3.1 |
|
80 */ |
|
81 virtual const TDesC16& Name() const; |
|
82 |
|
83 /** |
|
84 * From MScreensaverPlugin, Method called by ScreenSaver Application |
|
85 * to get the capabilities of Screensaver plugin. |
|
86 * @since 3.1 |
|
87 */ |
|
88 virtual TInt Capabilities(); |
|
89 |
|
90 /** |
|
91 * From MScreensaverPlugin, Method called by Psln Application |
|
92 * when the user selects Animated ScreenSaver |
|
93 * @since 3.1 |
|
94 */ |
|
95 virtual TInt PluginFunction( |
|
96 TScPluginCaps /*aFunction*/, |
|
97 TAny* /*aParam*/ ); |
|
98 |
|
99 /** |
|
100 * From MScreensaverPlugin, Method called by ScreenSaver Application |
|
101 * when there are Screen Saver events. |
|
102 * @since 3.1 |
|
103 */ |
|
104 virtual TInt HandleScreensaverEventL( |
|
105 TScreensaverEvent aEvent, |
|
106 TAny* aData ); |
|
107 |
|
108 private: |
|
109 |
|
110 /** |
|
111 * Default Constructor |
|
112 * @since 3.1 |
|
113 */ |
|
114 CMPXScreenSaverPlugin(); |
|
115 |
|
116 /** |
|
117 * 2nd phase constructor |
|
118 * @since 3.1 |
|
119 */ |
|
120 void ConstructL(); |
|
121 |
|
122 // from base class MMPXPlaybackObserver |
|
123 |
|
124 /** |
|
125 * From MMPXPlaybackObserver |
|
126 * Handle playback message |
|
127 * |
|
128 * @param aMessage playback message |
|
129 * @param aErr system error code. |
|
130 */ |
|
131 void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError ); |
|
132 |
|
133 // from base class MMPXPlaybackCallback |
|
134 |
|
135 /** |
|
136 * From MMPXPlaybackCallback |
|
137 * Handle playback property |
|
138 * |
|
139 * @param aProperty the property |
|
140 * @param aValue the value of the property |
|
141 * @param aError error code |
|
142 */ |
|
143 void HandlePropertyL( |
|
144 TMPXPlaybackProperty aProperty, |
|
145 TInt aValue, |
|
146 TInt aError ); |
|
147 |
|
148 /** |
|
149 * From MMPXPlaybackCallback |
|
150 * Method is called continously until aComplete=ETrue, signifying that |
|
151 * it is done and there will be no more callbacks |
|
152 * Only new items are passed each time |
|
153 * |
|
154 * @param aPlayer UID of the subplayer |
|
155 * @param aSubPlayers a list of sub players |
|
156 * @param aComplete ETrue no more sub players. EFalse more subplayer |
|
157 * expected |
|
158 * @param aError error code |
|
159 */ |
|
160 void HandleSubPlayerNamesL( |
|
161 TUid aPlayer, |
|
162 const MDesCArray* aSubPlayers, |
|
163 TBool aComplete, |
|
164 TInt aError ); |
|
165 |
|
166 /** |
|
167 * From MMPXPlaybackCallback |
|
168 * Handle extended media properties |
|
169 * |
|
170 * @param aMedia media |
|
171 * @param aError error code |
|
172 */ |
|
173 void HandleMediaL( |
|
174 const CMPXMedia& aMedia, |
|
175 TInt aError ); |
|
176 |
|
177 /** |
|
178 * Handle playback message |
|
179 * |
|
180 * @param aMessage playback message |
|
181 */ |
|
182 void DoHandlePlaybackMessageL( |
|
183 const CMPXMessage& aMessage ); |
|
184 |
|
185 /** |
|
186 * Handle media properties. |
|
187 * |
|
188 * @param aProperties media properties |
|
189 * @param aError error code |
|
190 */ |
|
191 void DoHandleMediaL( |
|
192 const CMPXMedia& aMedia, |
|
193 TInt aError ); |
|
194 |
|
195 /** |
|
196 * Handle playback state changed. |
|
197 * |
|
198 * @param aState New Playback state |
|
199 */ |
|
200 void DoHandleStateChangedL( |
|
201 TMPXPlaybackState aState ); |
|
202 |
|
203 /** |
|
204 * Creates the container |
|
205 */ |
|
206 void CreateContainerL(); |
|
207 |
|
208 private: |
|
209 // Pointer to the screen saver host |
|
210 MScreensaverPluginHost* iScreenSaverHost; |
|
211 |
|
212 CEikonEnv* iEikEnv; |
|
213 MMPXPlaybackUtility* iPlaybackUtility; // not own |
|
214 CMPXScreenSaverPluginContainer* iContainer; |
|
215 MProfileEngine* iProfileEngine; // not own |
|
216 |
|
217 TMPXPlaybackState iPlaybackState; |
|
218 TInt iResourceOffset; |
|
219 TBool iTimerChanged; |
|
220 |
|
221 HBufC* iDisplayName; |
|
222 }; |
|
223 |
|
224 #endif // C_CMPXSCREENSAVERPLUGIN_H |
|
225 |