|
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 // WsPointer and associated classes definitions |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __POINTER_H__ |
|
19 #define __POINTER_H__ |
|
20 |
|
21 #include "server.h" |
|
22 |
|
23 class CWsPointerTimer : public CTimer |
|
24 { |
|
25 public: |
|
26 CWsPointerTimer(); |
|
27 void ConstructL(); |
|
28 private: |
|
29 void RunL(); |
|
30 }; |
|
31 |
|
32 class WsPointer |
|
33 { |
|
34 enum {EPointerUpdateGapInMicroSeconds=50000}; |
|
35 public: |
|
36 static void InitStaticsL(); |
|
37 static void DeleteStatics(); |
|
38 static inline TPointerCursorMode PointerCursorMode(); |
|
39 static inline void SetPointerCursorMode(TPointerCursorMode aMode); |
|
40 static inline TPoint PointerCursorPos(); |
|
41 static void SetPointerCursorPos(TPoint aPos); |
|
42 static void ReLogCurrentWindow(); |
|
43 static void ReLogCurrentWindow(TPoint &aPos, TPoint &aParentPos, const CWsWindowGroup *aForceInGroup); |
|
44 static void ReLogWindow(const CWsWindow *aWin); |
|
45 static void WindowDisconected(const CWsWindow *deletedWindow); |
|
46 static void ClaimGrab(const CWsWindow *aWindow, TBool aSendUpEvent); |
|
47 #if defined(__WINS__) |
|
48 static TBool PreProcessEvent(TRawEvent &aRawEvent,TBool aFromHardware=EFalse); |
|
49 #else |
|
50 static TBool PreProcessEvent(TRawEvent &aRawEvent); |
|
51 #endif |
|
52 static void ProcessEvent(TPointerEvent::TType type, const TPoint &aPos, TUint aModifiers |
|
53 ,const CWsWindowGroup *aForceInGroup,TBool aNatural); |
|
54 static void GetDoubleClickSettings(TTimeIntervalMicroSeconds32 &aTime, TInt &aDistance); |
|
55 static void SetDoubleClick(const TTimeIntervalMicroSeconds32 &aTime, TInt aDistance); |
|
56 static void UpdatePointerCursor(); |
|
57 static void RequestPointerRepeatEvent(CWsWindow *aWindow, TTimeIntervalMicroSeconds32 aTime,const TRect &aRect); |
|
58 static void CancelPointerRepeatEventRequest(); |
|
59 static void RepeatTimerCompleted(); |
|
60 static TEventQueueWalkRet PointerRepeatPurgeCheck(const TWsEvent *aEvent); |
|
61 static void UnmatchedDownPurged(TPointerEvent::TType aPointerType, TUint aHandle); |
|
62 static void TimerExpired(); |
|
63 static inline TBool XyInput(); |
|
64 #if defined(__WINS__) |
|
65 static void SetXyInputType(TXYInputType aXyInputType); |
|
66 #endif |
|
67 private: |
|
68 static void PointerCursorUpdateCheck(); |
|
69 static void ProcessForegroundCheck(); |
|
70 static void RestrictPos(TPoint& aPos,TBool aWithinDrawableArea=ETrue); |
|
71 static void ProcessEvent(TWsEvent& aEvent); |
|
72 static TBool PointerEventRepeatCheck(const TWsEvent *aEvent, TUint32 aHandle); |
|
73 static void SendEnterExitEvent(TEventCode aType); |
|
74 static void SetCurrentWindow(const CWsWindow *aWin); |
|
75 static void ProcessPointerEvent(TWsEvent& aEvent); |
|
76 static TBool QueuePointerEvent(const CWsWindow *aWindow, TWsEvent &event); |
|
77 static TBool CheckDownEventPurged(TPointerEvent::TType aType); |
|
78 static void UpdatePointerCursorTo(CWsPointerCursor* aNewCursor); |
|
79 static CWsPointerCursor* CalculatePointerCursor(); |
|
80 static inline TBool MovesAvailable(); |
|
81 static inline TBool DeltaMouse(); |
|
82 private: |
|
83 static TPoint iCurrentPos; |
|
84 static TBool iPointerDown; // Maps onto button1 down on multi button systems |
|
85 static TXYInputType iXyInputType; |
|
86 static const CWsWindow *iCurrentWindow; |
|
87 static const CWsWindow *iGrabWindow; |
|
88 static const CWsWindow *iActualWinPointerIsOver; |
|
89 static const CWsWindow *iPrevClickWindow; |
|
90 static TPoint iPrevClickPos; |
|
91 static TTime iPrevClickTime; |
|
92 static TPointerEvent::TType iPrevClickEventType; |
|
93 static TTimeIntervalMicroSeconds32 iDoubleClickMaxInterval; |
|
94 static TInt iDoubleClickMaxDistance; |
|
95 static CWsPointerCursor *iCursorSprite; |
|
96 static CWsPointerTimer *iRepeatTimer; |
|
97 static TPointerCursorMode iPointerCursorMode; |
|
98 static CWsWindow *iRepeatWindow; |
|
99 static TRect iRepeatRect; |
|
100 static TUint iLastUnmatchedDown1; |
|
101 static TUint iLastUnmatchedDown2; |
|
102 static TUint iLastUnmatchedDown3; |
|
103 static TBool iTimerQueued; |
|
104 static TBool iUpdateRequired; |
|
105 static CPeriodic *iPeriodicTimer; |
|
106 static CWsRootWindow* iRootWindow; // uses |
|
107 }; |
|
108 |
|
109 class CWsPointerBuffer : public CBase |
|
110 { |
|
111 public: |
|
112 ~CWsPointerBuffer(); |
|
113 static void ConnectL(CWsClientWindow *aWindow, TInt aMaxPoints, TUint aFlags); |
|
114 static void Disconnect(CWsClientWindow *aWindow); |
|
115 static void PointerEvent(CWsClientWindow *aWindow,const TPoint &aPoint); |
|
116 static void RetrievePointerMoveBuffer(CWsClientWindow *aWindow,TInt aMaxPoints); |
|
117 static void DiscardPointerMoveBuffer(CWsClientWindow *aWindow); |
|
118 static void DiscardPointerMoveBuffer(TUint aHandle); |
|
119 private: |
|
120 static void AdjustMaxSizeL(); |
|
121 static void Reset(); |
|
122 static void SignalBufferReady(); |
|
123 private: |
|
124 CWsClientWindow *iWindow; |
|
125 TInt iMaxPoints; |
|
126 TInt iFlags; |
|
127 TSglQueLink iQue; |
|
128 static TBool iSignalled; |
|
129 static CWsPointerBuffer *iCurrentBuffer; |
|
130 static CCirBuf<TPoint> *iPointerBuffer; |
|
131 static TSglQue<CWsPointerBuffer> iList; |
|
132 }; |
|
133 |
|
134 |
|
135 inline void WsPointer::SetPointerCursorMode(TPointerCursorMode aMode) |
|
136 { |
|
137 iPointerCursorMode=aMode; |
|
138 } |
|
139 |
|
140 inline TPointerCursorMode WsPointer::PointerCursorMode() |
|
141 { |
|
142 return iPointerCursorMode; |
|
143 } |
|
144 |
|
145 inline TPoint WsPointer::PointerCursorPos() |
|
146 { |
|
147 return iCurrentPos; |
|
148 } |
|
149 |
|
150 inline TBool WsPointer::XyInput() |
|
151 { |
|
152 return iXyInputType!=EXYInputNone; |
|
153 } |
|
154 |
|
155 inline TBool WsPointer::MovesAvailable() |
|
156 { |
|
157 return (iXyInputType!=EXYInputNone && iXyInputType!=EXYInputPointer); |
|
158 } |
|
159 |
|
160 inline TBool WsPointer::DeltaMouse() |
|
161 { |
|
162 return (iXyInputType==EXYInputDeltaMouse); |
|
163 } |
|
164 |
|
165 #endif |