|
1 /* |
|
2 * Copyright (c) 2002-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: This class implements MMMADisplay |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMMADISPLAY_H |
|
20 #define CMMADISPLAY_H |
|
21 |
|
22 // INCLUDES |
|
23 //#include <reflcdui.h> |
|
24 #include "mmmadisplay.h" |
|
25 #include "mmafunctionserver.h" |
|
26 #include "qwidget.h" |
|
27 #include "jni.h" |
|
28 #include "jutils.h" |
|
29 #include "mmmaguiplayer.h" |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class MMMADisplayWindow; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 /** |
|
36 * This class implements MMMADisplay |
|
37 * |
|
38 * |
|
39 */ |
|
40 |
|
41 NONSHARABLE_CLASS(CMMADisplay): public CBase,public MMMADisplay |
|
42 /*, |
|
43 public MDirectContent*/ |
|
44 { |
|
45 public: |
|
46 // Constructors and destructors |
|
47 ~CMMADisplay(); // Destructor () |
|
48 |
|
49 protected: // Constructors and destructors |
|
50 // Default constructor, protected to allow derivation |
|
51 CMMADisplay(); |
|
52 |
|
53 void Construct(MMAFunctionServer* eventSource ,JNIEnv* aJni, jobject javadisplayref); |
|
54 |
|
55 public: // Methods derived from MMMADisplay |
|
56 void DrawFrameL(const CFbsBitmap* aBitmap); |
|
57 TSize DisplaySize(); |
|
58 void SetDisplaySizeL(const TSize& aSize); |
|
59 void SetVisible(TBool aValue); |
|
60 void SetWindowL(MMMADisplayWindow* aWindow); |
|
61 MMMADisplayWindow* Window(); |
|
62 TBool IsVisible(); |
|
63 TBool IsFullScreen(); |
|
64 virtual void SetForeground(TBool aIsForeground, TBool aUseEventServer); |
|
65 void SourceSizeChanged(const TSize& aSourceSize); |
|
66 void SetUIPlayer(MMMAGuiPlayer* player); |
|
67 TSize SourceSize(); |
|
68 virtual void SourceSizeChanged(TInt aJavaControlWidth, TInt aJavaControlHeight,TInt x,TInt y, TRect aBoundsRect) = 0; |
|
69 TBool iseSWT(); |
|
70 void SetFullscreenSize(TSize& aSize); |
|
71 /** |
|
72 * Gets notification that there is container to draw assigned |
|
73 * |
|
74 * @return ETrue if container have been set |
|
75 * EFalse if container is not set |
|
76 */ |
|
77 virtual TBool HasContainer(); |
|
78 |
|
79 /** |
|
80 * Gets resources necessary to start DirectScreenAccess |
|
81 * Doesn't run in mmapi event server thread! |
|
82 * |
|
83 * @since S60 v5.0 |
|
84 * @param "aConsumer" A consumer of callback |
|
85 * @param "aThreadType" Indicates the thread type (UI or MMAPI) |
|
86 */ |
|
87 // void UIGetDSAResources( |
|
88 // MUiEventConsumer& aConsumer, |
|
89 // MMMADisplay::TThreadType aThreadType); |
|
90 |
|
91 /** |
|
92 * Invokes a callback in UI thread |
|
93 * |
|
94 * @since S60 v5.0 |
|
95 * @param "aConsumer" A consumer of callback |
|
96 * @param "aCallbackId" A number identifying the callback |
|
97 */ |
|
98 //virtual void UIGetCallback( |
|
99 // MUiEventConsumer& aConsumer, |
|
100 // TInt aCallbackId); |
|
101 public: // Methods derived from MDirectContent |
|
102 /** |
|
103 * Not used method. |
|
104 */ |
|
105 // virtual void MdcContainerWindowChangedL(RWindow* aWindow); |
|
106 |
|
107 /** |
|
108 * Same functionality is shared in canvas and item displays. |
|
109 */ |
|
110 // virtual void MdcContainerVisibilityChanged(TBool aVisible); |
|
111 |
|
112 /** |
|
113 * Default implementation, panics in debug build. Must be written in |
|
114 * derived classes if needed. |
|
115 */ |
|
116 // virtual void MdcItemContentRectChanged(const TRect& aContentRect, |
|
117 // const TRect& aScreenRect); |
|
118 |
|
119 /** |
|
120 * Notify content that container is about to be destoryed. |
|
121 */ |
|
122 // virtual void MdcContainerDestroyed(); |
|
123 /** |
|
124 * Notify player's window that any drawing |
|
125 * via direct screen access must be aborted |
|
126 */ |
|
127 // void MdcAbortDSA(); |
|
128 |
|
129 /** |
|
130 * Allow player's window to draw |
|
131 * via direct screen access after MdcAbortDSA |
|
132 */ |
|
133 // void MdcResumeDSA(); |
|
134 |
|
135 protected:// New Methods |
|
136 /** |
|
137 * Scales drawarea to full screen. Aspect ratio of the source size |
|
138 * will be maintained. |
|
139 */ |
|
140 TRect ScaleToFullScreen(const TSize& aFullScreenSize, |
|
141 const TSize& aSourceSize); |
|
142 |
|
143 /** |
|
144 * Set clipping region to LCDUI UI component according |
|
145 * to current window drawrect so that the LCDUI component |
|
146 * does not paint over the area that is occupied by video. |
|
147 * Based on current visibility of video image, this method |
|
148 * either sets or removes the clipping region. |
|
149 * LCDUI component is then redrawn. |
|
150 */ |
|
151 void SetClippingRegion(); |
|
152 /** |
|
153 * MMAPI_UI 3.x req |
|
154 * set content bound to eSWT control |
|
155 */ |
|
156 void SetContentBoundToJavaControl(const TRect& aRect); |
|
157 /** |
|
158 * Remove currently set clip region and refresh canvas |
|
159 */ |
|
160 void RemoveClippingRegion(); |
|
161 |
|
162 /** |
|
163 * MMAPI_UI 3.x req |
|
164 * removes content bound from eSWT control |
|
165 */ |
|
166 void RemoveContentBoundFromJavaControl(const TRect& aRect); |
|
167 /** |
|
168 * Add clip region |
|
169 */ |
|
170 void AddClippingRegion(); |
|
171 /** |
|
172 * MMAPI_UI 3.x req |
|
173 * Redraw the java side eSWT control |
|
174 */ |
|
175 void RefreshJavaControl(); |
|
176 |
|
177 /** |
|
178 * MMAPI_UI 3.x req |
|
179 * Reset the rectangle dimension in eSWT control |
|
180 */ |
|
181 void ResetJavaRectObject(const TRect& aRect); |
|
182 |
|
183 /** |
|
184 * Handling the change in container visibility |
|
185 */ |
|
186 void HandleContainerVisibilityChanged( TBool aVisible ); |
|
187 |
|
188 public: |
|
189 /** |
|
190 * called from java when shell visibility gets change |
|
191 */ |
|
192 void SetContainerVisibility(TBool aValue); |
|
193 /** |
|
194 * called from java to set the window resources |
|
195 */ |
|
196 void SetWindowResources(QWidget* qtWidget); |
|
197 |
|
198 /** |
|
199 * Trigger a function call CalledBackInUiThread() from java in UI thread |
|
200 * arg 'placeholder' is used to identify the function, to be called back from UI Thread |
|
201 */ |
|
202 void GetCallbackInUiThread(TInt placeholder); |
|
203 |
|
204 /** |
|
205 * Called from java in UI thread context |
|
206 * arg 'placeholder' is used to identify the function, to be called back from UI Thread |
|
207 */ |
|
208 void CalledBackInUiThread(TInt placeholder); |
|
209 |
|
210 |
|
211 void SetSourceSizeToDisplay(const TSize& aSourceSize); |
|
212 void SetDisplayPosition(TInt uiControlLocationX,TInt uiControlLocationY,TInt videoControlLocationX,TInt videoControlLocationY); |
|
213 |
|
214 protected: // Data |
|
215 |
|
216 /** |
|
217 * Not owned. |
|
218 * Actual drawing place of the content. |
|
219 */ |
|
220 MMMADisplayWindow* iWindow; |
|
221 |
|
222 /** |
|
223 * Source contents size. |
|
224 */ |
|
225 TSize iSourceSize; |
|
226 |
|
227 /** |
|
228 * Indicates visibility set from from Java. |
|
229 */ |
|
230 TBool iVisible; |
|
231 |
|
232 /** |
|
233 * Screenmode set from Java. |
|
234 */ |
|
235 TBool iFullScreen; |
|
236 |
|
237 /** |
|
238 * Is native container visible. |
|
239 */ |
|
240 TBool iContainerVisible; |
|
241 |
|
242 /** |
|
243 * Draw rect set from java. |
|
244 */ |
|
245 TRect iUserRect; |
|
246 |
|
247 /** |
|
248 * Not owned, obtained from lcdui components. |
|
249 */ |
|
250 //MDirectContainer* iDirectContainer; |
|
251 |
|
252 /** |
|
253 * Clip rectangle currently set to LCDUI. |
|
254 * NOTE: need to be removed at last during destruction phase! |
|
255 */ |
|
256 TRect iClipRect; |
|
257 /** |
|
258 * Is midlet is in foreground ? |
|
259 */ |
|
260 TBool iIsForeground; |
|
261 |
|
262 /** |
|
263 * Indicates that iUserRect has been changed |
|
264 * during container invisibility |
|
265 */ |
|
266 TBool iResetDrawRect; |
|
267 // not owned |
|
268 MMAFunctionServer* iEventSource; |
|
269 JNIEnv* iJni; |
|
270 jobject iJavaDisplayObject; |
|
271 jclass iJavaDisplayClass; |
|
272 TSize iFullScreenSize; |
|
273 MMMAGuiPlayer* iUiPlayer; |
|
274 TBool iIseSWT; |
|
275 jmethodID setRectID; |
|
276 jfieldID iRectDimensionField; |
|
277 jfieldID iDisplayboundarrField; |
|
278 jmethodID setContentBoundID; |
|
279 jmethodID removeContentBoundID; |
|
280 jmethodID redrawControlID; |
|
281 jmethodID getCallBackMethodID; |
|
282 jobject iJavadisplayref; |
|
283 jmethodID getBoundRectID; |
|
284 }; |
|
285 |
|
286 #endif // CMMADISPLAY_H |