|
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: Calculator environment class, CCalcAppEnv |
|
15 * Derived from CBase |
|
16 * This class maintain global data. e.g font, bitmap. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef CALCENV_H |
|
22 #define CALCENV_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <badesca.h> |
|
27 #include <gulicon.h> |
|
28 #include <eikenv.h> |
|
29 |
|
30 //Extended Icon Skin Implementation |
|
31 #include <AknsConstants.h> |
|
32 #include "CalcFunc.h" |
|
33 #include "CalcEditline.h" |
|
34 #include <AknUtils.h> |
|
35 |
|
36 // CONSTANTS |
|
37 const TInt KMaxMemoryIndicatorLength(4); |
|
38 const TInt KCalcCountOfOperatorType( 10 ); // +,-,*,/,=, sqrt, % , none ,* and /. |
|
39 //Extended Icon Skin implementation. |
|
40 const TInt KCalcAknsConstCount(26); |
|
41 const TInt KCalcCountOfButtonPressed(10); |
|
42 const TInt KCalcCountOfButtonInactive(16); |
|
43 const TInt KCountOfBitmaps(9); |
|
44 |
|
45 |
|
46 // FORWARD DECLARATIONS |
|
47 class CCalcAppUi; |
|
48 class CFont; |
|
49 |
|
50 // CLASS DEFINITIONS |
|
51 |
|
52 /** |
|
53 CCalcAppEnv : Maintains global data. |
|
54 */ |
|
55 class CCalcAppEnv |
|
56 : public CBase |
|
57 { |
|
58 public: // Constructors and destructor |
|
59 //Button Type |
|
60 //Extended Icon Skin Implementation |
|
61 enum ButtonType {EPRESSED, ENORMAL, EACTIVE_INACTIVE}; |
|
62 |
|
63 |
|
64 /** |
|
65 * Two-phased constructor. |
|
66 * @param aApp : Pointer of CCalcAppUi class |
|
67 */ |
|
68 static CCalcAppEnv* NewL(CCalcAppUi* aAppUi); |
|
69 |
|
70 /** |
|
71 * Destructor. |
|
72 */ |
|
73 virtual ~CCalcAppEnv(); |
|
74 |
|
75 public: // New functions |
|
76 /** |
|
77 * Return pointer of CCalcAppEnv class |
|
78 * @return Pointer of CCalcAppEnv class |
|
79 */ |
|
80 static CCalcAppEnv* Static(); |
|
81 |
|
82 |
|
83 /** |
|
84 * Return pointer of CCalcAppUi class |
|
85 * @return Pointer of CCalcAppUi class |
|
86 */ |
|
87 inline CCalcAppUi* AppUi() const; |
|
88 |
|
89 /** |
|
90 * Return charactor for editor operator |
|
91 * @param Operator type enum |
|
92 */ |
|
93 inline const TPtrC EditorOperator( |
|
94 const TCalcEditLine::TCalcOperatorType aType) const; |
|
95 |
|
96 /** |
|
97 * Return charactor for OutputSheet operator |
|
98 * @param Operator type enum |
|
99 */ |
|
100 inline const TPtrC OutSheetOperator( |
|
101 const TCalcEditLine::TCalcOperatorType aType) const; |
|
102 |
|
103 /** |
|
104 * Return decimal separator. |
|
105 * @return Decimal separator, e.g "." |
|
106 */ |
|
107 inline const TChar DecimalSeparator() const; |
|
108 |
|
109 /** |
|
110 * Set new decimal separator. |
|
111 * @param aChar: New decimal separator, e.g "." |
|
112 */ |
|
113 inline void SetDecimalSeparator(TChar aChar); |
|
114 |
|
115 /** |
|
116 * Return minus indicator. |
|
117 * @return minus indicator, e.g "-" |
|
118 */ |
|
119 inline const TChar MinusIndicator() const; |
|
120 |
|
121 /** |
|
122 * Return memory indicator. |
|
123 * @return memory indicator, e.g "M". |
|
124 */ |
|
125 inline TPtrC MemoryIndicator() const; |
|
126 |
|
127 /** |
|
128 * Return shadow of memory indicator. |
|
129 * @return memory indicator, e.g "M". |
|
130 */ |
|
131 inline TPtrC MemoryIndicatorShadow() const; |
|
132 |
|
133 /** |
|
134 * Return font for number shadow in editor. |
|
135 * @return Font for number shadow in editor |
|
136 */ |
|
137 inline const CFont* NumberShadowFont() const; |
|
138 |
|
139 /** |
|
140 * Return font for number in editor. |
|
141 * @return Font for number in editor |
|
142 */ |
|
143 inline const CFont* NumberFont() const; |
|
144 |
|
145 /** |
|
146 * Return font for operator shadow in editor. |
|
147 * @return Font for operator shadow in editor |
|
148 */ |
|
149 inline const CFont* OperatorShadowFont() const; |
|
150 |
|
151 /** |
|
152 * Return font for operator in editor. |
|
153 * @return Font for operator in editor |
|
154 */ |
|
155 inline const CFont* OperatorFont() const; |
|
156 |
|
157 /** |
|
158 * Return font for operator in OutputSheet. |
|
159 * @return Font for operator in OutputSheet |
|
160 */ |
|
161 inline const CFont* OutSheetOperatorFont() const; |
|
162 |
|
163 /** |
|
164 * Return 'qsn_fr_calc_display_side_l' 'qsn_fr_calc_display_center.svg' |
|
165 and 'qsn_fr_calc_display_side_r 'Bitmap pointers. |
|
166 */ |
|
167 inline const CGulIcon* DisplaySideLBitmap() const; |
|
168 inline const CGulIcon* DisplayCenterBitmap() const; |
|
169 inline const CGulIcon* DisplaySideRBitmap() const; |
|
170 |
|
171 |
|
172 /** |
|
173 * Return 'qgn_indi_calc_paper' Bitmap pointer. |
|
174 * @return 'qgn_indi_calc_paper' Bitmap pointer. |
|
175 */ |
|
176 inline const CGulIcon* PaperBitmap() const; |
|
177 |
|
178 /** |
|
179 * Return 'qgn_fr_calc_paper' Bitmap pointers. |
|
180 * @return 'qgn_fr_calc_paper' Bitmap pointers. |
|
181 */ |
|
182 inline void ScalablePaperBitmaps(const CGulIcon* [])const; |
|
183 |
|
184 /** |
|
185 * Return 'qgn_graf_calc_results_line' Bitmap pointer. |
|
186 * @return 'qgn_graf_calc_results_line' Bitmap pointer. |
|
187 */ |
|
188 inline const CGulIcon* ResultsLineBitmap()const; |
|
189 |
|
190 /** |
|
191 * Return unpressed bitmap of correspondent index |
|
192 * @param aIndex : index of bitmap array |
|
193 * @return : Bitmap pointer. |
|
194 */ |
|
195 inline CGulIcon* UnpressedButtonBmp( |
|
196 const TInt aIndex) const; |
|
197 |
|
198 /** |
|
199 * Return pressed bitmap of correspondent index |
|
200 * @param aIndex : index of bitmap array |
|
201 * @return : Bitmap pointer. |
|
202 */ |
|
203 inline CGulIcon* PressedButtonBmp( |
|
204 const TInt aIndex) const; |
|
205 |
|
206 /** |
|
207 * Return inactive bitmap of correspondent index |
|
208 * @param aIndex : index of bitmap array |
|
209 * @return : Bitmap pointer. If return value is NULL, |
|
210 * no bitmap exists on correspondent index. |
|
211 */ |
|
212 inline CGulIcon* InactiveButtonBmp( |
|
213 const TInt aIndex) const; |
|
214 |
|
215 /** |
|
216 * To load the functionmap bitmaps when the skin change event has occured. |
|
217 */ |
|
218 void LoadFuncMapBitmapSkinChangeL(); |
|
219 |
|
220 /** |
|
221 * Load bitmaps for FunctionMap SubPane. |
|
222 */ |
|
223 void LoadFuncMapBitmapL(); |
|
224 |
|
225 /*update the array when function map changed*/ |
|
226 void UpdateAknConstArrayForFuncMap(); |
|
227 |
|
228 //Function sets value as to whether skin is changed or not |
|
229 void SetSkinChangedValue(TBool aValue); |
|
230 |
|
231 private: // New functions |
|
232 /** |
|
233 * By default constructor is private. |
|
234 * @param aApp : CCalcAppUi class pointer |
|
235 */ |
|
236 |
|
237 CCalcAppEnv(); |
|
238 |
|
239 |
|
240 CCalcAppEnv(CCalcAppUi* aAppUi); |
|
241 |
|
242 |
|
243 /** |
|
244 * Second-phase constructor |
|
245 */ |
|
246 void ConstructAppEnvL(); |
|
247 |
|
248 |
|
249 /** |
|
250 * Load bitmaps for Paper Pane. |
|
251 */ |
|
252 void LoadPaperBitmapsL(); |
|
253 |
|
254 void InitializeAppUI(CCalcAppUi* aAppUi); |
|
255 |
|
256 /** |
|
257 * Load bitmaps for function map button. |
|
258 * @param aStartBitmapId : Bitmap ID of loading start |
|
259 * @param aStartMaskId : Mask ID of loading start |
|
260 * @param aStartIndex : Start index of array which is set to |
|
261 * bitmap. |
|
262 * @param aCount : Count of loading bitmaps |
|
263 * @param aBitmapArray : Load bitmap to this array. |
|
264 */ |
|
265 |
|
266 void LoadBitmapForFuncMapL(TInt aStartBitmapId, TInt aStartMaskId, TInt aStartIndex, |
|
267 TInt aCount, CGulIcon* aBitmapArray[], ButtonType aType); |
|
268 |
|
269 |
|
270 //Extended Icon Skin Implementation |
|
271 void UpdateAknConstArray(); |
|
272 |
|
273 //Extended Icon Skin Implementation for Paper |
|
274 void UpdateAknConstArrayforPaper(); |
|
275 |
|
276 |
|
277 private: // Data |
|
278 CCalcAppUi* iAppUi; // Pointer of CCalcAppUi class |
|
279 |
|
280 static CCalcAppEnv iself; |
|
281 CEikonEnv* iEnv; |
|
282 |
|
283 // Text |
|
284 CDesCArrayFlat* iEditorOperArray; // Operator for editor |
|
285 CDesCArrayFlat* iOutSheetOperArray;// Operator for OutputSheet |
|
286 TChar iDecimalSeparator; // Decimal separator |
|
287 TChar iMinusIndicator; // Minus indicator |
|
288 TBuf<KMaxMemoryIndicatorLength> iMemoryIndicator; |
|
289 TBuf<KMaxMemoryIndicatorLength> iMemoryIndicatorShadow; |
|
290 |
|
291 // Font |
|
292 CFont* iNumberShadowFont; |
|
293 CFont* iNumberFont; |
|
294 CFont* iOperatorShadowFont; |
|
295 CFont* iOperatorFont; |
|
296 CFont* iOutSheetOperatorFont; |
|
297 // Bitmap |
|
298 // Bitmap for background for editor |
|
299 CGulIcon* iDisplaySideLBitmap; |
|
300 CGulIcon* iDisplayCenterBitmap; |
|
301 CGulIcon* iDisplaySideRBitmap; |
|
302 CGulIcon* iPaperBitmap; // Bitmap for background for OutputSheet |
|
303 CGulIcon* iScalablePaperBitmap[KCountOfBitmaps];//Bitmpaps for background for outputSheet |
|
304 CGulIcon* iResultsLineBitmap; // Bitmap for drawing line in OutputSheet |
|
305 CGulIcon* iUnpressedButtonBmp[KCountOfButtonsTouch]; // Bitmap for button of FunctionMap |
|
306 CGulIcon* iPressedButtonBmp[KCountOfButtons]; |
|
307 CGulIcon* iDimmedButtonBmp[KCountOfButtons]; |
|
308 |
|
309 //Extended Icon Skin Implementation |
|
310 RArray<TAknsItemID> iAknsConstArray; |
|
311 RArray<TAknsItemID> iAknsConstArrayForPaper; |
|
312 TBool iIsSkinChanged; |
|
313 |
|
314 }; |
|
315 |
|
316 #include "CalcEnv.inl" |
|
317 |
|
318 #endif // CALCENV_H |
|
319 |
|
320 // End of File |
|
321 |
|
322 |