1 /* |
|
2 * Copyright (c) 2006 - 2007 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: AppUi class of the application. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef TOUCHSCREENCALIBAPPUI_H |
|
20 #define TOUCHSCREENCALIBAPPUI_H |
|
21 |
|
22 // SYSTEM INCLUDES |
|
23 #include <aknappui.h> |
|
24 #include <coecntrl.h> |
|
25 #include <StringLoader.h> |
|
26 #include <aknPopup.h> |
|
27 #include <aknlists.h> |
|
28 #include <badesca.h> |
|
29 #include <AknDef.h> |
|
30 #include <e32hal.h> |
|
31 |
|
32 // CONSTANTS |
|
33 const TInt KConvertGetCase = 0; |
|
34 const TInt KConvertSaveCase = 1; |
|
35 |
|
36 const TInt KUnknownOrientation = 0; |
|
37 const TInt KPortraitOrientation = 1; |
|
38 const TInt KLandscapeOrientation = 2; |
|
39 |
|
40 // FORWARD DECLARATIONS |
|
41 class TTouchScreenCalibLayout |
|
42 { |
|
43 public: |
|
44 TAknLayoutRect iAnimImageLayout1; |
|
45 TAknLayoutRect iAnimImageLayout2; |
|
46 TAknLayoutRect iAnimImageLayout3; |
|
47 TAknLayoutRect iAnimImageLayout4; |
|
48 }; |
|
49 |
|
50 class CTouchScreenCalibView; |
|
51 class CTouchScreenCalibPubSubObserver; |
|
52 /** |
|
53 * 'AppUi' class. |
|
54 * |
|
55 */ |
|
56 class CTouchScreenCalibAppUi : public CAknAppUi, CCoeControl |
|
57 { |
|
58 public: // Constructors and destructor |
|
59 |
|
60 /** |
|
61 * C++ default constructor. |
|
62 */ |
|
63 CTouchScreenCalibAppUi(); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 ~CTouchScreenCalibAppUi(); |
|
69 |
|
70 // from CCoeAppUiBase |
|
71 void PrepareToExit(); |
|
72 |
|
73 /** |
|
74 * Handles key events |
|
75 * @param TKeyEvent key event |
|
76 * @param TEventCode event code |
|
77 * @since S60 3.2 |
|
78 */ |
|
79 void HandleKeyL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
80 |
|
81 /** |
|
82 * Handles pointer events |
|
83 * @param TPoint co-ordinates |
|
84 * @since S60 3.2 |
|
85 */ |
|
86 void HandlePointerL( TPoint aPos ); |
|
87 |
|
88 /** |
|
89 * Check current point number |
|
90 * @since S60 3.2 |
|
91 * @return TInt, point number |
|
92 */ |
|
93 TInt GetCalibrationStep(); |
|
94 |
|
95 /** |
|
96 * Get rect of current tap animation or image |
|
97 * @since S60 3.2 |
|
98 * @param TInt, point number |
|
99 * @return TRect, animation or image rect. |
|
100 */ |
|
101 TRect GetAnimImageRect(TInt aPointNumber = 0); |
|
102 |
|
103 /** |
|
104 * From CAknAppUi, called when screen layout changes |
|
105 */ |
|
106 void HandleScreenDeviceChangedL(); |
|
107 |
|
108 /** |
|
109 * Check if first boot is going on |
|
110 * @since S60 3.2 |
|
111 * @return. ETrue if first boot, otherwise EFalse |
|
112 */ |
|
113 TBool FirstBoot(); |
|
114 |
|
115 protected: |
|
116 /* |
|
117 * Handles changes to the application when it |
|
118 * switches to or from the foreground. |
|
119 */ |
|
120 virtual void HandleForegroundEventL(TBool aForeground); |
|
121 |
|
122 private: |
|
123 /** |
|
124 * EPOC default constructor. |
|
125 */ |
|
126 void ConstructL(); |
|
127 |
|
128 /** |
|
129 * Update display |
|
130 * @since S60 3.2 |
|
131 */ |
|
132 void UpdateL(); |
|
133 |
|
134 /** |
|
135 * Checks layout orientation |
|
136 * @since S60 3.2 |
|
137 * @return TBool. ETrue if orientation same in driver native level and window level |
|
138 */ |
|
139 TBool IsCorrectOrientation(TRect aRect); |
|
140 |
|
141 /** |
|
142 * Convert calibration or tapped points to different layout orientation |
|
143 * @since S60 3.2 |
|
144 * @param Points |
|
145 * @param Convert case. |
|
146 * @return Calibration points. KConvertGetCase or KConvertSaveCase. |
|
147 */ |
|
148 TDigitizerCalibration ConvertToCorrectOrientation(TDigitizerCalibration aPoints, |
|
149 TInt aConvertCase); |
|
150 /** |
|
151 * Get calibration points |
|
152 * @since S60 3.2 |
|
153 * @return Calibration points |
|
154 */ |
|
155 TDigitizerCalibration CalibrationPoints(); |
|
156 |
|
157 /** |
|
158 * Change to next calibration point |
|
159 * @since S60 3.2 |
|
160 */ |
|
161 void NextCalibrationStepL(); |
|
162 |
|
163 /** |
|
164 * Saves calibration |
|
165 * @since S60 3.2 |
|
166 */ |
|
167 void SaveCalibration(); |
|
168 |
|
169 /** |
|
170 * Restart calibration at first point |
|
171 * @since S60 3.2 |
|
172 */ |
|
173 void ResetCalibrationStepsL(); |
|
174 |
|
175 /** |
|
176 * Sets tap points to 0 values |
|
177 * @since S60 3.2 |
|
178 */ |
|
179 void ResetTapPoints(); |
|
180 |
|
181 TDigitizerCalibration ChangeOrientation(TDigitizerCalibration aSourcePoints, |
|
182 TPoint aDestReso); |
|
183 |
|
184 |
|
185 void SetOrientation(); |
|
186 |
|
187 private: //Data |
|
188 CTouchScreenCalibView* iTouchScreenCalibView; //owns |
|
189 CTouchScreenCalibPubSubObserver* iTouchScreenCalibPubSubObserver; //owns |
|
190 TDigitizerCalibration iCalibrationPoints; |
|
191 TDigitizerCalibration iTapPoints; |
|
192 TInt iCurrentCalibrationStep; |
|
193 TBool iExitting; |
|
194 TTouchScreenCalibLayout iTouchScreenCalibLayout; |
|
195 TBool iCalibrationDone; |
|
196 TInt iNativeOrientation; |
|
197 TBool iCalibrationCancel; |
|
198 }; |
|
199 |
|
200 #endif // TOUCHSCREENCALIBAPPUI_H |
|
201 |
|
202 // End of file |
|