|
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 |
|
26 // CONSTANTS |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class MMMADisplayWindow; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 /** |
|
33 * This class implements MMMADisplay |
|
34 * |
|
35 * |
|
36 */ |
|
37 |
|
38 NONSHARABLE_CLASS(CMMADisplay): public CBase, |
|
39 public MMMADisplay, |
|
40 public MDirectContent |
|
41 { |
|
42 public: |
|
43 // Constructors and destructors |
|
44 ~CMMADisplay(); // Destructor () |
|
45 |
|
46 protected: // Constructors and destructors |
|
47 // Default constructor, protected to allow derivation |
|
48 CMMADisplay(); |
|
49 |
|
50 void Construct(MDirectContainer* aDirectContainer); |
|
51 |
|
52 public: // Methods derived from MMMADisplay |
|
53 void DrawFrameL(const CFbsBitmap* aBitmap); |
|
54 TSize DisplaySize(); |
|
55 void SetDisplaySizeL(const TSize& aSize); |
|
56 void SetVisible(TBool aValue); |
|
57 void SetWindowL(MMMADisplayWindow* aWindow); |
|
58 MMMADisplayWindow* Window(); |
|
59 TBool IsVisible(); |
|
60 TBool IsFullScreen(); |
|
61 virtual void SetForeground(TBool aIsForeground, TBool UseEventServer); |
|
62 |
|
63 /** |
|
64 * Gets notification that there is container to draw assigned |
|
65 * |
|
66 * @return ETrue if container have been set |
|
67 * EFalse if container is not set |
|
68 */ |
|
69 virtual TBool HasContainer(); |
|
70 |
|
71 /** |
|
72 * Gets resources necessary to start DirectScreenAccess |
|
73 * Doesn't run in mmapi event server thread! |
|
74 * |
|
75 * @since S60 v5.0 |
|
76 * @param "aConsumer" A consumer of callback |
|
77 * @param "aThreadType" Indicates the thread type (UI or MMAPI) |
|
78 */ |
|
79 void UIGetDSAResources( |
|
80 MUiEventConsumer& aConsumer, |
|
81 MMMADisplay::TThreadType aThreadType); |
|
82 |
|
83 /** |
|
84 * Invokes a callback in UI thread |
|
85 * |
|
86 * @since S60 v5.0 |
|
87 * @param "aConsumer" A consumer of callback |
|
88 * @param "aCallbackId" A number identifying the callback |
|
89 */ |
|
90 virtual void UIGetCallback( |
|
91 MUiEventConsumer& aConsumer, |
|
92 TInt aCallbackId); |
|
93 public: // Methods derived from MDirectContent |
|
94 /** |
|
95 * Used to obtain RWindow rect |
|
96 */ |
|
97 virtual void MdcContainerWindowRectChanged(const TRect& aRect); |
|
98 |
|
99 /** |
|
100 * Same functionality is shared in canvas and item displays. |
|
101 */ |
|
102 virtual void MdcContainerVisibilityChanged(TBool aVisible); |
|
103 |
|
104 /** |
|
105 * Default implementation, panics in debug build. Must be written in |
|
106 * derived classes if needed. |
|
107 */ |
|
108 virtual void MdcItemContentRectChanged(const TRect& aContentRect, |
|
109 const TRect& aScreenRect); |
|
110 |
|
111 /** |
|
112 * Notify content that container is about to be destoryed. |
|
113 */ |
|
114 virtual void MdcContainerDestroyed(); |
|
115 /** |
|
116 * Notify player's window that any drawing |
|
117 * via direct screen access must be aborted |
|
118 */ |
|
119 void MdcAbortDSA(); |
|
120 |
|
121 /** |
|
122 * Allow player's window to draw |
|
123 * via direct screen access after MdcAbortDSA |
|
124 */ |
|
125 void MdcResumeDSA(); |
|
126 |
|
127 protected:// New Methods |
|
128 /** |
|
129 * Scales drawarea to full screen. Aspect ratio of the source size |
|
130 * will be maintained. |
|
131 */ |
|
132 TRect ScaleToFullScreen(const TSize& aFullScreenSize, |
|
133 const TSize& aSourceSize); |
|
134 |
|
135 /** |
|
136 * Set clipping region to LCDUI UI component according |
|
137 * to current window drawrect so that the LCDUI component |
|
138 * does not paint over the area that is occupied by video. |
|
139 * Based on current visibility of video image, this method |
|
140 * either sets or removes the clipping region. |
|
141 * LCDUI component is then redrawn. |
|
142 */ |
|
143 void SetClippingRegion(); |
|
144 |
|
145 /** |
|
146 * Remove currently set clip region and refresh canvas |
|
147 */ |
|
148 void RemoveClippingRegion(); |
|
149 |
|
150 /** |
|
151 * Add clip region |
|
152 */ |
|
153 void AddClippingRegion(); |
|
154 |
|
155 protected: // Data |
|
156 |
|
157 /** |
|
158 * Not owned. |
|
159 * Actual drawing place of the content. |
|
160 */ |
|
161 MMMADisplayWindow* iWindow; |
|
162 |
|
163 /** |
|
164 * Source contents size. |
|
165 */ |
|
166 TSize iSourceSize; |
|
167 |
|
168 /** |
|
169 * Indicates visibility set from from Java. |
|
170 */ |
|
171 TBool iVisible; |
|
172 |
|
173 /** |
|
174 * Screenmode set from Java. |
|
175 */ |
|
176 TBool iFullScreen; |
|
177 |
|
178 /** |
|
179 * Is native container visible. |
|
180 */ |
|
181 TBool iContainerVisible; |
|
182 |
|
183 /** |
|
184 * Draw rect set from java. |
|
185 */ |
|
186 TRect iUserRect; |
|
187 |
|
188 /** |
|
189 * Not owned, obtained from lcdui components. |
|
190 */ |
|
191 MDirectContainer* iDirectContainer; |
|
192 |
|
193 /** |
|
194 * Clip rectangle currently set to LCDUI. |
|
195 * NOTE: need to be removed at last during destruction phase! |
|
196 */ |
|
197 TRect iClipRect; |
|
198 /** |
|
199 * Is midlet is in foreground ? |
|
200 */ |
|
201 TBool iIsForeground; |
|
202 |
|
203 /** |
|
204 * Indicates that iUserRect has been changed |
|
205 * during container invisibility |
|
206 */ |
|
207 TBool iResetDrawRect; |
|
208 }; |
|
209 |
|
210 #endif // CMMADISPLAY_H |