|
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: Abstract base class for windows. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MMMADISPLAYWINDOW_H |
|
20 #define MMMADISPLAYWINDOW_H |
|
21 |
|
22 |
|
23 #include "mmmadisplay.h" |
|
24 // FORWARD DECLARATIONS |
|
25 class CFbsBitmap; |
|
26 |
|
27 // CLASS DEFINITION |
|
28 /* |
|
29 ----------------------------------------------------------------------------- |
|
30 |
|
31 DESCRIPTION |
|
32 |
|
33 Abstract base class for windows. |
|
34 |
|
35 ----------------------------------------------------------------------------- |
|
36 */ |
|
37 NONSHARABLE_CLASS(MMMADisplayWindow) |
|
38 { |
|
39 public: |
|
40 |
|
41 enum TDisplayWindowType |
|
42 { |
|
43 EDisplayWindowTypeNotSet = -1, |
|
44 EDisplayWindowTypeIsDSA, |
|
45 EDisplayWindowTypeIsBitmap, |
|
46 EDisplayWindowTypeIsCamera, |
|
47 }; |
|
48 |
|
49 /** |
|
50 * Can be deleted through this interface. |
|
51 */ |
|
52 virtual ~MMMADisplayWindow() |
|
53 { |
|
54 }; |
|
55 |
|
56 /** |
|
57 * Sets destination bitmap for <code>DrawFrameL</code> method |
|
58 * |
|
59 * @param aBitmap destination Bitmap where DrawFrameL draws. |
|
60 */ |
|
61 virtual void SetDestinationBitmapL(CFbsBitmap* aBitmap) = 0; |
|
62 |
|
63 /** |
|
64 * Draws bitmap to the rect set with <code>SetDrawRectL</code> |
|
65 * method. Bitmap may be scaled to fill whole rect. Implementation |
|
66 * may ignore <code>aBitmap</code> parameter and implements own |
|
67 * drawing procedure. |
|
68 * |
|
69 * @param aBitmap Bitmap to be drawn. |
|
70 */ |
|
71 virtual void DrawFrameL(const CFbsBitmap* aBitmap) = 0; |
|
72 |
|
73 /** |
|
74 * Sets drawing area which is used in <code>DrawFrameL</code> method. |
|
75 * |
|
76 * THE CALL CANNOT ORIGINATE FROM UI THREAD. |
|
77 * (including the call via MMA event server) |
|
78 * |
|
79 * use SetDrawRectThread when in UI thread |
|
80 * |
|
81 * @param aRect New drawing area. |
|
82 */ |
|
83 virtual void SetDrawRect(const TRect& aRect) = 0; |
|
84 |
|
85 /** |
|
86 * Calls SetDrawRect method through event source. This method must |
|
87 * be called instead of SetDrawRect if not executing in MMA |
|
88 * thread. |
|
89 * |
|
90 * THE CALL CANNOT ORIGINATE FROM MMA THREAD. |
|
91 * (including the call via UI event server) |
|
92 * |
|
93 * @param aRect New drawing area. |
|
94 */ |
|
95 virtual void SetDrawRectThread(const TRect& aRect) = 0; |
|
96 |
|
97 /** |
|
98 * Sets drawing position which is used in <code>DrawFrameL</code> method. |
|
99 * |
|
100 * @param aPosition New drawing position. |
|
101 */ |
|
102 virtual void SetPosition(const TPoint& aPosition) = 0; |
|
103 |
|
104 /** |
|
105 * Sets window visible or invisible. This method can be called from |
|
106 * MMA event server thread or from other context. aUseEventServer |
|
107 * must be set to EFalse if caller is already in MMA event server. |
|
108 * |
|
109 * @param aVisible visiblity |
|
110 * @param aUseEventServer Indicates if method must called through event |
|
111 * server. |
|
112 */ |
|
113 virtual void SetVisible(TBool aVisible, TBool aUseEventServer = ETrue) = 0; |
|
114 |
|
115 /** |
|
116 * Returns rect which is used for drawing frames. |
|
117 * |
|
118 * @return Drawing area |
|
119 */ |
|
120 virtual const TRect& DrawRect() = 0; |
|
121 |
|
122 /** |
|
123 * Returns whole window's size. |
|
124 * |
|
125 * @return Size of the window. |
|
126 */ |
|
127 virtual TSize WindowSize() = 0; |
|
128 |
|
129 /** |
|
130 * Sets window size. |
|
131 * |
|
132 * @param aRect Windows size. |
|
133 */ |
|
134 virtual void SetWindowRect(const TRect& aRect, MMMADisplay::TThreadType aThreadType) = 0; |
|
135 |
|
136 /** |
|
137 * Gets window rect. |
|
138 * |
|
139 * @returns Windows rect. |
|
140 */ |
|
141 virtual const TRect& WindowRect() = 0; |
|
142 |
|
143 #ifdef RD_JAVA_NGA_ENABLED |
|
144 /** |
|
145 * Sets Crop region. used only in CMMASurfaceWindow |
|
146 * |
|
147 * @since S60 v5.2 |
|
148 */ |
|
149 virtual void SetVideoCropRegion(const TRect& /*aRect*/) |
|
150 { |
|
151 // Empty |
|
152 } |
|
153 |
|
154 /** |
|
155 * Sets RWindow rect. used only in CMMASurfaceWindow. |
|
156 * can be called from either MMA ES thread context or |
|
157 * UI thread context. |
|
158 * |
|
159 * @since S60 v5.2 |
|
160 */ |
|
161 virtual void SetRWindowRect(const TRect& /*aRect*/, |
|
162 MMMADisplay::TThreadType /*aThreadType*/) |
|
163 { |
|
164 // Empty |
|
165 } |
|
166 #endif |
|
167 |
|
168 /** |
|
169 * |
|
170 */ |
|
171 virtual TDisplayWindowType GetDisplayWindowType() const |
|
172 { |
|
173 return EDisplayWindowTypeNotSet; |
|
174 } |
|
175 |
|
176 /** |
|
177 * Gets window visible or invisible. |
|
178 * @retrun ETrue if visible else EFalse. Default implementation always returns ETrue |
|
179 */ |
|
180 virtual TBool IsVisible() const |
|
181 { |
|
182 return ETrue; |
|
183 } |
|
184 |
|
185 /** |
|
186 * Informs window that container which is window drawn on |
|
187 * is set from now. Implementation is now able to invoke |
|
188 * any UI callbacks |
|
189 * |
|
190 * @since S60 v5.0 |
|
191 */ |
|
192 virtual void ContainerSet() |
|
193 { |
|
194 // Empty |
|
195 } |
|
196 |
|
197 /** |
|
198 * Informs window that container which is window drawn on |
|
199 * is going to be deleted. Implementation should abort any |
|
200 * DirectScreenAccess and delete all the objects |
|
201 * instantiated within UI thread. |
|
202 * Called wihout mmapi event server directly from UI thread. |
|
203 * By default it doesn't do anything. |
|
204 * |
|
205 * @since S60 v5.0 |
|
206 */ |
|
207 virtual void ContainerDestroyed() |
|
208 { |
|
209 // Empty |
|
210 } |
|
211 |
|
212 /** |
|
213 * Notifies window that any drawing |
|
214 * via direct screen access must be aborted |
|
215 */ |
|
216 virtual void AbortDSA() |
|
217 { |
|
218 // default empty implementation |
|
219 } |
|
220 |
|
221 /** |
|
222 * Allows window to draw |
|
223 * via direct screen access after MdcAbortDSA |
|
224 */ |
|
225 virtual void ResumeDSA() |
|
226 { |
|
227 // default empty implementation |
|
228 } |
|
229 }; |
|
230 |
|
231 #endif // MMMADISPLAYWINDOW_H |