Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // CWsWindow and associated classes definitions
24 class CWsWindow : public CWsWindowBase, public MWsWindow
26 friend class TWalkWindowTreeDisconnect;
27 friend class CWsRootWindow;
28 friend class TWalkWindowTreeFindWithFlag;
30 CWsWindow(CWsClient* aOwner,WH_HANDLES aType, CScreen* aScreen);
33 inline const TRect& Rel() const;
34 inline const TRect& Abs() const;
35 inline CWsWindow *PrevSiblingMultiParent() const;
36 inline CWsWindow *NextSiblingMultiParent() const;
37 inline TUint PointerFilter() const;
38 inline TBool HasPointerGrab() const;
39 inline TBool ShutDownInProgress() const;
40 inline TRgb BackColor() const;
41 virtual const TRegion& WindowArea() const = 0;
42 const TRegion* VisibleRegionIfValid() const;
43 const TRegion& VisibleRegion() const;
44 void ClearVisibleRegion();
45 void SetVisibleRegion(const TRegion& aRegion, const TRegion* aTop, TRegion& aNewFadableRegion);
46 virtual void GenerateWindowRegion(RWsRegion &aRegion) const=0;
47 TRect FullRect() const;
48 inline TBool ClientSetInvisible() const;
49 inline TBool IsVisible() const;
50 inline TBool DragDropCapture() const;
51 inline CWsBackedUpWindow *Backup() const;
52 TDisplayMode DisplayMode() const;
53 inline TInt UsingPointerBuffer() const;
54 virtual TDblQue<TPointerKeyList> *PointerKeyList() const;
55 inline CWsWindowRedraw *Redraw() const;
56 inline TBool IsTopClientWindow() const;
57 inline TBool IsActive() const;
58 inline void AddDSA(CWsDirectScreenAccess& aDirect);
59 inline void RemoveDSA(CWsDirectScreenAccess& aDirect);
62 inline const TSglQue<CWsDirectScreenAccess>& DSAs() const;
64 void PossibleVisibilityChangedEvent(TBool aForceSend);
65 void SetNonFading(TBool aNonFading);
66 void SetFadeBehind(TBool aFade);
67 inline void GetFadingParams(TUint8& aBlackMap,TUint8& aWhiteMap) const;
68 inline TBool IsTranslucent() const;
69 inline TBool HasAlpha() const;
70 inline TBool HasBeenDrawnToScreen() const;
71 inline void SetDrawnToScreen(TBool aDrawn);
72 void FocusChanged(TBool aNewFocusState);
73 void ClipRectToViewport(TRect& aRect) const;
74 void SetNextScheduled(CWsWindow * aWin);
75 CWsWindow * NextScheduled() const;
76 inline const RWsRegion * ScheduledRegion() const;
77 TBool SetScheduledRegion(const RWsRegion& aRegion);
78 void ClearScheduledRegion();
79 static TBool ReleaseMemory(MWsMemoryRelease::TMemoryReleaseLevel aLevel);
80 TBool ReadyToDraw() const;
81 virtual void Render(CFbsBitGc * aGc, const TRegion& aRegion);
82 void AddSprite(CWsSpriteBase * aSprite);
83 void RemoveSprite(CWsSpriteBase * aSprite);
86 inline TBool IsNonFading() const;
87 const TRegion& FadableRegion() const;
88 inline TBool HasSprite() const;
89 inline TBool HasAnimation() const;
91 public: // from CWsWindowBase
92 TBool IsDSAHost() const;
94 public: // from MWsWindow
95 virtual TPoint Origin() const;
96 virtual TRect AbsRect() const;
97 virtual TSize Size() const;
98 virtual TUint32 Handle() const;
99 virtual MWsScreen * WsScreen() const;
100 virtual void Invalidate(const TRect *) {}
101 virtual MWsWindow * FindChildByHandle(TUint32 aHandle);
102 virtual TInt OrdinalPriority() const;
106 TPoint InquireOffset(TUint32 aHandle) const;
108 void Shutdown(); // Part of two phase destruction
109 void FocusChangedL(TBool aNewFocusState);
110 void RemoveFromAccessList();
111 void InsertIntoAccessListOldestEnd();
112 void InsertIntoAccessListRecentEnd();
113 void DeactivateAllSprites();
115 void StatusDump(TDes &aBuf);
116 void ResetVisibleRegion();
117 void AbortDsaIfRequired(const TRegion& aNewRegion, const TRegion* aTop);
120 TBool iInteresting; // Often useful while debugging for conditional breakpoints.
126 RWsRegion iVisibleRegion;
127 TUint iPointerFilter;
128 TInt iPointerCapturePriority;
130 CWsWindowRedraw *iRedraw;
131 TSglQue<CWsDirectScreenAccess> iDSAs;
132 CWsWindow * iNextScheduled;
133 RWsRegion iScheduledRegion;
134 // The access list is a "most recently drawn" ordering list of all redraw msg windows.
135 static CWsWindow * iAccessListRecentEnd;
136 static CWsWindow * iAccessListOldestEnd;
137 CWsWindow * iAccessListPrev;
138 CWsWindow * iAccessListNext;
141 RWsRegion iFadableRegion; // Region which can be faded (Visible region minus already faded regions)
143 /** The list of graphic contexts associated with this window. The list is managed by calling the
144 GcActivated() and GcDeactivated() functions.
145 This is a linked list. The CWsGc class contains a pointer to the next item: CWsGc::iNextWinGc.
148 CWsAnim *iAnimList; // Start of linked list of animated objects attached to the window
149 CWsSpriteBase *iSpriteList; // Start of linked list of sprites attached to the window
152 #include "wnredraw.h"
154 inline TBool CWsWindow::IsVisible() const
156 return(!(iFlags&EFlagHidden));
159 inline TBool CWsWindow::ClientSetInvisible() const
161 return(iFlags&EFlagInvisible);
164 inline TBool CWsWindow::DragDropCapture() const
166 return(iFlags&EFlagPointerCaptureDragDrop);
169 inline TRgb CWsWindow::BackColor() const
171 return(iRedraw->BackColor());
174 inline TInt CWsWindow::UsingPointerBuffer() const
176 return(iFlags&EFlagUsingPointerBuffer);
179 inline CWsWindowRedraw *CWsWindow::Redraw() const
184 inline const TRect& CWsWindow::Rel() const
189 inline const TRect& CWsWindow::Abs() const
194 inline TBool CWsWindow::IsTopClientWindow() const
196 return (WinType() == EWinTypeClient && iParent->WinType() == EWinTypeGroup);
199 inline TUint CWsWindow::PointerFilter() const
201 return(iPointerFilter);
204 inline TBool CWsWindow::HasPointerGrab() const
206 return(iFlags&EFlagPointerGrab);
209 inline TBool CWsWindow::ShutDownInProgress() const
211 return(iFlags&EFlagShutDownInProgress);
214 inline CWsBackedUpWindow *CWsWindow::Backup() const
216 return(iRedraw->Backup());
219 inline TBool CWsWindow::IsActive() const
221 return iFlags&EFlagActive;
224 inline void CWsWindow::AddDSA(CWsDirectScreenAccess& aDirect)
226 iDSAs.AddLast(aDirect);
229 inline void CWsWindow::RemoveDSA(CWsDirectScreenAccess& aDirect)
231 iDSAs.Remove(aDirect);
234 inline TBool CWsWindow::IsTranslucent() const
236 return (iFlags & static_cast<TUint>(EFlagHasAlpha)) != 0;
239 inline TBool CWsWindow::HasAlpha() const
241 return (iFlags & static_cast<TUint>(EFlagHasAlpha)) !=0;
244 inline TBool CWsWindow::HasBeenDrawnToScreen() const
246 return (iFlags & static_cast<TUint>(EFlagDrawnToScreen)) != 0;
249 inline void CWsWindow::SetDrawnToScreen(TBool aDrawn)
252 iFlags |= static_cast<TUint>(EFlagDrawnToScreen);
254 iFlags &= ~static_cast<TUint>(EFlagDrawnToScreen);
257 inline const RWsRegion * CWsWindow::ScheduledRegion() const
259 return &iScheduledRegion;
263 inline const TSglQue<CWsDirectScreenAccess>& CWsWindow::DSAs() const
269 inline TBool CWsWindow::IsNonFading() const
271 return (iFlags&EFlagNonFadingWindow);
274 inline void CWsWindow::GetFadingParams(TUint8& aBlackMap,TUint8& aWhiteMap) const
275 {aBlackMap=iBlackMap;aWhiteMap=iWhiteMap;}
277 inline TBool CWsWindow::HasSprite() const
279 return (NULL != iSpriteList);
282 inline TBool CWsWindow::HasAnimation() const
284 return (NULL != iAnimList);