|
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 ,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 |
|
69 /** |
|
70 * Gets notification that there is container to draw assigned |
|
71 * |
|
72 * @return ETrue if container have been set |
|
73 * EFalse if container is not set |
|
74 */ |
|
75 virtual TBool HasContainer(); |
|
76 |
|
77 /** |
|
78 * Gets resources necessary to start DirectScreenAccess |
|
79 * Doesn't run in mmapi event server thread! |
|
80 * |
|
81 * @since S60 v5.0 |
|
82 * @param "aConsumer" A consumer of callback |
|
83 * @param "aThreadType" Indicates the thread type (UI or MMAPI) |
|
84 */ |
|
85 // void UIGetDSAResources( |
|
86 // MUiEventConsumer& aConsumer, |
|
87 // MMMADisplay::TThreadType aThreadType); |
|
88 |
|
89 /** |
|
90 * Invokes a callback in UI thread |
|
91 * |
|
92 * @since S60 v5.0 |
|
93 * @param "aConsumer" A consumer of callback |
|
94 * @param "aCallbackId" A number identifying the callback |
|
95 */ |
|
96 //virtual void UIGetCallback( |
|
97 // MUiEventConsumer& aConsumer, |
|
98 // TInt aCallbackId); |
|
99 public: // Methods derived from MDirectContent |
|
100 /** |
|
101 * Not used method. |
|
102 */ |
|
103 // virtual void MdcContainerWindowChangedL(RWindow* aWindow); |
|
104 |
|
105 /** |
|
106 * Same functionality is shared in canvas and item displays. |
|
107 */ |
|
108 // virtual void MdcContainerVisibilityChanged(TBool aVisible); |
|
109 |
|
110 /** |
|
111 * Default implementation, panics in debug build. Must be written in |
|
112 * derived classes if needed. |
|
113 */ |
|
114 // virtual void MdcItemContentRectChanged(const TRect& aContentRect, |
|
115 // const TRect& aScreenRect); |
|
116 |
|
117 /** |
|
118 * Notify content that container is about to be destoryed. |
|
119 */ |
|
120 // virtual void MdcContainerDestroyed(); |
|
121 /** |
|
122 * Notify player's window that any drawing |
|
123 * via direct screen access must be aborted |
|
124 */ |
|
125 // void MdcAbortDSA(); |
|
126 |
|
127 /** |
|
128 * Allow player's window to draw |
|
129 * via direct screen access after MdcAbortDSA |
|
130 */ |
|
131 // void MdcResumeDSA(); |
|
132 |
|
133 protected:// New Methods |
|
134 /** |
|
135 * Scales drawarea to full screen. Aspect ratio of the source size |
|
136 * will be maintained. |
|
137 */ |
|
138 TRect ScaleToFullScreen(const TSize& aFullScreenSize, |
|
139 const TSize& aSourceSize); |
|
140 |
|
141 /** |
|
142 * Set clipping region to LCDUI UI component according |
|
143 * to current window drawrect so that the LCDUI component |
|
144 * does not paint over the area that is occupied by video. |
|
145 * Based on current visibility of video image, this method |
|
146 * either sets or removes the clipping region. |
|
147 * LCDUI component is then redrawn. |
|
148 */ |
|
149 void SetClippingRegion(); |
|
150 /** |
|
151 * MMAPI_UI 3.x req |
|
152 * set content bound to eSWT control |
|
153 */ |
|
154 void SetContentBoundToJavaControl(const TRect& aRect); |
|
155 /** |
|
156 * Remove currently set clip region and refresh canvas |
|
157 */ |
|
158 void RemoveClippingRegion(); |
|
159 |
|
160 /** |
|
161 * MMAPI_UI 3.x req |
|
162 * removes content bound from eSWT control |
|
163 */ |
|
164 void RemoveContentBoundFromJavaControl(const TRect& aRect); |
|
165 /** |
|
166 * Add clip region |
|
167 */ |
|
168 void AddClippingRegion(); |
|
169 /** |
|
170 * MMAPI_UI 3.x req |
|
171 * Redraw the java side eSWT control |
|
172 */ |
|
173 void RefreshJavaControl(const TRect& aRect); |
|
174 |
|
175 /** |
|
176 * MMAPI_UI 3.x req |
|
177 * Reset the rectangle dimension in eSWT control |
|
178 */ |
|
179 void ResetJavaRectObject(const TRect& aRect); |
|
180 |
|
181 /** |
|
182 * Handling the change in container visibility |
|
183 */ |
|
184 void HandleContainerVisibilityChanged( TBool aVisible ); |
|
185 |
|
186 public: |
|
187 /** |
|
188 * called from java when shell visibility gets change |
|
189 */ |
|
190 void SetContainerVisibility(TBool aValue); |
|
191 /** |
|
192 * called from java to set the window resources |
|
193 */ |
|
194 void SetWindowResources(QWidget* qtWidget); |
|
195 |
|
196 /** |
|
197 * Trigger a function call CalledBackInUiThread() from java in UI thread |
|
198 * arg 'placeholder' is used to identify the function, to be called back from UI Thread |
|
199 */ |
|
200 void GetCallbackInUiThread(TInt placeholder); |
|
201 |
|
202 /** |
|
203 * Called from java in UI thread context |
|
204 * arg 'placeholder' is used to identify the function, to be called back from UI Thread |
|
205 */ |
|
206 void CalledBackInUiThread(TInt placeholder); |
|
207 |
|
208 void SourceSizeChanged(TInt aJavaControlWidth, TInt aJavaControlHeight); |
|
209 void SetSourceSizeToDisplay(const TSize& aSourceSize); |
|
210 void SetDisplayPosition(TInt uiControlLocationX,TInt uiControlLocationY,TInt videoControlLocationX,TInt videoControlLocationY); |
|
211 |
|
212 protected: // Data |
|
213 |
|
214 /** |
|
215 * Not owned. |
|
216 * Actual drawing place of the content. |
|
217 */ |
|
218 MMMADisplayWindow* iWindow; |
|
219 |
|
220 /** |
|
221 * Source contents size. |
|
222 */ |
|
223 TSize iSourceSize; |
|
224 |
|
225 /** |
|
226 * Indicates visibility set from from Java. |
|
227 */ |
|
228 TBool iVisible; |
|
229 |
|
230 /** |
|
231 * Screenmode set from Java. |
|
232 */ |
|
233 TBool iFullScreen; |
|
234 |
|
235 /** |
|
236 * Is native container visible. |
|
237 */ |
|
238 TBool iContainerVisible; |
|
239 |
|
240 /** |
|
241 * Draw rect set from java. |
|
242 */ |
|
243 TRect iUserRect; |
|
244 |
|
245 /** |
|
246 * Not owned, obtained from lcdui components. |
|
247 */ |
|
248 //MDirectContainer* iDirectContainer; |
|
249 |
|
250 /** |
|
251 * Clip rectangle currently set to LCDUI. |
|
252 * NOTE: need to be removed at last during destruction phase! |
|
253 */ |
|
254 TRect iClipRect; |
|
255 /** |
|
256 * Is midlet is in foreground ? |
|
257 */ |
|
258 TBool iIsForeground; |
|
259 |
|
260 /** |
|
261 * Indicates that iUserRect has been changed |
|
262 * during container invisibility |
|
263 */ |
|
264 TBool iResetDrawRect; |
|
265 // not owned |
|
266 MMAFunctionServer* iEventSource; |
|
267 JNIEnv* iJni; |
|
268 jobject iJavaDisplayObject; |
|
269 jclass iJavaDisplayClass; |
|
270 TSize fullScreenSize; |
|
271 MMMAGuiPlayer* iUiPlayer; |
|
272 }; |
|
273 |
|
274 #endif // CMMADISPLAY_H |