|
1 /* |
|
2 * Copyright (c) 2002 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: Header file of "editor sub-pane", CCalcEditorSubPane class |
|
15 * which derived from CCoeControl class. Role of this class |
|
16 * is to draw editor. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef CALCEDIT_H |
|
22 #define CALCEDIT_H |
|
23 |
|
24 |
|
25 // INCLUDES |
|
26 #include <coecntrl.h> |
|
27 #include <AknUtils.h> // for TAknLayoutRect |
|
28 |
|
29 #include "CalcView.h" |
|
30 #include "CalcEnv.h" |
|
31 #include <PtiDefs.h> |
|
32 #include <centralrepository.h> |
|
33 #include <cenrepnotifyhandler.h> |
|
34 #include <e32property.h> |
|
35 #endif |
|
36 |
|
37 // CONSTANTS |
|
38 const TInt KCalcCountOfEditorComponent(6); |
|
39 _LIT(KAllowedDecimal, ".,"); |
|
40 |
|
41 // FORWARD DECLARATIONS |
|
42 class CCalcContainer; |
|
43 class CPtiEngine; |
|
44 class CPtiQwertyKeyMappings; |
|
45 class CPtiCoreLanguage; |
|
46 //class CCalcAppEnv; |
|
47 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
48 class CPtiHalfQwertyKeyMappings; |
|
49 #endif |
|
50 |
|
51 // CLASS DEFINITIONS |
|
52 |
|
53 /** |
|
54 CCalcEditorSubPane : 'Editor Sub-Pane' class |
|
55 */ |
|
56 |
|
57 class CCalcEditorSubPane |
|
58 :public CCoeControl |
|
59 { |
|
60 // Enlarge size for rect. |
|
61 public: |
|
62 enum RectEnlargeSizeID |
|
63 { |
|
64 EEnlargeFive = 5, |
|
65 EEnlargeTwenty = 20 |
|
66 }; |
|
67 |
|
68 public: // Constructors and destructor |
|
69 /** |
|
70 * Two-phased constructor. |
|
71 * @param aContainer : Pointer of CCalcContainer class |
|
72 */ |
|
73 static CCalcEditorSubPane* NewL(CCalcContainer* aContainer); |
|
74 |
|
75 /** |
|
76 * Destructor. |
|
77 */ |
|
78 virtual ~CCalcEditorSubPane(); |
|
79 |
|
80 |
|
81 public: // New functions |
|
82 /** |
|
83 * Return curent value of editor |
|
84 * @return Reference of TCalcEditLine : curent value of editor |
|
85 */ |
|
86 const TCalcEditLine& EditLine() const; |
|
87 |
|
88 /** |
|
89 * Set operator to editor. |
|
90 * @param aType : new operator type. |
|
91 */ |
|
92 void SetOperator(TCalcEditLine::TCalcOperatorType aType); |
|
93 |
|
94 /** |
|
95 * Set TReal64 type editor number. |
|
96 * @param aNewNumber : new editor number. |
|
97 */ |
|
98 void SetEditorNumber(TReal64 aNewNumber); |
|
99 |
|
100 /** |
|
101 * Return curent editor number. |
|
102 * @return TReal64 type editor number. |
|
103 */ |
|
104 TReal64 EditorNumber() const; |
|
105 |
|
106 /** |
|
107 * Number of editor is set "0" and operator is set none. |
|
108 */ |
|
109 void ResetL(); |
|
110 |
|
111 /** |
|
112 * Operand of editor is erased. |
|
113 */ |
|
114 void ClearOperand(); |
|
115 |
|
116 /** |
|
117 * Clear latest input from editor. |
|
118 */ |
|
119 void ClearLastInputL(); |
|
120 |
|
121 /** |
|
122 * Handle short-press-clear-key and CBA-clear-key event. |
|
123 */ |
|
124 void OfferShortPressClearKeyEventL(); |
|
125 |
|
126 /** |
|
127 * Changing sign. |
|
128 * @param aState : Current state of Calculator |
|
129 */ |
|
130 void DoChangeSignL(CCalcView::TStateNo aState); |
|
131 |
|
132 /** |
|
133 * Update editor number to memory or last result. |
|
134 * @param aMemory : memory or last result |
|
135 * @param aState : Current state of Calculator |
|
136 */ |
|
137 void DoMemoryRecallOrLastResult( |
|
138 TReal64 aMemoryOrLastResult, |
|
139 CCalcView::TStateNo aState); |
|
140 |
|
141 /** |
|
142 * Notify changing decimal separator. |
|
143 * @param aOld : Old decimal separator |
|
144 * @param aNew : New decimal separator |
|
145 */ |
|
146 void NotifyChangeDecimal(TChar aOld, TChar aNew); |
|
147 |
|
148 /** |
|
149 * Gets the layout of the EditPane. |
|
150 * Used for touch support. |
|
151 */ |
|
152 TRect EditPaneRect(); |
|
153 |
|
154 /** |
|
155 * HandlePointerEventL |
|
156 * Handles pen inputs of Editor pane. |
|
157 */ |
|
158 void HandlePointerEventL(const TPointerEvent& aPointerEvent ); |
|
159 |
|
160 public: // Functions from base classes |
|
161 /** |
|
162 |
|
163 /** |
|
164 * Called to find key pad is Active. |
|
165 * |
|
166 */ |
|
167 TInt IsQwertyKeypadActive(); |
|
168 |
|
169 /* From CCoeControl : Handling key event |
|
170 * @param aKeyEvent : The key event |
|
171 * @param aType : The type of the event |
|
172 * @return EKeyWasConsumed : Key event is used. |
|
173 * EKeyWasNotConsumed : Key event is not used. |
|
174 */ |
|
175 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); |
|
176 |
|
177 /** |
|
178 * Refresh the display bitmap when the skin change event has occured. |
|
179 */ |
|
180 inline void RefreshDisplaySideLBitmap(); |
|
181 inline void RefreshDisplayCenterBitmap(); |
|
182 inline void RefreshDisplaySideRBitmap(); |
|
183 |
|
184 private: // NewFunctions |
|
185 /** |
|
186 * C++ default constructor. |
|
187 */ |
|
188 CCalcEditorSubPane(); |
|
189 |
|
190 /** |
|
191 * Second-phase constructor. |
|
192 * @param aContainer : Pointer of CCalcContainer class |
|
193 */ |
|
194 void ConstructL(CCalcContainer* aContainer); |
|
195 |
|
196 /** |
|
197 * Delete the latest input |
|
198 */ |
|
199 void ClearL(); // Delete the latest input |
|
200 |
|
201 private: // Functions from base classes |
|
202 /** |
|
203 * From CCoeControl : Size of control is set. |
|
204 */ |
|
205 void SizeChanged(); |
|
206 |
|
207 /** |
|
208 * From CCoeControl : Draw editor |
|
209 * @param aRect : rectangle of editor space. |
|
210 */ |
|
211 void Draw(const TRect& aRect) const; |
|
212 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
213 TBool MapDecimal( TKeyEvent aKeyEvent ); |
|
214 #else |
|
215 TBool MapDecimal(TPtiKey aKey, TPtiTextCase aCase); |
|
216 #endif |
|
217 |
|
218 private: // Data |
|
219 |
|
220 const CGulIcon* iCalcSideLDisplay; |
|
221 const CGulIcon* iCalcCenterDisplay; |
|
222 const CGulIcon* iCalcSideRDisplay; |
|
223 TAknLayoutRect iSideLDisplayLayout; |
|
224 TAknLayoutRect iCenterDisplayLayout; |
|
225 TAknLayoutRect iSideRDisplayLayout; |
|
226 |
|
227 CCalcContainer* iCalcContainer; // Not own |
|
228 CCalcAppEnv* iCalcAppEnv; // Not own |
|
229 TCalcEditLine iEditLine; // editor data |
|
230 TReal64 iEditorNumber; |
|
231 TInt iIsQwertyActive; |
|
232 CPtiEngine* iEngine; |
|
233 CRepository* iCRKey; |
|
234 CPtiCoreLanguage* iCoreLanguage; |
|
235 CPtiQwertyKeyMappings* iQwertyKeyMappings; |
|
236 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
237 CPtiHalfQwertyKeyMappings* iHalfQwertyKeyMappings; |
|
238 #endif |
|
239 TInt iLanguage; |
|
240 |
|
241 TInt iUiLanguage; |
|
242 TBuf<256> iAllowedDecimal; |
|
243 RProperty iQwertyModeStatusProperty; // To check the Qwerty keypad active |
|
244 TInt iDecimalCounter; |
|
245 |
|
246 TInt iKeyboardType; |
|
247 public: |
|
248 void IsQwertyActive(); |
|
249 void IsQwertyNotActive(); |
|
250 private: |
|
251 enum TCalcEditorComponentIndex |
|
252 { |
|
253 ECalcEditorOperandShadow, |
|
254 ECalcEditorOperand, |
|
255 ECalcEditorMemoryShadow, |
|
256 ECalcEditorMemory, |
|
257 ECalcEditorOperatorShadow, |
|
258 ECalcEditorOperator |
|
259 }; |
|
260 TAknLayoutText iLayoutText[KCalcCountOfEditorComponent]; |
|
261 // Layout of each drawing component. |
|
262 }; |
|
263 |
|
264 #include "CalcEdit.inl" |
|
265 |
|
266 // End of File |
|
267 |