|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // CWsWindow and associated classes definitions |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __WINDOW_H__ |
|
19 #define __WINDOW_H__ |
|
20 |
|
21 #include "server.h" |
|
22 #include "winbase.h" |
|
23 |
|
24 #ifndef _DEBUG |
|
25 |
|
26 #define LOG_WINDOW_FADE_START(wswin) |
|
27 #define LOG_WINDOW_FADE_REGION(region) |
|
28 #define LOG_WINDOW_FADE_END(wswin) |
|
29 |
|
30 #else |
|
31 |
|
32 #define LOG_WINDOW_FADE_START(wswin) LogFadeStart(wswin) |
|
33 #define LOG_WINDOW_FADE_REGION(region) LogFadeRegion(region) |
|
34 #define LOG_WINDOW_FADE_END(wswin) LogFadeEnd(wswin) |
|
35 |
|
36 class TTruncateOverflow : public TDesOverflow |
|
37 { |
|
38 public: |
|
39 virtual void Overflow(TDes&) {}; |
|
40 }; |
|
41 |
|
42 void LogRegion(const TRegion* aRegion); |
|
43 void LogFadeStart(const CWsWindow* aWsWin); |
|
44 void LogFadeRegion(const TRegion* aRegion); |
|
45 void LogFadeEnd(const CWsWindow* aWsWin); |
|
46 |
|
47 #endif |
|
48 |
|
49 void AnnotateWindowRedrawStart(const CWsWindow& aWsWin, const TRegion& aRegion); |
|
50 void AnnotateWindowRedrawEnd(const CWsWindow& aWsWin); |
|
51 void AnnotateWindowAnimRedrawStart(const CWsWindow& aWsWin, const CWsAnim& aAnim, const TRegion& aRegion); |
|
52 void AnnotateWindowAnimRedrawEnd(const CWsWindow& aWsWin, const CWsAnim& aAnim); |
|
53 void AnnotateSpriteRedrawStart(const CWsWindow& aWsWin, const CWsSpriteBase& aSprite, const TRegion& aRegion); |
|
54 void AnnotateSpriteRedrawEnd(const CWsWindow& aWsWin, const CWsSpriteBase& aSprite); |
|
55 |
|
56 class MWsGraphicsContext; |
|
57 class CWsRenderStage; |
|
58 |
|
59 class CWsWindow : public CWsWindowBase, public MWsWindow |
|
60 { |
|
61 friend class TWalkWindowTreeDisconnect; |
|
62 friend class CWsRootWindow; |
|
63 friend class TWalkWindowTreeFindWithFlag; |
|
64 public: |
|
65 CWsWindow(CWsClient* aOwner,WH_HANDLES aType, CScreen* aScreen); |
|
66 ~CWsWindow(); |
|
67 void Construct(); |
|
68 inline const TRect& Rel() const; |
|
69 inline const TRect& Abs() const; |
|
70 inline CWsWindow *PrevSiblingMultiParent() const; |
|
71 inline CWsWindow *NextSiblingMultiParent() const; |
|
72 inline TUint PointerFilter() const; |
|
73 inline TBool HasPointerGrab() const; |
|
74 inline TBool ShutDownInProgress() const; |
|
75 inline TRgb BackColor() const; |
|
76 virtual void AreaCovered(TRegion &aRegion); |
|
77 const TRegion* VisibleRegionIfValid() const; |
|
78 const TRegion& VisibleRegion() const; |
|
79 void ClearVisibleRegion(); |
|
80 void SetVisibleRegion(const TRegion& aNewVisibleRegion, const TRegion* aTop); |
|
81 void SetFadeableRegion(const TRegion& aNewFadeableRegion, const TRegion& aTop); |
|
82 |
|
83 virtual void GenerateWindowRegion(RWsRegion &aRegion) const=0; |
|
84 TRect FullRect() const; |
|
85 inline TBool ClientSetInvisible() const; |
|
86 inline TBool IsVisible() const; |
|
87 inline TBool DragDropCapture() const; |
|
88 inline CWsBackedUpWindow *Backup() const; |
|
89 TDisplayMode DisplayMode() const; |
|
90 inline TInt UsingPointerBuffer() const; |
|
91 virtual TDblQue<TPointerKeyList> *PointerKeyList() const; |
|
92 inline CWsWindowRedraw *Redraw() const; |
|
93 inline TBool IsTopClientWindow() const; |
|
94 TDisplayMode SetRequiredDisplayModeL(TDisplayMode aDisplayMode); |
|
95 inline TBool IsActive() const; |
|
96 TInt AddDSA(CWsDirectScreenAccess& aDirect); |
|
97 void RemoveDSA(CWsDirectScreenAccess& aDirect); |
|
98 void AbortAllDSAs(); |
|
99 #if defined(_DEBUG) |
|
100 inline const TSglQue<CWsDirectScreenAccess>& DSAs() const; |
|
101 #endif |
|
102 void PossibleVisibilityChangedEvent(TBool aForceSend); |
|
103 void SetNonFading(TBool aNonFading); |
|
104 void SetFadeBehind(TBool aFade); |
|
105 inline void GetFadingParams(TUint8& aBlackMap,TUint8& aWhiteMap) const; |
|
106 inline TBool IsTranslucent() const; |
|
107 inline TBool HasAlpha() const; |
|
108 inline TBool HasBeenDrawnToScreen() const; |
|
109 inline void SetDrawnToScreen(TBool aDrawn); |
|
110 void FocusChanged(TBool aNewFocusState); |
|
111 void ClipRectToViewport(TRect& aRect) const; |
|
112 void SetNextScheduled(CWsWindow * aWin); |
|
113 CWsWindow * NextScheduled() const; |
|
114 inline const TRegion& ScheduledRegion() const; |
|
115 inline const TRegion& ScheduledSpriteRegion() const; |
|
116 TBool SetScheduledRegion(const TRegion& aRegion); |
|
117 void ClearScheduledRegion(); |
|
118 void ClearScheduledSpriteRegion(); |
|
119 static TBool ReleaseMemory(MWsMemoryRelease::TMemoryReleaseLevel aLevel); |
|
120 TBool ReadyToDraw() const; |
|
121 void Render(MWsGraphicsContext& aGc, const TRegion& aWindowRegion, const TRegion& aWindowChildNodeRegion); |
|
122 void Accessed(); |
|
123 |
|
124 inline TBool IsNonFading() const; |
|
125 const TRegion& QuickFadeRegion() const; |
|
126 void Fade(MWsGraphicsContext * aGc, const TRegion& aRegion); |
|
127 |
|
128 inline void SetValidRedraw(); |
|
129 inline TBool IsValidRedraw() const; |
|
130 inline TBool HasElement() const; |
|
131 inline TBool IsFading() const; |
|
132 inline TBool HasAnimation() const; |
|
133 inline TBool IsBackgroundClearEnabled() const; |
|
134 void AddDirtyWindowRegion(const TRegion& aRegion); |
|
135 void AddDirtySpriteRegion(const TRegion& aRegion); |
|
136 const TRegion& DirtyWindowRegion() const; |
|
137 const TRegion& DirtySpriteRegion() const; |
|
138 void ScheduleDirtyWindowRegion(); |
|
139 void ScheduleDirtySpriteRegion(); |
|
140 void SetupVisibleRegionTracking(TBool aRegister); |
|
141 inline TBool IsTrackingVisibleRegion() const; |
|
142 const TRegion& FadableRegion() const; |
|
143 |
|
144 public: // from CWsWindowBase |
|
145 TBool IsDSAHost() const; |
|
146 void SendState(MWsWindowTreeObserver& aWindowTreeObserver) const; |
|
147 |
|
148 public: // from MWsWindow |
|
149 TPoint Origin() const; |
|
150 TRect AbsRect() const; |
|
151 TSize Size() const; |
|
152 TUint32 Handle() const; |
|
153 MWsScreen * WsScreen() const; |
|
154 void Invalidate(const TRect *) {} |
|
155 MWsWindow * FindChildByHandle(TUint32 aHandle); |
|
156 TInt OrdinalPriority() const; |
|
157 |
|
158 protected: |
|
159 TPoint InquireOffset(TUint32 aHandle) const; |
|
160 void Shutdown(); // Part of two phase destruction |
|
161 void FocusChangedL(TBool aNewFocusState); |
|
162 void RemoveFromAccessList(); |
|
163 void InsertIntoAccessListOldestEnd(); |
|
164 void InsertIntoAccessListRecentEnd(); |
|
165 void DeactivateAllSprites(); |
|
166 private: |
|
167 void StatusDump(TDes &aBuf); |
|
168 void ResetVisibleRegion(); |
|
169 void AbortDsaIfRequired(const TRegion& aNewRegion, const TRegion* aTop); |
|
170 void RestartAnimations(const TRegion& aNewRegion); |
|
171 #if defined (_DEBUG) |
|
172 public: |
|
173 TBool iInteresting; // Often useful while debugging for conditional breakpoints. |
|
174 #endif |
|
175 protected: |
|
176 TRect iRel; |
|
177 TRect iAbs; |
|
178 TPoint iOrigin; |
|
179 RWsRegionBuf<1> iVisibleRegion; |
|
180 TUint iPointerFilter; |
|
181 TInt iPointerCapturePriority; |
|
182 TUint iFlags; |
|
183 CWsWindowRedraw *iRedraw; |
|
184 TSglQue<CWsDirectScreenAccess> iDSAs; |
|
185 CWsWindow * iNextScheduled; |
|
186 RWsRegionBuf<1> iScheduledRegion; |
|
187 RWsRegionBuf<1> iScheduledSpriteRegion; |
|
188 // The access list is a "most recently drawn" ordering list of all redraw msg windows. |
|
189 static CWsWindow * iAccessListRecentEnd; |
|
190 static CWsWindow * iAccessListOldestEnd; |
|
191 CWsWindow * iAccessListPrev; |
|
192 CWsWindow * iAccessListNext; |
|
193 TUint8 iBlackMap; |
|
194 TUint8 iWhiteMap; |
|
195 RWsRegionBuf<1> iQuickFadeRegion; |
|
196 RWsRegionBuf<1> iFadableRegion; // Region which can be faded (Visible region minus already faded regions) |
|
197 RWsRegionBuf<1> iDirtyWindowRegion; |
|
198 RWsRegionBuf<1> iDirtySpriteRegion; |
|
199 TInt iVisibleRegionTrackingCounter; |
|
200 public: |
|
201 /** The list of graphic contexts associated with this window. The list is managed by calling the |
|
202 GcActivated() and GcDeactivated() functions. |
|
203 This is a linked list. The CWsGc class contains a pointer to the next item: CWsGc::iNextWinGc. |
|
204 */ |
|
205 CWsGc *iWinGcList; |
|
206 CWsAnim *iAnimList; // Start of linked list of animated objects attached to the window |
|
207 }; |
|
208 |
|
209 #include "wnredraw.h" |
|
210 |
|
211 inline TBool CWsWindow::IsVisible() const |
|
212 { |
|
213 return(!(iFlags&EFlagHidden)); |
|
214 } |
|
215 |
|
216 inline TBool CWsWindow::ClientSetInvisible() const |
|
217 { |
|
218 return(iFlags&EFlagInvisible); |
|
219 } |
|
220 |
|
221 inline TBool CWsWindow::DragDropCapture() const |
|
222 { |
|
223 return(iFlags&EFlagPointerCaptureDragDrop); |
|
224 } |
|
225 |
|
226 inline TRgb CWsWindow::BackColor() const |
|
227 { |
|
228 return(iRedraw->BackColor()); |
|
229 } |
|
230 |
|
231 inline TInt CWsWindow::UsingPointerBuffer() const |
|
232 { |
|
233 return(iFlags&EFlagUsingPointerBuffer); |
|
234 } |
|
235 |
|
236 inline CWsWindowRedraw *CWsWindow::Redraw() const |
|
237 { |
|
238 return iRedraw; |
|
239 } |
|
240 |
|
241 inline const TRect& CWsWindow::Rel() const |
|
242 { |
|
243 return iRel; |
|
244 } |
|
245 |
|
246 inline const TRect& CWsWindow::Abs() const |
|
247 { |
|
248 return iAbs; |
|
249 } |
|
250 |
|
251 inline TBool CWsWindow::IsTopClientWindow() const |
|
252 { |
|
253 return(iFlags&EFlagIsTopClientWindow); |
|
254 } |
|
255 |
|
256 inline TUint CWsWindow::PointerFilter() const |
|
257 { |
|
258 return(iPointerFilter); |
|
259 } |
|
260 |
|
261 inline TBool CWsWindow::HasPointerGrab() const |
|
262 { |
|
263 return(iFlags&EFlagPointerGrab); |
|
264 } |
|
265 |
|
266 inline TBool CWsWindow::ShutDownInProgress() const |
|
267 { |
|
268 return(iFlags&EFlagShutDownInProgress); |
|
269 } |
|
270 |
|
271 inline CWsBackedUpWindow *CWsWindow::Backup() const |
|
272 { |
|
273 return(iRedraw->Backup()); |
|
274 } |
|
275 |
|
276 inline CWsWindow *CWsWindow::PrevSiblingMultiParent() const |
|
277 { |
|
278 return((CWsWindow *)CWsWindowBase::PrevSiblingMultiParent()); |
|
279 } |
|
280 |
|
281 inline CWsWindow *CWsWindow::NextSiblingMultiParent() const |
|
282 { |
|
283 return((CWsWindow *)CWsWindowBase::NextSiblingMultiParent()); |
|
284 } |
|
285 |
|
286 inline TBool CWsWindow::IsActive() const |
|
287 { |
|
288 return iFlags&EFlagActive; |
|
289 } |
|
290 |
|
291 inline TBool CWsWindow::IsTranslucent() const |
|
292 { |
|
293 return (iFlags & static_cast<TUint>(EFlagHasAlpha)) != 0; |
|
294 } |
|
295 |
|
296 inline TBool CWsWindow::HasAlpha() const |
|
297 { |
|
298 return (iFlags & static_cast<TUint>(EFlagHasAlpha)) !=0; |
|
299 } |
|
300 |
|
301 inline TBool CWsWindow::HasBeenDrawnToScreen() const |
|
302 { |
|
303 return (iFlags & static_cast<TUint>(EFlagDrawnToScreen)) != 0; |
|
304 } |
|
305 |
|
306 inline void CWsWindow::SetDrawnToScreen(TBool aDrawn) |
|
307 { |
|
308 if (aDrawn) |
|
309 iFlags |= static_cast<TUint>(EFlagDrawnToScreen); |
|
310 else |
|
311 iFlags &= ~static_cast<TUint>(EFlagDrawnToScreen); |
|
312 } |
|
313 |
|
314 inline const TRegion& CWsWindow::ScheduledRegion() const |
|
315 { |
|
316 return iScheduledRegion; |
|
317 } |
|
318 |
|
319 inline const TRegion& CWsWindow::ScheduledSpriteRegion() const |
|
320 { |
|
321 return iScheduledSpriteRegion; |
|
322 } |
|
323 |
|
324 #if defined(_DEBUG) |
|
325 inline const TSglQue<CWsDirectScreenAccess>& CWsWindow::DSAs() const |
|
326 { |
|
327 return iDSAs; |
|
328 } |
|
329 #endif |
|
330 |
|
331 inline TBool CWsWindow::IsNonFading() const |
|
332 { |
|
333 return (iFlags&EFlagNonFadingWindow); |
|
334 } |
|
335 |
|
336 inline void CWsWindow::GetFadingParams(TUint8& aBlackMap,TUint8& aWhiteMap) const |
|
337 {aBlackMap=iBlackMap;aWhiteMap=iWhiteMap;} |
|
338 |
|
339 inline TBool CWsWindow::HasElement() const |
|
340 { |
|
341 return (Redraw())?(Redraw()->HasElement()):(EFalse); |
|
342 } |
|
343 |
|
344 inline TBool CWsWindow::IsFading() const |
|
345 { |
|
346 return (!IsNonFading() && (iFadeCount > 0)); |
|
347 } |
|
348 |
|
349 inline void CWsWindow::SetValidRedraw() |
|
350 { |
|
351 iFlags |= EFlagValidRedraw; |
|
352 } |
|
353 |
|
354 inline TBool CWsWindow::IsValidRedraw() const |
|
355 { |
|
356 return (iFlags & EFlagValidRedraw); |
|
357 } |
|
358 |
|
359 inline TBool CWsWindow::HasAnimation() const |
|
360 { |
|
361 return (NULL != iAnimList); |
|
362 } |
|
363 |
|
364 inline TBool CWsWindow::IsBackgroundClearEnabled() const |
|
365 { |
|
366 return Redraw()->IsBackgroundClearEnabled(); |
|
367 } |
|
368 |
|
369 inline TBool CWsWindow::IsTrackingVisibleRegion() const |
|
370 { |
|
371 WS_ASSERT_DEBUG(iVisibleRegionTrackingCounter>=0,EWsPanicVisibleRegionTracking); |
|
372 return iVisibleRegionTrackingCounter; |
|
373 } |
|
374 |
|
375 #endif |