|
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 // CWsClientWindow and associated classes definitions |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __CLIWIN_H__ |
|
19 #define __CLIWIN_H__ |
|
20 |
|
21 #include "server.h" |
|
22 #include "window.h" |
|
23 #include <graphics/wselement.h> |
|
24 |
|
25 class CWsClientWindow : public CWsWindow |
|
26 { |
|
27 protected: |
|
28 enum |
|
29 { |
|
30 KWinRedrawPriBitsPerLevel=4, |
|
31 KWinRedrawPriMaxOrdinal=(1<<KWinRedrawPriBitsPerLevel)-1, // 15 |
|
32 KWinRedrawPriMaxLevel=32/KWinRedrawPriBitsPerLevel-1, // 7 |
|
33 }; |
|
34 |
|
35 public: |
|
36 CWsClientWindow(CWsClient* aOwner, CScreen* aScreen); |
|
37 ~CWsClientWindow(); |
|
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; |
|
46 |
|
47 public: // from CWsObject |
|
48 void CommandL(TInt aOpcode, const TAny *aCmdData); |
|
49 |
|
50 public: // from MWsWindow |
|
51 void Invalidate(const TRect * aRect = 0); |
|
52 const TRegion& WindowArea() const; |
|
53 |
|
54 public: |
|
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; |
|
70 // |
|
71 TBool IsHidden(); |
|
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(); |
|
82 void ReactivateGcs(); |
|
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; |
|
87 |
|
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); |
|
93 |
|
94 protected: |
|
95 virtual void Shutdown(); // Part of two phase destruction |
|
96 void Activate(); |
|
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); |
|
105 void CalcBaseArea(); |
|
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); |
|
114 |
|
115 // from CWsWindowBase |
|
116 TBool IsDSAHost() const; |
|
117 TBool IsActivated() const; |
|
118 |
|
119 private: |
|
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; |
|
125 |
|
126 |
|
127 private: |
|
128 TInt iCornerData; |
|
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; |
|
133 /** |
|
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. |
|
137 |
|
138 @see RWindow::SetTransparentRegion() |
|
139 */ |
|
140 RWsRegion* iUserDefinedTransparentRegion; |
|
141 RWsRegion* iUserDefinedOpaqueRegion; |
|
142 |
|
143 TRect iOriginalSrcElementRect; |
|
144 TRect iOriginalDestElementRect; |
|
145 }; |
|
146 |
|
147 class CWsTopClientWindow : public CWsClientWindow |
|
148 { |
|
149 public: |
|
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; |
|
159 |
|
160 void SetInactive(); |
|
161 void SetScreenDeviceValidState(TBool aState); |
|
162 TBool SetScreenDeviceValidStateFlag(TBool aState); |
|
163 virtual TUint RedrawPriority(TInt *aShift=NULL) const; |
|
164 }; |
|
165 |
|
166 inline CWsClientWindow *CWsClientWindow::Child() const |
|
167 { |
|
168 return((CWsClientWindow *)iChild); |
|
169 } |
|
170 |
|
171 inline CWsClientWindow *CWsClientWindow::NextSibling() const |
|
172 { |
|
173 return((CWsClientWindow *)iSibling); |
|
174 } |
|
175 |
|
176 inline CWsClientWindow *CWsClientWindow::PrevSibling() const |
|
177 { |
|
178 return((CWsClientWindow *)GetPrevSibling()); |
|
179 } |
|
180 |
|
181 inline const TRegion *CWsClientWindow::BaseArea() const |
|
182 { |
|
183 return iBaseArea; |
|
184 } |
|
185 |
|
186 inline void CWsClientWindow::UpdateAnimArea() |
|
187 { |
|
188 iRedraw->UpdateAnimArea(); |
|
189 } |
|
190 |
|
191 inline TBool CWsClientWindow::IsFadeBehind() const |
|
192 { |
|
193 return(iFlags&EFlagFadeBehind); |
|
194 } |
|
195 |
|
196 inline void CWsClientWindow::SetAbsoluteFading(TBool aAbsoluteFading) |
|
197 { |
|
198 iAbsoluteFading=aAbsoluteFading; |
|
199 } |
|
200 |
|
201 inline CWsTopClientWindow *CWsTopClientWindow::NextSiblingTop() const |
|
202 { |
|
203 return((CWsTopClientWindow *)iSibling); |
|
204 } |
|
205 |
|
206 inline CWsTopClientWindow *CWsTopClientWindow::PrevSiblingTop() const |
|
207 { |
|
208 return((CWsTopClientWindow *)GetPrevSibling()); |
|
209 } |
|
210 |
|
211 inline CWsTopClientWindow *CWsTopClientWindow::PrevSiblingMultiParent() const |
|
212 { |
|
213 return((CWsTopClientWindow *)CWsWindowBase::PrevSiblingMultiParent()); |
|
214 } |
|
215 |
|
216 inline CWsTopClientWindow *CWsTopClientWindow::NextSiblingMultiParent() const |
|
217 { |
|
218 return((CWsTopClientWindow *)CWsWindowBase::NextSiblingMultiParent()); |
|
219 } |
|
220 |
|
221 inline CWsWindowGroup *CWsTopClientWindow::Parent() const |
|
222 { |
|
223 return((CWsWindowGroup *)iParent); |
|
224 } |
|
225 |
|
226 inline const TRegion * CWsClientWindow::GetUserOpaqueRegion() |
|
227 { |
|
228 return iUserDefinedOpaqueRegion; |
|
229 } |
|
230 |
|
231 inline void CWsClientWindow::SetOriginalSrcElementRect(const TRect &aSrcRect) |
|
232 { |
|
233 iOriginalSrcElementRect = aSrcRect; |
|
234 } |
|
235 |
|
236 inline void CWsClientWindow::SetOriginalDestElementRect(const TRect &aDestRect) |
|
237 { |
|
238 iOriginalDestElementRect = aDestRect; |
|
239 } |
|
240 |
|
241 #endif |