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 // CWsClientWindow and associated classes definitions
23 #include <graphics/wselement.h>
25 class CWsClientWindow : public CWsWindow
30 KWinRedrawPriBitsPerLevel=4,
31 KWinRedrawPriMaxOrdinal=(1<<KWinRedrawPriBitsPerLevel)-1, // 15
32 KWinRedrawPriMaxLevel=32/KWinRedrawPriBitsPerLevel-1, // 7
36 CWsClientWindow(CWsClient* aOwner, CScreen* aScreen);
38 virtual void ConstructL(const TWsClCmdCreateWindow &aCmd,CWsWindowBase *aParent, TBool aScreenDeviceIsInvalid);
39 CWsClientWindow *Child() const;
40 inline CWsClientWindow *PrevSibling() const;
41 inline CWsClientWindow *NextSibling() const;
42 inline CWsClientWindow *PrevSiblingMultiParent() const;
43 inline CWsClientWindow *NextSiblingMultiParent() const;
44 virtual void GenerateWindowRegion(RWsRegion &aRegion) const;
45 void GenerateTopRegion(RWsRegion &aRegion) const;
47 public: // from CWsObject
48 void CommandL(TInt aOpcode, const TAny *aCmdData);
50 public: // from MWsWindow
51 void Invalidate(const TRect * aRect = 0);
52 const TRegion& WindowArea() const;
55 void GcActivated(CWsGc *aGc);
56 void GcDeactivated(CWsGc *aGc);
57 void ResetHiddenFlag();
58 const TRegion &InvalidArea() const;
59 void GetClippedBaseArea(RWsRegion &aRegion) const;
60 void GetOpaqueClippedBaseArea(RWsRegion &aRegion) const;
61 inline const TRegion *BaseArea() const;
62 virtual TUint RedrawPriority(TInt *aShift=NULL) const;
63 inline void UpdateAnimArea();
64 void AddKeyRectL(const TRect &aRect, TInt aScanCode, TBool aActivatedByPointerSwitchOn);
65 void RemoveAllKeyRects();
66 void SetVisible(TBool aState);
67 CWsTopClientWindow *TopClientWindow();
68 const TRegion *DrawingRegion();
69 inline TBool IsFadeBehind() const;
72 void SetFaded(TBool aFade, TUint8 aBlackMap, TUint8 aWhiteMap, TBool aNotifyObserver);
73 void SetFaded(TBool aFade, TUint8 aBlackMap, TUint8 aWhiteMap, TBool aNotifyObserver, TBool& aStateChanged);
74 void RecalcChildAbs(const TPoint *aOffset);
75 void ResetHiddenFlagsInParentAndChildren();
76 static inline void SetAbsoluteFading(TBool aAbsoluteFading);
77 inline TBool IsBecomingOpaque() const;
78 TBool IsInfrontOf(const CWsWindowBase* aWin) const;
79 inline const TRegion * GetUserOpaqueRegion();
80 void OffsetUserTransparentRegion(const TPoint& aOffset);
81 void SetUserOpaqueRegion();
83 void ScheduleRegionUpdate(const TRegion* aDefinitelyDirty);
84 void AddRedrawRegion(const TRegion& aRegion, TBool aSchedule, TRedrawDepth aDepth);
85 const TRegion* DebugRegion(TInt aType)const;
86 void SendState(MWsWindowTreeObserver& aWindowTreeObserver) const;
88 inline void SetOriginalSrcElementRect(const TRect &aSrcRect);
89 inline void SetOriginalDestElementRect(const TRect &aDestRect);
90 TRect GetOriginalSrcElementRect() const;
91 TRect GetOriginalDestElementRect() const;
92 void GetElementFlipAndRotation(TBool& aElemetFlip, MWsElement::TElementRotation& aElemenetRotation);
95 virtual void Shutdown(); // Part of two phase destruction
97 void SetExtentL(const TPoint *aPos, const TSize *aSize);
98 static void ClipWindows(TRegion ®ion,const CWsClientWindow *start, const CWsClientWindow *end, TBool aClipTranslucent);
99 void GenerateArea(RWsRegion &aArea, TBool aClipTranslucent) const;
100 void SetAbsFromRel();
101 void MovePosition(const TPoint& aPos);
102 void IncreaseSize(const TSize& aSize,TSize& aOldSize);
103 void ReduceSize(const TSize& aSize,TSize& aOldSize);
104 void Scroll(const TRect &aClipRect, const TPoint &aPoint, const TRect &aRect);
106 void OffsetBaseArea(const TPoint &aOffset);
107 void DeleteBaseArea();
108 void SetCornerTypeL(TCornerType aType, TInt aFlags, TRegion *aNewBaseArea=NULL, TBool aNotifyShapeChanged=ETrue);
109 void ResetHiddenFlags();
110 TDblQue<TPointerKeyList> *PointerKeyList() const;
111 void SetUserTransparentRegion(RWsRegion* aRegion);
112 void UpdateElementExtent(const TPoint* aOffset = NULL);
113 void SetElementOpacity(TInt aOpacity);
115 // from CWsWindowBase
116 TBool IsDSAHost() const;
117 TBool IsActivated() const;
120 void GetBaseAreaOfNode(RWsRegion& aRegion) const;
121 void GetOpaqueBaseAreaOfNode(RWsRegion& aRegion) const;
122 TInt GetNonOpaqueBaseAreaOfNode(RWsRegion& aRegion) const;
123 void ClipRegionToBaseArea(RWsRegion& aRegion) const;
124 void ClipRegionToOpaqueBaseArea(RWsRegion& aRegion) const;
129 TUint iBackupsRequested;
130 TRegion *iBaseArea; // The base area of the window without any clipping from windows taken into account
131 TDblQue<TPointerKeyList> *iPointerKeyList;
132 static TBool iAbsoluteFading;
134 By default the full window region is transparent if the window is marked
135 as transparent. If this is not the desired behaviour the client can
136 define the transparent region itself.
138 @see RWindow::SetTransparentRegion()
140 RWsRegion* iUserDefinedTransparentRegion;
141 RWsRegion* iUserDefinedOpaqueRegion;
143 TRect iOriginalSrcElementRect;
144 TRect iOriginalDestElementRect;
147 class CWsTopClientWindow : public CWsClientWindow
150 CWsTopClientWindow(CWsClient* aOwner, CScreen* aScreen);
151 void ConstructL(const TWsClCmdCreateWindow &cmd,CWsWindowBase *aParent, TBool aScreenDeviceIsInvalid);
152 virtual void SetOrdinalPosition(TInt pos);
153 void DoMoveWindowL(TInt aIdentifier);
154 inline CWsTopClientWindow *NextSiblingTop() const;
155 inline CWsTopClientWindow *PrevSiblingTop() const;
156 inline CWsTopClientWindow *PrevSiblingMultiParent() const;
157 inline CWsTopClientWindow *NextSiblingMultiParent() const;
158 inline CWsWindowGroup *Parent() const;
161 void SetScreenDeviceValidState(TBool aState);
162 TBool SetScreenDeviceValidStateFlag(TBool aState);
163 virtual TUint RedrawPriority(TInt *aShift=NULL) const;
166 inline CWsClientWindow *CWsClientWindow::Child() const
168 return((CWsClientWindow *)iChild);
171 inline CWsClientWindow *CWsClientWindow::NextSibling() const
173 return((CWsClientWindow *)iSibling);
176 inline CWsClientWindow *CWsClientWindow::PrevSibling() const
178 return((CWsClientWindow *)GetPrevSibling());
181 inline const TRegion *CWsClientWindow::BaseArea() const
186 inline void CWsClientWindow::UpdateAnimArea()
188 iRedraw->UpdateAnimArea();
191 inline TBool CWsClientWindow::IsFadeBehind() const
193 return(iFlags&EFlagFadeBehind);
196 inline void CWsClientWindow::SetAbsoluteFading(TBool aAbsoluteFading)
198 iAbsoluteFading=aAbsoluteFading;
201 inline CWsTopClientWindow *CWsTopClientWindow::NextSiblingTop() const
203 return((CWsTopClientWindow *)iSibling);
206 inline CWsTopClientWindow *CWsTopClientWindow::PrevSiblingTop() const
208 return((CWsTopClientWindow *)GetPrevSibling());
211 inline CWsTopClientWindow *CWsTopClientWindow::PrevSiblingMultiParent() const
213 return((CWsTopClientWindow *)CWsWindowBase::PrevSiblingMultiParent());
216 inline CWsTopClientWindow *CWsTopClientWindow::NextSiblingMultiParent() const
218 return((CWsTopClientWindow *)CWsWindowBase::NextSiblingMultiParent());
221 inline CWsWindowGroup *CWsTopClientWindow::Parent() const
223 return((CWsWindowGroup *)iParent);
226 inline const TRegion * CWsClientWindow::GetUserOpaqueRegion()
228 return iUserDefinedOpaqueRegion;
231 inline void CWsClientWindow::SetOriginalSrcElementRect(const TRect &aSrcRect)
233 iOriginalSrcElementRect = aSrcRect;
236 inline void CWsClientWindow::SetOriginalDestElementRect(const TRect &aDestRect)
238 iOriginalDestElementRect = aDestRect;