35
|
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: Base class for video control.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef C_VTUIVIDEOCONTROLBASE_H
|
|
20 |
#define C_VTUIVIDEOCONTROLBASE_H
|
|
21 |
|
|
22 |
#include <coecntrl.h>
|
|
23 |
#include <AknUtils.h>
|
|
24 |
#include <babitflags.h>
|
|
25 |
|
|
26 |
#include "MVtUiVideoWindow.h"
|
|
27 |
#include "CVtUiBitmapManager.h"
|
|
28 |
|
|
29 |
// FORWARD DECLARATIONS
|
|
30 |
class CVtUiBitmapManager;
|
|
31 |
class TAknTextLineLayout;
|
|
32 |
class CAknsBasicBackgroundControlContext;
|
|
33 |
/**
|
|
34 |
* CVtUiVideoControlBase
|
|
35 |
*
|
|
36 |
* Video control base class.
|
|
37 |
*
|
|
38 |
* @since S60 v5.0
|
|
39 |
*/
|
|
40 |
class CVtUiVideoControlBase : public CCoeControl, public MVtUiVideoWindow
|
|
41 |
{
|
|
42 |
|
|
43 |
protected: // enumerations
|
|
44 |
|
|
45 |
// Rendering hints
|
|
46 |
enum TRenderingHint
|
|
47 |
{
|
|
48 |
// If this hint is set, then control's background is filled with color
|
|
49 |
// at index 0. This hint is mutually exclusive with ESkinnedBackground.
|
|
50 |
// If neither EColoredBackground nor ESkinnedBackground is set, then
|
|
51 |
// no background drawing is done.
|
|
52 |
EColoredBackground,
|
|
53 |
|
|
54 |
// If this is set, then control's background is skinned. This hint is
|
|
55 |
// mutually exclusive with EColoredBackground. If neither
|
|
56 |
// EColoredBackground nor ESkinnedBackground is set, then no background
|
|
57 |
// drawing is done.
|
|
58 |
ESkinnedBackground,
|
|
59 |
|
|
60 |
// If this hint is set, then no blind icon is drawn.
|
|
61 |
ENoBlindIcon,
|
|
62 |
|
|
63 |
// If this hint is set, then no waiting text is shown.
|
|
64 |
ENoWaitingText
|
|
65 |
};
|
|
66 |
|
|
67 |
public:
|
|
68 |
|
|
69 |
/**
|
|
70 |
* Destructor
|
|
71 |
*/
|
|
72 |
~CVtUiVideoControlBase();
|
|
73 |
|
|
74 |
protected:
|
|
75 |
|
|
76 |
/**
|
|
77 |
* Constructor
|
|
78 |
*/
|
|
79 |
CVtUiVideoControlBase( CVtUiBitmapManager& aBitmapManager );
|
|
80 |
|
|
81 |
/**
|
|
82 |
* 2nd constructor
|
|
83 |
*/
|
|
84 |
void BaseConstructL();
|
|
85 |
|
|
86 |
/**
|
|
87 |
* Sets (enables) rendering hints
|
|
88 |
*/
|
|
89 |
void SetRenderingHint( TRenderingHint aHint );
|
|
90 |
|
|
91 |
/**
|
|
92 |
* Clears (disables) rendering hints
|
|
93 |
*/
|
|
94 |
void ClearRenderingHint( TRenderingHint aHint );
|
|
95 |
|
|
96 |
/**
|
|
97 |
* Returns reference to bitmap manager.
|
|
98 |
*/
|
|
99 |
CVtUiBitmapManager& BitmapManager() const;
|
|
100 |
|
|
101 |
/**
|
|
102 |
* Returns pointer to bitmap with given ID.
|
|
103 |
*/
|
|
104 |
CFbsBitmap* Bitmap( TVtUiBitmapPoolId aId ) const;
|
|
105 |
|
|
106 |
/**
|
|
107 |
* Fixes given point suitable for DP (e.g. x coordinates of the point is
|
|
108 |
* even).
|
|
109 |
*/
|
|
110 |
TPoint AdjustPointForDP( const TPoint aPoint ) const;
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Fixes given rect suitable for DP (e.g. x coordinates and width of the
|
|
114 |
* rectangle are even).
|
|
115 |
*/
|
|
116 |
TRect AdjustRectForDP( const TRect aRect ) const;
|
|
117 |
|
|
118 |
protected: // virtual methods
|
|
119 |
|
|
120 |
/**
|
|
121 |
* Gets waiting text layout.
|
|
122 |
*/
|
|
123 |
virtual TAknTextLineLayout WaitingTextLayout( TInt aLine );
|
|
124 |
|
|
125 |
/**
|
|
126 |
* The size changed method. If you need to do special handling after the
|
|
127 |
* control's size has changed, overwrite this method.
|
|
128 |
*/
|
|
129 |
virtual void HandleSizeChanged();
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Draws control background using current skin. If you need special
|
|
133 |
* background rendering in inherited control, override this method.
|
|
134 |
* There is no need to check ESkinnedBackground hint again in this method
|
|
135 |
* because it has been checked prior to calling.
|
|
136 |
*/
|
|
137 |
virtual void DrawSkinnedBackground( CWindowGc& aGc ) const;
|
|
138 |
|
|
139 |
/**
|
|
140 |
* Draws control background using color. If you need special
|
|
141 |
* background rendering in inherited control, override this method.
|
|
142 |
* There is no need to check EColoredBackground hint again in this method
|
|
143 |
* because it has been checked prior to calling.
|
|
144 |
*/
|
|
145 |
virtual void DrawColoredBackground( CWindowGc& aGc ) const;
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Draws waiting text. If you need special waiting text rendering in
|
|
149 |
* inherited control, override this method.
|
|
150 |
* There is no need to check ENoWaitingText hint again in this method
|
|
151 |
* because it has been checked prior to calling.
|
|
152 |
*/
|
|
153 |
virtual TBool DrawWaitingText( CWindowGc& aGc ) const;
|
|
154 |
|
|
155 |
/**
|
|
156 |
* Draws blind icon. If you need special blind icon rendering in inherited
|
|
157 |
* control, override this method.
|
|
158 |
* There is no need to check ENoBlindIcon hint again in this method
|
|
159 |
* because it has been checked prior to calling.
|
|
160 |
*/
|
|
161 |
virtual void DrawBlind( CWindowGc& aGc ) const;
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Draws stream. If you need special stream rendering in inherited control,
|
|
165 |
* override this method. iStreamBitmap cannot be NULL if this method is
|
|
166 |
* called.
|
|
167 |
*/
|
|
168 |
virtual void DrawStream( CWindowGc& aGc ) const;
|
|
169 |
|
|
170 |
/**
|
|
171 |
* Returns blitting position (top-left corner) coordinates for the stream.
|
|
172 |
*/
|
|
173 |
virtual TPoint StreamBlitPosition() const;
|
|
174 |
|
|
175 |
/**
|
|
176 |
* Returns clipping rectangle for the stream.
|
|
177 |
*/
|
|
178 |
virtual TRect StreamClippingRect() const;
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Returns pointer to blind bitmap or NULL if no bitmap is present.
|
|
182 |
*/
|
|
183 |
virtual CFbsBitmap* BlindImage() const;
|
|
184 |
|
|
185 |
/**
|
|
186 |
* Returns pointer to blind mask or NULL if no mask is present.
|
|
187 |
*/
|
|
188 |
virtual CFbsBitmap* BlindMask() const;
|
|
189 |
|
|
190 |
/**
|
|
191 |
* Returns blit position for blind icon.
|
|
192 |
*/
|
|
193 |
virtual TPoint BlindBlitPosition() const;
|
|
194 |
|
|
195 |
public: // from MVtUiVideoWindow
|
|
196 |
|
|
197 |
/**
|
|
198 |
* @see MVtUiVideoWindow::Reset
|
|
199 |
*/
|
|
200 |
void Reset();
|
|
201 |
|
|
202 |
/**
|
|
203 |
* @see MVtUiVideoWindow::SetBlind
|
|
204 |
*/
|
|
205 |
void SetBlind( TBool aStatus );
|
|
206 |
|
|
207 |
/**
|
|
208 |
* @see MVtUiVideoWindow::SetStreamBitmap
|
|
209 |
*/
|
|
210 |
void SetStreamBitmap( CFbsBitmap* aStreamBitmap );
|
|
211 |
|
|
212 |
/**
|
|
213 |
* @see MVtUiVideoWindow::SetStreamBitmapReserve
|
|
214 |
*/
|
|
215 |
void SetStreamBitmapReserve( CFbsBitmap* aStreamBitmap );
|
|
216 |
|
|
217 |
/**
|
|
218 |
* @see MVtUiVideoWindow::SetWaiting
|
|
219 |
*/
|
|
220 |
void SetWaiting( TBool aShowWaitingText );
|
|
221 |
|
|
222 |
/**
|
|
223 |
* @see MVtUiVideoWindow::Redraw
|
|
224 |
*/
|
|
225 |
void Redraw();
|
|
226 |
|
|
227 |
/**
|
|
228 |
* @see CCoeControl::MopSupplyObject
|
|
229 |
*/
|
|
230 |
TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
|
|
231 |
|
|
232 |
/**
|
|
233 |
* Set remote video control
|
|
234 |
*/
|
|
235 |
virtual void SetRemoteVideoControl( CCoeControl* aRemoteControl );
|
|
236 |
|
|
237 |
/**
|
|
238 |
* Layout the postion and the size of the remote video control
|
|
239 |
*/
|
|
240 |
virtual void LayoutRemoteVideo();
|
|
241 |
|
|
242 |
/**
|
|
243 |
* Returns pointer to remote video control or NULL if no remote video control is present.
|
|
244 |
*/
|
|
245 |
CCoeControl * RemoteVideoControl();
|
|
246 |
|
|
247 |
private: // from CCoeControl
|
|
248 |
|
|
249 |
/**
|
|
250 |
* @see CCoeControl::Draw
|
|
251 |
*/
|
|
252 |
void Draw( const TRect& aRect ) const;
|
|
253 |
|
|
254 |
/**
|
|
255 |
* @see CCoeControl::SizeChanged
|
|
256 |
*/
|
|
257 |
void SizeChanged();
|
|
258 |
|
|
259 |
/**
|
|
260 |
* @see CCoeControl::PositionChanged
|
|
261 |
*/
|
|
262 |
void PositionChanged();
|
|
263 |
|
|
264 |
private:
|
|
265 |
|
|
266 |
/**
|
|
267 |
* Redraws stream bitmap.
|
|
268 |
*/
|
|
269 |
void RedrawStream();
|
|
270 |
|
|
271 |
/**
|
|
272 |
* Wraps waiting text if needed.
|
|
273 |
*/
|
|
274 |
void WrapOnDemand();
|
|
275 |
|
|
276 |
/**
|
|
277 |
* Wraps waiting text.
|
|
278 |
*/
|
|
279 |
void WrapWaitingTextL();
|
|
280 |
|
|
281 |
/**
|
|
282 |
* The draw method.
|
|
283 |
*/
|
|
284 |
void DoDraw( CWindowGc& aGc ) const;
|
|
285 |
|
|
286 |
/**
|
|
287 |
* Draws control background.
|
|
288 |
*/
|
|
289 |
void DoDrawBackground( CWindowGc& aGc ) const;
|
|
290 |
|
|
291 |
/**
|
|
292 |
* Draws waiting text.
|
|
293 |
*/
|
|
294 |
TBool DoDrawWaitingText( CWindowGc& aGc ) const;
|
|
295 |
|
|
296 |
/**
|
|
297 |
* Draws blind icon.
|
|
298 |
*/
|
|
299 |
void DoDrawBlind( CWindowGc& aGc ) const;
|
|
300 |
|
|
301 |
/**
|
|
302 |
* Draws stream.
|
|
303 |
*/
|
|
304 |
void DoDrawStream( CWindowGc& aGc ) const;
|
|
305 |
|
|
306 |
TBool IsAlphaZero() const;
|
|
307 |
|
|
308 |
void SetAlpha( CWindowGc& aGc ) const;
|
|
309 |
|
|
310 |
protected:
|
|
311 |
|
|
312 |
// ETrue if blind icon is shown.
|
|
313 |
TBool iBlindStatus;
|
|
314 |
|
|
315 |
// Reference to stream bitmap.
|
|
316 |
CFbsBitmap* iStreamBitmap;
|
|
317 |
|
|
318 |
// ETrue if waiting text should be shown.
|
|
319 |
TBool iWaitingTextShow;
|
|
320 |
|
|
321 |
// Owned wrapped waiting text.
|
|
322 |
HBufC* iWaitingTextWrapped;
|
|
323 |
|
|
324 |
// Owned wrapped waiting text.
|
|
325 |
CArrayFix< TPtrC >* iWaitingTextWrappedArray;
|
|
326 |
|
|
327 |
// First line layout of waiting text.
|
|
328 |
TAknLayoutText iWaitingTextLine1Layout;
|
|
329 |
|
|
330 |
// Second line layout of waiting text.
|
|
331 |
TAknLayoutText iWaitingTextLine2Layout;
|
|
332 |
|
|
333 |
// Owned: background context.
|
|
334 |
CAknsBasicBackgroundControlContext* iBgContext;
|
|
335 |
|
|
336 |
// Reference to remote video control.
|
|
337 |
CCoeControl* iRemoteVideoControl;
|
|
338 |
|
|
339 |
private:
|
|
340 |
|
|
341 |
// Pointer to bitmap manager.
|
|
342 |
CVtUiBitmapManager* iBitmapManager;
|
|
343 |
|
|
344 |
// Rendering hints
|
|
345 |
TBitFlags32 iHints;
|
|
346 |
|
|
347 |
// FrameUpdate() is called from AO.
|
|
348 |
CAsyncCallBack* iAsyncFrameUpdated;
|
|
349 |
|
|
350 |
mutable TBool iSetAlpha;
|
|
351 |
|
|
352 |
};
|
|
353 |
|
|
354 |
#endif // C_VTUIVIDEOCONTROLBASE_H
|