|
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 __WINDOWGROUP_H__ |
|
19 #define __WINDOWGROUP_H__ |
|
20 |
|
21 #include "server.h" |
|
22 #include "tcursor.h" |
|
23 |
|
24 class CWsWindowGroup : public CWsWindowBase |
|
25 { |
|
26 private: |
|
27 enum {EMaxIdentifierCount=10000}; // Could go as high as the highest signed int, but this would be impractical to test |
|
28 enum TGroupWindowFlags { |
|
29 EGroupFlagDisableKeyClick=0x01, |
|
30 EGroupFlagReceivesFocus= 0x02, |
|
31 EGroupFlagAutoForeground= 0x04, |
|
32 EGroupFlagHandlesDeviceChange= 0x08, |
|
33 EGroupFlagScreenDeviceDeleted= 0x10, |
|
34 EGroupFlagMsgQueueActive= 0x20, |
|
35 EGroupFlagMsgQueueNew= 0x40, |
|
36 EGroupFlagMessageSignalled= 0x80, |
|
37 }; |
|
38 public: |
|
39 static CWsWindowGroup* NewL(CWsClient* aOwner, CScreen* aScreen, |
|
40 const TWsClCmdCreateWindowGroup& aCmd); |
|
41 ~CWsWindowGroup(); |
|
42 private: |
|
43 CWsWindowGroup(CWsClient* aOwner,CScreen* aScreen); |
|
44 void ConstructL(const TWsClCmdCreateWindowGroup &aCmd); |
|
45 public: // from CWsObject |
|
46 virtual void CommandL(TInt aOpcode, const TAny *aCmdData); |
|
47 public: // from CWsWindowBase |
|
48 virtual TPoint Origin() const; |
|
49 virtual TRect AbsRect() const; |
|
50 virtual TSize Size() const; |
|
51 public: |
|
52 CWsClientWindow *Child() const; |
|
53 inline CWsWindowGroup *PrevSibling() const; |
|
54 inline CWsWindowGroup *NextSibling() const; |
|
55 CWsRootWindow *Parent() const; |
|
56 void UpdateOrdinalPriority(TBool aDoAdjust); |
|
57 void LostFocus(); |
|
58 void ReceivedFocus(); |
|
59 inline RWsTextCursor *TextCursor(); |
|
60 inline TBool ReceivesFocus() const; |
|
61 static TInt NumWindowGroups(TBool aAllPriorities, TInt aPriority); |
|
62 static TInt SendWindowGroupListAndChainL(TBool aAllPriorities, TInt aPriority, TInt aCount); |
|
63 static TBool SendEventToAllGroups(TBool aAllPriorities,TBool aOnePerClient,const TWsClCmdSendEventToWindowGroup& aData); |
|
64 static void SendMessageToAllGroupsL(CWsClient& aSender,TBool aAllPriorities,const TWsClCmdSendMessageToWindowGroup& aData); |
|
65 static void GetFocusWindowGroupL(); |
|
66 virtual void SetOrdinalPosition(TInt pos); |
|
67 TBool SetOrdinalPosition(TInt pos,CWsWindowGroup *aClosingWindow); |
|
68 void SetOrdinalPriority(TInt aPos, TInt aPriority); |
|
69 void QueueMessageL(TUid aUid, TInt aDataLength, CWsClient& aSender); |
|
70 void AddPriorityKeyL(TUint aKeycode, TUint aModifierMask, TUint aModifiers); |
|
71 void RemovePriorityKey(TUint aKeycode, TUint aModifierMask, TUint aModifiers); |
|
72 void RemoveAllPriorityKeys(); |
|
73 TBool CheckForPriorityKey(const TKeyData &aKey, TInt aScanCode); |
|
74 inline CWsPointerCursor *GroupPointerCursor() const; |
|
75 static CWsWindowGroup *WindowGroupFromIdentifier(TInt aIdentifier); |
|
76 static CWsWindowGroup *WindowGroupFromIdentifierL(TInt aIdentifier); |
|
77 static CWsWindowGroup *FindWindowGroupL(CWsClient* aClient,TInt aIdentifier,TInt aOffset,const TPtrC *aMatch,const TThreadId *aThreadId); |
|
78 inline TInt Identifier() const; |
|
79 inline HBufC *GroupName(); |
|
80 inline TInt OrdinalPriority(); |
|
81 inline void SetNextDefaultOwningWindow(CWsWindowGroup *aNext); |
|
82 inline CWsWindowGroup **NextDefaultOwningWindowPtr(); |
|
83 void SetScreenDeviceValidState(const DWsScreenDevice *aDevice); |
|
84 void SetScreenChangeEventStateL(TBool aEnabled); |
|
85 TBool ScreenDeviceValid() const; |
|
86 TBool CanReceiveFocus() const; |
|
87 static void SetScreenDeviceValidStates(const DWsScreenDevice *aDevice); |
|
88 static TBool SetScreenDeviceValidStates(const TBool aScreenSizeChanged, const TBool aSwapWidthAndHeight, CScreen* aScreen); |
|
89 static void NewOrientation(TInt aMode,CFbsBitGc::TGraphicsOrientation aRotation, CWsRootWindow* aRootWindow); |
|
90 inline DWsScreenDevice *Device(); |
|
91 void FetchMessageL(); |
|
92 static inline void SetFocusGainPreprocessing(TBool aDo); |
|
93 TBool IsChained(TInt& aParentId); |
|
94 inline TInt NumWindowGroupsOnMyScreen(TInt aPriority); |
|
95 static TInt NumWindowGroupsOnScreen(const CWsWindowGroup* aGroupWin,TBool aAllPriorities,TInt aPriority); |
|
96 inline void SetScreenDeviceDeleted(); |
|
97 inline TBool ScreenDeviceDeleted() const; |
|
98 static TInt SendWindowGroupListL(TInt aScreenNumber, TBool aAllPriorities, TInt aPriority, TInt aCount); |
|
99 static void GetFocusWindowGroupL(TInt aScreenNumber); |
|
100 void SetScreenDevice(DWsScreenDevice *aDevice); |
|
101 TBool HasVisibleTranslucentChild(); |
|
102 private: |
|
103 void SwitchToOwningWindow(CWsWindowGroup *aClosingWindow); |
|
104 void MoveChainedWindows(TDblQueIter<CWsWindowGroup>& aIter,TBool aForward,TInt aPos,CWsWindowGroup* aClosingWindow); |
|
105 TBool DoSetOrdinalPosition1(TInt aPos,CWsWindowGroup *aClosingWindow); |
|
106 void DoSetOrdinalPosition2(TInt aPos,CWsWindowGroup *aClosingWindow); |
|
107 void SignalMessageReady(); |
|
108 static void AdvanceIdentifierCount(); |
|
109 void StatusDump(TDes &aBuf); |
|
110 void PurgeCapturedKeys(); |
|
111 inline void UpdateKeyClickState(); |
|
112 void ResetFocus(CWsWindowGroup *aClosingWindow); |
|
113 static TInt GetWindowGroupListL(TInt aScreenNo,TBool aAllPriorities,TInt aPriority,TInt aCount,CArrayFixFlat<TInt>* aList); |
|
114 inline CWsWindowGroup* BeforeInChain(); |
|
115 static void GetWindowGroupListAndChainL(TInt aScreen,TBool aAllPriorities,TInt aPriority |
|
116 ,RArray<RWsSession::TWindowGroupChainInfo>& list,TInt& aCountLeft); |
|
117 TBool CheckCapability(TInt& aOrdinalPriority); |
|
118 void DeleteQueue(TDblQue<CWsWindowGroup>* aQueue); |
|
119 TInt NumClientWindowGroups(); |
|
120 // data |
|
121 private: |
|
122 RWsTextCursor iTextCursor; |
|
123 TInt iFlags; |
|
124 TInt iOrdinalPriorityBase; |
|
125 TInt iOrdinalPriorityAdjust; |
|
126 TPriorityKey *iPriorityKeys; |
|
127 TInt iOwningWindowGroup; |
|
128 HBufC *iGroupName; |
|
129 TInt iIdentifier; |
|
130 CWsWindowGroup *iNextDefaultOwningWindow; |
|
131 CArrayVarSeg<TWsMessage> *iMessageArray; |
|
132 static TInt iIdentifierCount; |
|
133 DWsScreenDevice *iScreenDevice; |
|
134 static RPointerArray< TDblQue<CWsWindowGroup> > iChains; |
|
135 TDblQue<CWsWindowGroup>* iQueue; |
|
136 TDblQueLink iChainLink; |
|
137 TUint32 iChildSID; |
|
138 static TBool iFocusGainPreProcess; //'REMOVEFADINGONFOCUSGAIN' flag in INI file |
|
139 // used for eventqueue testing |
|
140 #if defined(_DEBUG) |
|
141 static TInt iSkipCount; |
|
142 #endif |
|
143 friend class WsPointer; |
|
144 }; |
|
145 |
|
146 inline CWsClientWindow *CWsWindowGroup::Child() const |
|
147 { |
|
148 return (CWsClientWindow *)iChild; |
|
149 } |
|
150 |
|
151 inline CWsWindowGroup *CWsWindowGroup::NextSibling() const |
|
152 { |
|
153 return (CWsWindowGroup *)iSibling; |
|
154 } |
|
155 |
|
156 inline CWsWindowGroup *CWsWindowGroup::PrevSibling() const |
|
157 { |
|
158 return (CWsWindowGroup *)GetPrevSibling(); |
|
159 } |
|
160 |
|
161 inline CWsRootWindow *CWsWindowGroup::Parent() const |
|
162 { |
|
163 return (CWsRootWindow *)iParent; |
|
164 } |
|
165 |
|
166 inline TBool CWsWindowGroup::ReceivesFocus() const |
|
167 { |
|
168 return(iFlags&EGroupFlagReceivesFocus); |
|
169 } |
|
170 |
|
171 inline RWsTextCursor *CWsWindowGroup::TextCursor() |
|
172 { |
|
173 return &iTextCursor; |
|
174 } |
|
175 |
|
176 inline TInt CWsWindowGroup::Identifier() const |
|
177 { |
|
178 return iIdentifier; |
|
179 } |
|
180 |
|
181 inline HBufC *CWsWindowGroup::GroupName() |
|
182 { |
|
183 return iGroupName; |
|
184 } |
|
185 |
|
186 inline TInt CWsWindowGroup::OrdinalPriority() |
|
187 { |
|
188 return iOrdinalPriorityBase; |
|
189 } |
|
190 |
|
191 inline void CWsWindowGroup::SetNextDefaultOwningWindow(CWsWindowGroup *aNext) |
|
192 { |
|
193 iNextDefaultOwningWindow=aNext; |
|
194 } |
|
195 |
|
196 inline CWsWindowGroup **CWsWindowGroup::NextDefaultOwningWindowPtr() |
|
197 { |
|
198 return &iNextDefaultOwningWindow; |
|
199 } |
|
200 |
|
201 /** |
|
202 @return A pointer to the DWsScreenDevice used by this window-group, or |
|
203 NULL when there is no DWsScreenDevice used by the window-group. |
|
204 */ |
|
205 inline DWsScreenDevice *CWsWindowGroup::Device() |
|
206 { |
|
207 return iScreenDevice; |
|
208 } |
|
209 |
|
210 inline void CWsWindowGroup::SetFocusGainPreprocessing(TBool aDo) |
|
211 { |
|
212 iFocusGainPreProcess=aDo; |
|
213 } |
|
214 |
|
215 inline void CWsWindowGroup::SetScreenDeviceDeleted() |
|
216 { |
|
217 iFlags|=EGroupFlagScreenDeviceDeleted; |
|
218 iScreenDevice = NULL; // PDEF100409 |
|
219 } |
|
220 |
|
221 inline TBool CWsWindowGroup::ScreenDeviceDeleted() const |
|
222 { |
|
223 return (iFlags&EGroupFlagScreenDeviceDeleted); |
|
224 } |
|
225 |
|
226 #endif |