|
1 /* |
|
2 * Copyright (c) 2009 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: THIS FILE IS NOT INCLUDED INTO ECLIPSE CVS DELIVERY |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <aknphysics.h> |
|
21 #include "swtphysics.h" |
|
22 #include <w32std.h> |
|
23 |
|
24 |
|
25 // --------------------------------------------------------------------------- |
|
26 // SwtPhysicsInstanceImpl |
|
27 // Implementing SwtPhysicsInstance |
|
28 //---------------------------------------------------------------------------- |
|
29 // |
|
30 EXPORT_C MSwtPhysics* SwtPhysicsLibEntryL(MSwtPhysicsObserver& aObserver, CCoeControl& aControl) |
|
31 { |
|
32 return CSwtPhysics::NewL(aObserver, aControl); |
|
33 } |
|
34 |
|
35 |
|
36 // ======== MEMBER FUNCTIONS ======== |
|
37 |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // CSwtPhysics::NewL |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 |
|
44 CSwtPhysics* CSwtPhysics::NewL(MSwtPhysicsObserver& aObserver, CCoeControl& aControl) |
|
45 { |
|
46 CSwtPhysics* self = new(ELeave) CSwtPhysics(aObserver, aControl); |
|
47 CleanupStack::PushL(self); |
|
48 self->ConstructL(); |
|
49 CleanupStack::Pop(self); |
|
50 return self; |
|
51 } |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // CSwtPhysics::~CSwtPhysics |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 CSwtPhysics::~CSwtPhysics() |
|
58 { |
|
59 delete iPhysics; |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // From MSwtPhysics |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 void CSwtPhysics::InitPhysicsL(const TSize& aWorldSize, const TSize& aViewSize, |
|
67 TBool aLandscape) |
|
68 { |
|
69 iPhysics->InitPhysicsL(aWorldSize, aViewSize, aLandscape); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // From MSwtPhysics |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 TBool CSwtPhysics::StartPhysics(TPoint& aDrag, const TTime& aStartTime) |
|
77 { |
|
78 return iPhysics->StartPhysics(aDrag, aStartTime); |
|
79 } |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // From MSwtPhysics |
|
83 // --------------------------------------------------------------------------- |
|
84 // |
|
85 void CSwtPhysics::StopPhysics() |
|
86 { |
|
87 iPhysics->StopPhysics(); |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 // From MSwtPhysics |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 TInt CSwtPhysics::OngoingPhysicsAction() const |
|
95 { |
|
96 return iPhysics->OngoingPhysicsAction(); |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------------------------- |
|
100 // From MSwtPhysics |
|
101 // --------------------------------------------------------------------------- |
|
102 // |
|
103 void CSwtPhysics::RegisterPanningPosition(const TPoint& aDelta) |
|
104 { |
|
105 iPhysics->RegisterPanningPosition(aDelta); |
|
106 } |
|
107 |
|
108 // --------------------------------------------------------------------------- |
|
109 // From MSwtPhysics |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 TInt CSwtPhysics::HighlightTimeout() const |
|
113 { |
|
114 return iPhysics->HighlightTimeout(); |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // From MSwtPhysics |
|
119 // --------------------------------------------------------------------------- |
|
120 // |
|
121 TInt CSwtPhysics::DragThreshold() const |
|
122 { |
|
123 return iPhysics->DragThreshold(); |
|
124 } |
|
125 |
|
126 // --------------------------------------------------------------------------- |
|
127 // CSwtPhysics::FeatureEnabled |
|
128 // From MSwtPhysics |
|
129 // --------------------------------------------------------------------------- |
|
130 // |
|
131 TBool CSwtPhysics::FeatureEnabled() |
|
132 { |
|
133 return CAknPhysics::FeatureEnabled(); |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // CSwtPhysics::ViewPositionChanged |
|
138 // From MAknPhysicsObserver |
|
139 // --------------------------------------------------------------------------- |
|
140 // |
|
141 void CSwtPhysics::ViewPositionChanged(const TPoint& aNewPosition, TBool aDrawNow, |
|
142 TUint aFlags) |
|
143 { |
|
144 iObserver.ViewPositionChanged(aNewPosition, aDrawNow, aFlags); |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // CSwtPhysics::ViewPositionChanged |
|
149 // From MAknPhysicsObserver |
|
150 // --------------------------------------------------------------------------- |
|
151 // |
|
152 void CSwtPhysics::ViewPositionChanged(const TPoint& aNewPosition) |
|
153 { |
|
154 iObserver.ViewPositionChanged(aNewPosition, ETrue, 0); |
|
155 } |
|
156 |
|
157 // --------------------------------------------------------------------------- |
|
158 // CSwtPhysics::PhysicEmulationEnded |
|
159 // From MAknPhysicsObserver |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 void CSwtPhysics::PhysicEmulationEnded() |
|
163 { |
|
164 iObserver.PhysicEmulationEnded(); |
|
165 } |
|
166 |
|
167 // --------------------------------------------------------------------------- |
|
168 // CSwtPhysics::ViewPosition |
|
169 // From MAknPhysicsObserver |
|
170 // --------------------------------------------------------------------------- |
|
171 // |
|
172 TPoint CSwtPhysics::ViewPosition() const |
|
173 { |
|
174 return iObserver.ViewPosition(); |
|
175 } |
|
176 |
|
177 // --------------------------------------------------------------------------- |
|
178 // CSwtPhysics::CSwtPhysics |
|
179 // --------------------------------------------------------------------------- |
|
180 // |
|
181 CSwtPhysics::CSwtPhysics(MSwtPhysicsObserver& aObserver, CCoeControl& aControl) |
|
182 : CBase() |
|
183 , iControl(aControl) |
|
184 , iObserver(aObserver) |
|
185 { |
|
186 } |
|
187 |
|
188 // --------------------------------------------------------------------------- |
|
189 // CSwtPhysics::ConstructL |
|
190 // --------------------------------------------------------------------------- |
|
191 // |
|
192 void CSwtPhysics::ConstructL() |
|
193 { |
|
194 iPhysics = CAknPhysics::NewL(*this, &iControl); |
|
195 } |