|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Scrollable control adapter |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __XNSCROLLABLECONTROLADAPTER_H__ |
|
19 #define __XNSCROLLABLECONTROLADAPTER_H__ |
|
20 |
|
21 // INCLUDES |
|
22 #include "xncontroladapter.h" |
|
23 #include <e32base.h> |
|
24 #include <aknphysicsobserveriface.h> |
|
25 #include <coeccntx.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CXnNodePluginIf; |
|
29 class CXnUiEngine; |
|
30 class CXnNode; |
|
31 class CAknPhysics; |
|
32 |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * @ingroup group_xnlayoutengine |
|
38 * Popup Control adapter interface class |
|
39 * @lib xnlayoutengine.lib |
|
40 * @since Series 60 5.0 |
|
41 */ |
|
42 NONSHARABLE_CLASS( CXnScrollableControlAdapter ) : public CXnControlAdapter, |
|
43 public MAknPhysicsObserver, public MCoeControlContext, public MCoeControlHitTest |
|
44 { |
|
45 public: // Constructors and destructor |
|
46 /** |
|
47 * Two-phased constructor. |
|
48 */ |
|
49 static CXnScrollableControlAdapter* NewL( CXnNodePluginIf& aNode ); |
|
50 |
|
51 /** |
|
52 * Destructor. |
|
53 */ |
|
54 ~CXnScrollableControlAdapter(); |
|
55 |
|
56 private: // Functions from base classes |
|
57 |
|
58 /** |
|
59 * see CCoeControl |
|
60 */ |
|
61 void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
62 |
|
63 /** |
|
64 * see CCoeControl |
|
65 */ |
|
66 void Draw(const TRect& aRect) const; |
|
67 |
|
68 /** |
|
69 * see CCoeControl |
|
70 */ |
|
71 void SizeChanged(); |
|
72 |
|
73 /** |
|
74 * @see CCoeControl documentation |
|
75 */ |
|
76 void MakeVisible( TBool aVisible ); |
|
77 |
|
78 /** |
|
79 * @see MCoeControlHitTest documentation |
|
80 */ |
|
81 TBool HitRegionContains( const TPoint& aPoint, const CCoeControl& aControl) const; |
|
82 |
|
83 /** |
|
84 * @see CXnControlAdapter documentation |
|
85 */ |
|
86 void HandleScreenDeviceChangedL(); |
|
87 |
|
88 public: // New functions |
|
89 /** |
|
90 * Returns Called when view position changes. |
|
91 * |
|
92 * @param aNewPosition New view position. |
|
93 */ |
|
94 const TPoint DeltaPosition() const; |
|
95 |
|
96 /** |
|
97 * Reset state. |
|
98 * |
|
99 */ |
|
100 void ResetState(); |
|
101 |
|
102 /** |
|
103 * Scroll box so that the given node is shown. |
|
104 * |
|
105 */ |
|
106 void ShowItem( CXnNode& aNode ); |
|
107 |
|
108 /** |
|
109 * Layout has changed somewhere. Act if needed. |
|
110 * |
|
111 */ |
|
112 void LayoutChangedL(); |
|
113 |
|
114 public: // Functions from base classes |
|
115 /** |
|
116 * From MAknPhysicsObserver. |
|
117 * |
|
118 * Physics emulation has moved the view. |
|
119 * |
|
120 * When this method is called client should update its visual and logical |
|
121 * states to reflect the changes caused by view move. Note that if the |
|
122 * parameter @c aDrawNow is @c EFalse client is not allowed to redraw the |
|
123 * display but should only update its logical state. |
|
124 * Physics engine will ensure that the last frame is always drawn. |
|
125 * |
|
126 * @since S60 v5.0 |
|
127 * |
|
128 * @param aNewPosition The new position of the view. |
|
129 * @param aDrawNow @c ETrue if client should redraw the screen, |
|
130 * otherwise @c EFalse. |
|
131 * @param aFlags Additional flags, not used currently. |
|
132 */ |
|
133 void ViewPositionChanged( const TPoint& aNewPosition, |
|
134 TBool aDrawNow, TUint aFlags ); |
|
135 |
|
136 /** |
|
137 * From MAknPhysicsObserver. |
|
138 * Called when emulation ended. |
|
139 */ |
|
140 void PhysicEmulationEnded(); |
|
141 |
|
142 /** |
|
143 * From MAknPhysicsObserver. |
|
144 * Returns the observer view position. |
|
145 * |
|
146 * @return Physics observer view position. |
|
147 */ |
|
148 TPoint ViewPosition() const; |
|
149 |
|
150 /** |
|
151 * see MCoeControlContext |
|
152 */ |
|
153 void ResetContext( CWindowGc& aGc ) const; |
|
154 |
|
155 private: // Constructors |
|
156 /** |
|
157 * C++ default constructor. |
|
158 */ |
|
159 CXnScrollableControlAdapter( CXnNodePluginIf& aNode ); |
|
160 |
|
161 /** |
|
162 * Two-phased constructor. |
|
163 */ |
|
164 void ConstructL(); |
|
165 |
|
166 private: // New functions |
|
167 void ReadPropertiesL(); |
|
168 void InitPhysicEngineL(); |
|
169 |
|
170 private: // Data |
|
171 /** |
|
172 * UiEngine. |
|
173 * Not owned. |
|
174 */ |
|
175 CXnUiEngine* iUiEngine; |
|
176 |
|
177 /** |
|
178 * Layout node. |
|
179 */ |
|
180 CXnNodePluginIf& iNode; |
|
181 |
|
182 /** |
|
183 * Physics. |
|
184 * Own. |
|
185 */ |
|
186 CAknPhysics* iPhysics; |
|
187 |
|
188 /** |
|
189 * Pointer down start time. |
|
190 */ |
|
191 TTime iStartTime; |
|
192 |
|
193 /** |
|
194 * Start (pointer down) position. |
|
195 */ |
|
196 TPoint iStartPosition; |
|
197 |
|
198 /** |
|
199 * Position at previous pointer event. |
|
200 */ |
|
201 TPoint iPreviousPosition; |
|
202 |
|
203 /** |
|
204 * Current view position. |
|
205 */ |
|
206 TPoint iCurrentPosition; |
|
207 |
|
208 /** |
|
209 * View position at the beginning. |
|
210 */ |
|
211 TPoint iStartViewPosition; |
|
212 |
|
213 /** |
|
214 * Current pointer position. |
|
215 */ |
|
216 TPoint iStylusPosition; |
|
217 |
|
218 /** |
|
219 * Visible area, i.e. area of the scollable control that is to be drawn. |
|
220 */ |
|
221 TRect iViewPort; |
|
222 |
|
223 /** |
|
224 * True, if layout has been changed and engine needs to be reset. |
|
225 */ |
|
226 TBool iLayoutChanged; |
|
227 }; |
|
228 |
|
229 #endif // __XNSCROLLABLECONTROLADAPTER_H__ |
|
230 |
|
231 // End of File |