|
1 /* |
|
2 * Copyright (c) 1997-1999 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #if !defined(__EIKMFNE_H__) |
|
20 #define __EIKMFNE_H__ |
|
21 |
|
22 #if !defined(__EIKBCTRL_H__) |
|
23 #include <eikbctrl.h> |
|
24 #endif |
|
25 |
|
26 #if !defined(__COEDEF_H__) |
|
27 #include <coedef.h> |
|
28 #endif |
|
29 |
|
30 #if !defined(__COEINPUT_H__) |
|
31 #include <coeinput.h> |
|
32 #endif |
|
33 |
|
34 // For MEikCalendarObserver |
|
35 #if !defined(__EIKCAL_H__) |
|
36 #include <eikcal.h> |
|
37 #endif |
|
38 |
|
39 #if !defined(__EIKDEF_H__) |
|
40 #include <eikdef.h> |
|
41 #endif |
|
42 |
|
43 #if !defined(__BABITFLAGS_H__) |
|
44 #include <babitflags.h> |
|
45 #endif |
|
46 |
|
47 // For MAknMfneCommandObserver |
|
48 #if !defined(__AKNMFNECOMMANDOBSERVER) |
|
49 #include <aknmfnecommandobserver.h> |
|
50 #endif //!defined(__AKNMFNECOMMANDOBSERVER) |
|
51 |
|
52 // |
|
53 // Forward Declarations |
|
54 // |
|
55 class CEikonEnv; |
|
56 class CTimeEditor; |
|
57 class CDateEditor; |
|
58 |
|
59 // Skin-related API forward declarations |
|
60 class MAknsControlContext; |
|
61 |
|
62 // Extension object within CEikMfne |
|
63 class CEikMfneExtension; |
|
64 |
|
65 // Extension object within CEikTimeAndDateEditor |
|
66 class CEikTimeAndDateEditorExtension; |
|
67 |
|
68 // Extension object within CEikTimeEditorExtension |
|
69 class CEikTimeEditorExtension; |
|
70 // |
|
71 /** |
|
72 * Abstract base class for fields within a multi-field numeric editor. |
|
73 */ |
|
74 class CEikMfneField : public CBase |
|
75 { |
|
76 public: |
|
77 /** |
|
78 * The type of highlight. |
|
79 */ |
|
80 enum THighlightType |
|
81 { |
|
82 /** Inverse video. */ |
|
83 EInverseVideo, |
|
84 /** The cursor is visible in the field so that highlighting is not used. */ |
|
85 ECursor |
|
86 }; |
|
87 protected: |
|
88 /** |
|
89 * Protected default constructor. |
|
90 * |
|
91 * Sets the minimum width of the field to zero pixels. |
|
92 */ |
|
93 IMPORT_C CEikMfneField(); |
|
94 public: |
|
95 void Draw(CWindowGc& aGc, const CFont& aFont, const TPoint& aTopLeft) const; |
|
96 TInt WidthInPixels(const CFont& aFont) const; |
|
97 TInt DistanceFromStartOfFieldToEndOfTextInPixels(const CFont& aFont) const; |
|
98 |
|
99 /** |
|
100 * An implementation of this pure virtual function should |
|
101 * get the field's maximum width in pixels. |
|
102 * |
|
103 * @param aFont The font. |
|
104 * @param aShrinkToMinimumSize ETrue to shrink the width to the minimum required. |
|
105 * @return The field's maximum width in pixels. |
|
106 */ |
|
107 virtual TInt MaximumWidthInPixels(const CFont& aFont, TBool aShrinkToMinimumSize)=0; |
|
108 |
|
109 /** |
|
110 * An implementation of this pure virtual function should |
|
111 * return the field's input capabilities. |
|
112 * |
|
113 * @return The field's input capabilities. |
|
114 */ |
|
115 virtual TCoeInputCapabilities InputCapabilities() const=0; |
|
116 |
|
117 /** |
|
118 * Derived classes' implementation of function should |
|
119 * return whether the field is editable. |
|
120 * |
|
121 * This implementation returns EFalse. |
|
122 * |
|
123 * @return EFalse. |
|
124 */ |
|
125 IMPORT_C virtual TBool IsEditable() const; |
|
126 |
|
127 /** |
|
128 * Derived classes' implementation of function should |
|
129 * return whether the field is valid |
|
130 * |
|
131 * This implementation returns ETrue. |
|
132 * |
|
133 * @return ETrue. |
|
134 */ |
|
135 IMPORT_C virtual TBool IsValid() const; |
|
136 |
|
137 /** |
|
138 * An implementation of this function should get the |
|
139 * field's highlight type. |
|
140 * |
|
141 * May only be called if IsEditable() returns ETrue. |
|
142 * |
|
143 * This implementation panics in debug builds and returns |
|
144 * a dummy value in release builds. |
|
145 * |
|
146 * @return EInverseVideo. |
|
147 */ |
|
148 IMPORT_C virtual THighlightType HighlightType() const; |
|
149 |
|
150 /** |
|
151 * An implementation of this function should handle a key event. |
|
152 * |
|
153 * May only be called if IsEditable() returns ETrue. |
|
154 * This implementation panics in debug builds and is |
|
155 * empty in release builds. |
|
156 * |
|
157 * @param aFont The control's font. |
|
158 * @param aKeyEvent The key event passed on from the multi-field numeric editor. |
|
159 * @param aInterpretLeftAndRightAsEarEvents Not used. |
|
160 * @param aDataAltered On return, indicates whether or not the field |
|
161 * contents changed. If EFalse, left and right arrow |
|
162 * key presses indicate a movement to the preceding of |
|
163 * following field, if ETrue they are ignored. |
|
164 * @param aHighlightIncrement On return: -1 indicates the previous field is |
|
165 * highlighted,0 indicates the highlight is |
|
166 * unchanged and 1 indicates the following field |
|
167 * is highlighted. |
|
168 */ |
|
169 IMPORT_C virtual void HandleKey(const CFont& aFont, const TKeyEvent& aKeyEvent, TBool aInterpretLeftAndRightAsEarEvents, TBool& aDataAltered, TInt& aHighlightIncrement); |
|
170 |
|
171 /** |
|
172 * An implementation of this function should |
|
173 * handle de-highlighting the field. |
|
174 * |
|
175 * May only be called if IsEditable() returns ETrue. |
|
176 * |
|
177 * This implementation panics in debug builds and is empty |
|
178 * in release builds. |
|
179 * |
|
180 * @param aFont The control's font. |
|
181 * @param aEikonEnv The control's environment. |
|
182 * @param aDataAltered On return, set to ETrue if the function caused |
|
183 * the field's contents to change, otherwise unchanged. |
|
184 * @param aError On return, changed to ETrue if an error occurred e.g. |
|
185 * the user entered an invalid value, otherwise unchanged. |
|
186 */ |
|
187 IMPORT_C virtual void HandleDeHighlight(const CFont& aFont, CEikonEnv& aEikonEnv, TBool& aDataAltered, TBool& aError); |
|
188 |
|
189 const TDesC& FieldText() const; |
|
190 protected: |
|
191 /** |
|
192 * Handles a left or right arrow key press. |
|
193 * |
|
194 * @param aKey Left or right arrow key: either EKeyLeftArrow or EKeyRightArrow. |
|
195 * @param aDataAltered On return, ETrue if data is altered as a result of this function. |
|
196 * @param aHighlightIncrement On return, the direction to move the cursor: |
|
197 * either -1 if aKey is a left arrow key, or 1 if aKey is a right arrow key. |
|
198 * @panic 3 In debug builds, if aKey is neither a left nor a right arrow key. |
|
199 */ |
|
200 IMPORT_C void HandleLeftOrRightArrow(TChar aKey, TBool& aDataAltered, TInt& aHighlightIncrement); |
|
201 |
|
202 TInt AdditionalWidthForHighlights(const CFont& aFont) const; |
|
203 private: |
|
204 virtual const TDesC& Text() const=0; |
|
205 protected: |
|
206 /** |
|
207 * The field's minimum width in pixels. |
|
208 */ |
|
209 TInt iMinimumWidthInPixels; |
|
210 }; |
|
211 |
|
212 // |
|
213 |
|
214 /** |
|
215 * A separator field for a multi-field numeric editor. |
|
216 * |
|
217 * For instance, the character that separates time or date components. |
|
218 */ |
|
219 NONSHARABLE_CLASS(CEikMfneSeparator) : public CEikMfneField |
|
220 { |
|
221 private: |
|
222 CEikMfneSeparator(HBufC* aText); |
|
223 public: |
|
224 /** |
|
225 * Destructor. |
|
226 * |
|
227 * Deletes the separator text that is owned by the object. |
|
228 */ |
|
229 IMPORT_C virtual ~CEikMfneSeparator(); |
|
230 |
|
231 /** |
|
232 * Allocates and constructs a CEikMfneSeparator from resource. |
|
233 * |
|
234 * Uses an MFNE_SEPARATOR resource. |
|
235 * |
|
236 * @param aResourceReader The resource reader to use. |
|
237 * @return A newly constructed separator field. |
|
238 */ |
|
239 IMPORT_C static CEikMfneSeparator* NewL(TResourceReader& aResourceReader); |
|
240 |
|
241 /** |
|
242 * Allocates and constructs a separator. |
|
243 * |
|
244 * @param aText The separator's text. Ownership of aText is transferred. |
|
245 * @return A newly constructed separator. |
|
246 */ |
|
247 IMPORT_C static CEikMfneSeparator* NewL(HBufC* aText); // ownership of aText is transferred when everything that can leave has successfully been done |
|
248 |
|
249 /** |
|
250 * Sets the separator's text. |
|
251 * |
|
252 * This function transfers ownership of the text and can only be called if the field's text was previously NULL. |
|
253 * |
|
254 * @param aText The separator's text. |
|
255 * @panic 4 If the separator's text was not previously Null. |
|
256 */ |
|
257 IMPORT_C void SetText(HBufC* aText); // allows later transfer of ownership of text - can only be called if aText was previously NULL |
|
258 |
|
259 private: // framework |
|
260 virtual TInt MaximumWidthInPixels(const CFont& aFont, TBool aShrinkToMinimumSize); |
|
261 virtual TCoeInputCapabilities InputCapabilities() const; |
|
262 virtual const TDesC& Text() const; |
|
263 private: |
|
264 HBufC* iText; |
|
265 }; |
|
266 |
|
267 // |
|
268 |
|
269 /** |
|
270 * A number field within a multi-field numeric editor. |
|
271 */ |
|
272 NONSHARABLE_CLASS(CEikMfneNumber) : public CEikMfneField |
|
273 { |
|
274 public: |
|
275 /** |
|
276 * Flags for the number field. |
|
277 * |
|
278 * EFillWithLeadingZeros, EPreserveOldWidthBeforeEditing and ERepresentsYear can only be set if EPublicallySettableFlags is set. |
|
279 */ |
|
280 enum |
|
281 { |
|
282 /** Prepends the number field's value with leading zeros up to the maximum allowable width of the field. */ |
|
283 EFillWithLeadingZeros =0x1, |
|
284 /** The field's minimum width in pixels is set to the current text's width in pixels. */ |
|
285 EPreserveOldWidthBeforeEditing =0x2, |
|
286 /** The number is a year. */ |
|
287 ERepresentsYear =0x4, |
|
288 /** Used internally to make sure only the previous three values are set. */ |
|
289 EPublicallySettableFlags =EFillWithLeadingZeros|EPreserveOldWidthBeforeEditing|ERepresentsYear |
|
290 }; |
|
291 private: |
|
292 enum |
|
293 { |
|
294 EIsBeingEditedWithCursor =0x8, |
|
295 EIsUninitialised =0x10, |
|
296 EFillWithTrailingZeros =0x20 |
|
297 }; |
|
298 private: |
|
299 CEikMfneNumber(TInt aMinimumValue, TInt aMaximumValue, TUint32 aFlags); |
|
300 void ConstructL(); |
|
301 public: |
|
302 /** |
|
303 * Destructor. |
|
304 * |
|
305 * Deletes the number field's text. |
|
306 */ |
|
307 IMPORT_C virtual ~CEikMfneNumber(); |
|
308 |
|
309 /** |
|
310 * Allocates and constructs a CEikMfneNumber from resource. |
|
311 * |
|
312 * Obtains flags and the minimum and maximum values from an MFNE_NUMBER resource. Then calls the overloaded NewL() function. |
|
313 * |
|
314 * @param aFont The font to use. |
|
315 * @param aResourceReader The resource reader to use. |
|
316 * @return A newly constructed number field. |
|
317 */ |
|
318 IMPORT_C static CEikMfneNumber* NewL(const CFont& aFont, TResourceReader& aResourceReader); |
|
319 |
|
320 /** |
|
321 * Allocates and constructs a CEikMfneNumber with the specified parameters. |
|
322 * |
|
323 * @param aFont The font to use. |
|
324 * @param aMinimumValue The minimum value. |
|
325 * @param aMaximumValue The maximum value. |
|
326 * @param aInitialValue The initial value. This must be greater than the minimum value and less than the maximum value. |
|
327 * @param aFlags The number field's flags. See the Anonymous enum. |
|
328 * @return A newly constructed number field. |
|
329 * @panic 8 If the initial value is not greater than or equal to the minimum value and less than or equal to the maximum value. |
|
330 */ |
|
331 IMPORT_C static CEikMfneNumber* NewL(const CFont& aFont, TInt aMinimumValue, TInt aMaximumValue, TInt aInitialValue, TUint32 aFlags); |
|
332 |
|
333 /** |
|
334 * Sets the minimum and maximum allowable values. |
|
335 * |
|
336 * @param aMinimumValue The minimum value. Must be less than or equal to the maximum value. |
|
337 * @param aMaximumValue The maximum value. |
|
338 * @param aFont The font in use. |
|
339 * @panic 9 If the minimum value is greater than the maximum value or if the minimum/maximum text length is greater than the maximum number of digits. |
|
340 */ |
|
341 IMPORT_C void SetMinimumAndMaximum(TInt aMinimumValue, TInt aMaximumValue, const CFont& aFont); // only values inside the initial minimum and maximum are permitted |
|
342 |
|
343 /** |
|
344 * Gets the minimum and maximum allowable values. |
|
345 * |
|
346 * @param aMinimumValue On return, the minimum allowable value. |
|
347 * @param aMaximumValue On return, the maximum allowable value. |
|
348 */ |
|
349 IMPORT_C void GetMinimumAndMaximum(TInt& aMinimumValue, TInt& aMaximumValue) const; |
|
350 |
|
351 /** |
|
352 * Sets the field's current value. |
|
353 * @param aValue The field's current value. This must be between the minimum value and the maximum value. |
|
354 * @param aFont The font. |
|
355 * @panic 11 In debug builds only, if the value is less than the minimum value or greater than the maximum value. |
|
356 */ |
|
357 IMPORT_C void SetValue(TInt aValue, const CFont& aFont); |
|
358 |
|
359 /** |
|
360 * Gets the number field's value. Note that this function will leave |
|
361 * if the value is not valid, i.e. the number of digits is zero |
|
362 * or the value is outside of the minimum and maximum range. |
|
363 * |
|
364 * @return The field's value. |
|
365 */ |
|
366 IMPORT_C TInt Value() const; |
|
367 |
|
368 /** |
|
369 * Returns ETrue if the field contains more than zero |
|
370 * digits. |
|
371 * |
|
372 * @return ETrue if the field contains more than zero digits. |
|
373 */ |
|
374 IMPORT_C virtual TBool IsValid() const; |
|
375 |
|
376 /** |
|
377 * Sets the uninitialized status of the field. |
|
378 * |
|
379 * @param aUninitialised If ETrue, sets the field as uninitialized, |
|
380 * i.e. it doesn't display anything. |
|
381 */ |
|
382 IMPORT_C void SetUninitialised(TBool aUninitialised); |
|
383 |
|
384 /** |
|
385 * Gets the uninitialized status of the field. |
|
386 * |
|
387 * @return ETrue, if the field is set as uninitialized. |
|
388 */ |
|
389 IMPORT_C TBool IsUninitialised() const; |
|
390 |
|
391 public: |
|
392 /** |
|
393 * Sets the digit display type. |
|
394 * |
|
395 * @since S60 v3.1 |
|
396 * @param aDigitType The digit display type to bet set for this number field |
|
397 * @param aFont The font of the MFNE that owns this field, usually retrieved with CEikMfne::Font() |
|
398 */ |
|
399 IMPORT_C void SetDigitType(TDigitType aDigitType, const CFont& aFont); |
|
400 |
|
401 /** |
|
402 * Gets the digit display type. |
|
403 * |
|
404 * @since S60 v3.1 |
|
405 * @return The digit display type of this number field |
|
406 */ |
|
407 IMPORT_C TDigitType DigitType() const; |
|
408 |
|
409 /** |
|
410 * Derive and set digit display type from locale information. |
|
411 * |
|
412 * @since S60 v3.1 |
|
413 * @param aFont The font of the MFNE that owns this field, usually retrieved with CEikMfne::Font() |
|
414 */ |
|
415 IMPORT_C void RefreshDigitType(const CFont& aFont); |
|
416 |
|
417 void SetTrailingZeros(); |
|
418 |
|
419 public: |
|
420 TBool IsTextNull() const; |
|
421 private: // framework |
|
422 virtual TInt MaximumWidthInPixels(const CFont& aFont, TBool aShrinkToMinimumSize); |
|
423 virtual TCoeInputCapabilities InputCapabilities() const; |
|
424 virtual TBool IsEditable() const; |
|
425 virtual THighlightType HighlightType() const; |
|
426 virtual void HandleKey(const CFont& aFont, const TKeyEvent& aKeyEvent, TBool aInterpretLeftAndRightAsEarEvents, TBool& aDataAltered, TInt& aHighlightIncrement); |
|
427 virtual void HandleDeHighlight(const CFont& aFont, CEikonEnv& aEikonEnv, TBool& aDataAltered, TBool& aError); |
|
428 virtual const TDesC& Text() const; |
|
429 private: |
|
430 TInt MaximumNumberOfDigits() const; |
|
431 TInt NumberOfDigits() const; |
|
432 void SetTextToValue(TInt aValue, const CFont& aFont); |
|
433 TInt ValueFromText() const; |
|
434 TBool ConvertsIntoValidValue(TInt& aValue) const; |
|
435 |
|
436 private: // International digit support |
|
437 TChar NormalizeDigit(TChar aChar); |
|
438 TText ZeroCharacter() const; |
|
439 TText NegativeCharacter() const; |
|
440 |
|
441 private: |
|
442 TInt iMinimumValue; |
|
443 TInt iMaximumValue; |
|
444 TInt iMaxDigits; |
|
445 TUint32 iFlags; |
|
446 HBufC* iText; |
|
447 TChar iNudgeCharMinus; |
|
448 TChar iNudgeCharPlus; |
|
449 TInt iMaxDigitsMinimumValue; |
|
450 TInt iMaxDigitsMaximumValue; |
|
451 TDigitType iDigitType; |
|
452 }; |
|
453 |
|
454 // |
|
455 |
|
456 /** |
|
457 * A symbol field for a multi-field numeric editor. |
|
458 * |
|
459 * For instance, the AM / PM text in a time editor. In this case, the field contains 2 symbolic items one each for the AM and PM text strings. |
|
460 */ |
|
461 NONSHARABLE_CLASS(CEikMfneSymbol) : public CEikMfneField |
|
462 { |
|
463 public: |
|
464 /** |
|
465 * An item within a symbol field in an MFNE. |
|
466 */ |
|
467 NONSHARABLE_CLASS(CItem) : public CBase |
|
468 { |
|
469 private: |
|
470 CItem(TInt aId, TChar aKeyToMatch, HBufC* aText); |
|
471 public: |
|
472 /** |
|
473 * Destructor. |
|
474 * |
|
475 * Deletes the item's text. |
|
476 */ |
|
477 IMPORT_C virtual ~CItem(); |
|
478 |
|
479 /** |
|
480 * Allocates and constructs a symbolic item from resource. |
|
481 * |
|
482 * Uses a MFNE_SYMBOLIC_ITEM resource. |
|
483 * @param aResourceReader The resource reader to use. |
|
484 * @return A newly constructed symbolic item. |
|
485 */ |
|
486 IMPORT_C static CItem* NewL(TResourceReader& aResourceReader); |
|
487 |
|
488 /** |
|
489 * Allocates and constructs a symbolic item. |
|
490 * |
|
491 * @param aId The ID of the symbolic item that uniquely identifies the item in the field. |
|
492 * @param aKeyToMatch The key that represents the item. This is for character matching, not for display. |
|
493 * @param aText The text to be drawn. Ownership of aText is transferred when everything that can leave has successfully completed. |
|
494 * @return A newly constructed symbolic item. |
|
495 */ |
|
496 IMPORT_C static CItem* NewL(TInt aId, TChar aKeyToMatch, HBufC* aText); // ownership of aText is transferred when everything that can leave has successfully been done |
|
497 |
|
498 /** |
|
499 * Sets the symbolic item's text. |
|
500 * |
|
501 * The item takes ownership of aText. |
|
502 * |
|
503 * @param aText The symbolic item's text. |
|
504 * @panic 19 In debug builds if the symbolic item's text was not |
|
505 * previously Null. |
|
506 */ |
|
507 IMPORT_C void SetText(HBufC* aText); // allows later transfer of ownership of text - can only be called if aText was previously NULL |
|
508 private: |
|
509 friend class CEikMfneSymbol; |
|
510 private: |
|
511 TInt iId; |
|
512 TCharF iKeyToMatch; |
|
513 HBufC* iText; |
|
514 }; |
|
515 private: |
|
516 CEikMfneSymbol(TInt aNumSymbolicItems); |
|
517 public: |
|
518 /** |
|
519 * Destructor. |
|
520 * |
|
521 * Deletes the array of symbolic items owned by the object. |
|
522 */ |
|
523 IMPORT_C virtual ~CEikMfneSymbol(); |
|
524 |
|
525 /** |
|
526 * Allocates and constructs a CEikMfneSymbol from resource. |
|
527 * |
|
528 * Uses a MFNE_SYMBOL resource. The first item is set as current. |
|
529 * |
|
530 * @param aResourceReader The resource reader to use. |
|
531 * @return A newly constructed symbol. |
|
532 * @panic 15 If there is not more than one symbol. |
|
533 */ |
|
534 IMPORT_C static CEikMfneSymbol* NewL(TResourceReader& aResourceReader); |
|
535 |
|
536 /** |
|
537 * Allocates and constructs a CEikMfneSymbol. |
|
538 * |
|
539 * The first item is set as current. |
|
540 * |
|
541 * @param aNumSymbolicItems The number of symbolic items. Must be |
|
542 * greater than one. All items are set to NULL. |
|
543 * @return A newly constructed symbol. |
|
544 * @panic 15 If there is not more than one symbol. |
|
545 */ |
|
546 IMPORT_C static CEikMfneSymbol* NewL(TInt aNumSymbolicItems); |
|
547 |
|
548 /** |
|
549 * Adds the specified symbolic item at the first available position in |
|
550 * the array. |
|
551 * |
|
552 * This should be called by the container only if construction was not |
|
553 * made from resource. |
|
554 * |
|
555 * @param aSymbolicItem The symbol to add. Ownership of aSymbolicItem |
|
556 * is transferred to this. |
|
557 * @param aMakeCurrent ETrue to make the added symbol current. |
|
558 * @panic 16 In debug build if the symbolic item array has not yet been |
|
559 * created. |
|
560 * @panic 17 If the array is full. |
|
561 */ |
|
562 IMPORT_C void AddSymbolicItem(CItem* aSymbolicItem, TBool aMakeCurrent); // to be called by container only if not constructed from resource - ownership of aSymbolicItem is transferred to "this" |
|
563 |
|
564 /** |
|
565 * Sets the current item to the one specified. |
|
566 * |
|
567 * |
|
568 * @param aId The id of the new current item. |
|
569 * @panic 18 If the specified item does not exist. |
|
570 */ |
|
571 IMPORT_C void SetCurrentSymbolicItemToId(TInt aId); |
|
572 |
|
573 /** |
|
574 * Gets the current symbol's ID. |
|
575 * |
|
576 * @return The current symbol's ID. |
|
577 */ |
|
578 IMPORT_C TInt IdOfCurrentSymbolicItem() const; |
|
579 |
|
580 /** |
|
581 * Sets the uninitialized status of the field. |
|
582 * |
|
583 * @param aUninitialised If ETrue, sets the field as uninitialized, |
|
584 * i.e. doesn't display anything. |
|
585 */ |
|
586 IMPORT_C void SetUninitialised(TBool aUninitialised); |
|
587 |
|
588 /** |
|
589 * Gets the uninitialized status of the field. |
|
590 * |
|
591 * @return ETrue, if the field is set as uninitialized. |
|
592 */ |
|
593 IMPORT_C TBool IsUninitialised() const; |
|
594 |
|
595 private: // framework |
|
596 virtual TInt MaximumWidthInPixels(const CFont& aFont, TBool aShrinkToMinimumSize); |
|
597 virtual TCoeInputCapabilities InputCapabilities() const; |
|
598 virtual TBool IsEditable() const; |
|
599 virtual THighlightType HighlightType() const; |
|
600 virtual void HandleKey(const CFont& aFont, const TKeyEvent& aKeyEvent, TBool aInterpretLeftAndRightAsEarEvents, TBool& aDataAltered, TInt& aHighlightIncrement); |
|
601 virtual void HandleDeHighlight(const CFont& aFont, CEikonEnv& aEikonEnv, TBool& aDataAltered, TBool& aError); |
|
602 virtual const TDesC& Text() const; |
|
603 private: |
|
604 TInt CurrentSymbolicItem() const; |
|
605 void SetCurrentSymbolicItem(TInt aCurrentSymbolicItem); |
|
606 private: |
|
607 TInt iNumSymbolicItems; |
|
608 TInt iCurrentSymbolicItem; |
|
609 CItem** iSymbolicItems; |
|
610 }; |
|
611 |
|
612 // |
|
613 |
|
614 /** |
|
615 * Multi-field numeric editor abstract base class. |
|
616 * |
|
617 * This is a set of fields, where a field can be a number, a symbol or |
|
618 * a separator. Field classes are derived from CEikMfneField. |
|
619 * |
|
620 * Concrete multi-field numeric editors are derived from this class and |
|
621 * should provide the following: |
|
622 * |
|
623 * * A virtual destructor if the class introduces new data members which |
|
624 * are allocated on the heap. |
|
625 * |
|
626 * * A ConstructL() function; this is used to initialise a multi-field |
|
627 * numeric editor. |
|
628 * |
|
629 * * A ConstructFromResourceL() function; this is used to initialise a |
|
630 * multi-field numeric editor from a resource. |
|
631 * |
|
632 * * A data member to store the editor's value. |
|
633 * |
|
634 * * Functions to set and get the editor's value. |
|
635 * |
|
636 * * Functions to set the minimum and maximum allowable values. |
|
637 */ |
|
638 class CEikMfne : public CEikBorderedControl, public MAknMfneCommandObserver |
|
639 { |
|
640 public: |
|
641 // miscellaneous functions |
|
642 /** |
|
643 * Default constructor. |
|
644 */ |
|
645 IMPORT_C CEikMfne(); |
|
646 |
|
647 /** |
|
648 * Destructor. |
|
649 * |
|
650 * This function is virtual which ensures that if delete is explicitly |
|
651 * called on a CEikMfne pointer which points to a derived class |
|
652 * instance, the derived class destructor is called. |
|
653 */ |
|
654 IMPORT_C virtual ~CEikMfne(); |
|
655 |
|
656 /** |
|
657 * Allocates a field array containing aNumFields elements. |
|
658 * |
|
659 * This should be called by the container only if a derived control is |
|
660 * not constructed from a resource. |
|
661 * |
|
662 * @param aNumFields The number of fields. |
|
663 * @panic 20 In debug builds, if there is already a field in the editor. |
|
664 */ |
|
665 IMPORT_C void CreateFieldArrayL(TInt aNumFields); // to be called by container only if not constructed from resource |
|
666 |
|
667 /** |
|
668 * Adds a field. |
|
669 * |
|
670 * The field is added as the first empty element in the field array or, |
|
671 * if there is no current field, aField becomes the current field. |
|
672 * |
|
673 * This should be called by the container only if a derived control is |
|
674 * not constructed from a resource. |
|
675 * |
|
676 * Ownership of aField is transferred to this multi-field numeric |
|
677 * editor. |
|
678 * |
|
679 * @param aField A field. |
|
680 * @panic 22 If the field array has not been allocated. |
|
681 */ |
|
682 IMPORT_C void AddField(CEikMfneField* aField); // to be called by container only if not constructed from resource - ownership of aField is transferred to "this" |
|
683 |
|
684 /** |
|
685 * Deletes the editor's field and the field array. |
|
686 * |
|
687 * After a call to this, CreateFieldArrayL() can be called again. |
|
688 */ |
|
689 IMPORT_C void ResetFieldArray(); // after this CreateFieldArrayL() can be called again |
|
690 |
|
691 /** |
|
692 * Gets the control's border margins. |
|
693 * |
|
694 * @return The control's margins. |
|
695 */ |
|
696 IMPORT_C TMargins BorderMargins() const; |
|
697 |
|
698 /** |
|
699 * Draws immediately, and then leaves with an info message containing a |
|
700 * formatted time/date string. |
|
701 * |
|
702 * The time/date is passed to the function, as is the resource which |
|
703 * contains the format string which defines how it is to be formatted. |
|
704 * |
|
705 * @param aResourceId The resource containing the time/date format. See |
|
706 * TTime::FormatL(). |
|
707 * @param aTimeDate The object containing the time/date to be displayed. |
|
708 */ |
|
709 IMPORT_C void DrawNowAndLeaveWithTimeDateFormatInfoMsgL(TInt aResourceId, const TTime& aTimeDate) const; |
|
710 |
|
711 /** |
|
712 * Gets the CEikMfneField at the specified index. |
|
713 * |
|
714 * @param aField The field index. |
|
715 * @return The requested field, or NULL if the index is less than zero |
|
716 * or greater than the number of fields. |
|
717 */ |
|
718 IMPORT_C CEikMfneField* Field(TInt aField) const; |
|
719 |
|
720 public: |
|
721 // some utility functions which other classes may find useful |
|
722 |
|
723 /** |
|
724 * A utility function which reads seconds, minutes and hours from a |
|
725 * resource and returns the corresponding TTime value. |
|
726 * |
|
727 * @param aResourceReader A resource reader. |
|
728 * @return The time value read from the resource. |
|
729 */ |
|
730 IMPORT_C static TTime ReadTime(TResourceReader& aResourceReader); |
|
731 |
|
732 /** |
|
733 * A utility function which reads days, months and years from a resource |
|
734 * and returns the corresponding TTime value. |
|
735 * |
|
736 * @param aResourceReader A resource reader. |
|
737 * @return The date value read from the resource. The hours, minutes, |
|
738 * seconds values are set to zero. |
|
739 */ |
|
740 IMPORT_C static TTime ReadDate(TResourceReader& aResourceReader); |
|
741 |
|
742 /** |
|
743 * A utility function which reads seconds, minutes, hours, days, months |
|
744 * and years from a resource and returns the corresponding TTime value. |
|
745 * |
|
746 * @param aResourceReader A resource reader. |
|
747 * @return The time/date value read from the resource. |
|
748 */ |
|
749 IMPORT_C static TTime ReadTimeAndDate(TResourceReader& aResourceReader); |
|
750 |
|
751 /** |
|
752 * Reads a duration value from a resource. |
|
753 * |
|
754 * @param aResourceReader A resource reader. |
|
755 * @return The duration, in seconds. |
|
756 */ |
|
757 IMPORT_C static TTimeIntervalSeconds ReadDuration(TResourceReader& aResourceReader); |
|
758 |
|
759 /** |
|
760 * Reads a time offset from a resource. |
|
761 * |
|
762 * This is identical to ReadDuration(), except that negative offsets |
|
763 * are allowed. |
|
764 * |
|
765 * @param aResourceReader A resource reader. |
|
766 * @return The duration, in seconds. |
|
767 */ |
|
768 IMPORT_C static TTimeIntervalSeconds ReadTimeOffset(TResourceReader& aResourceReader); |
|
769 |
|
770 /** |
|
771 * Converts a time duration to seconds. |
|
772 * |
|
773 * @param aTime The date and time to be converted. |
|
774 * @return The time duration in seconds. |
|
775 */ |
|
776 IMPORT_C static TTimeIntervalSeconds Convert(const TTime& aTime); |
|
777 |
|
778 /** |
|
779 * Converts a time duration in seconds to hours, minutes and seconds. |
|
780 * |
|
781 * @param aTimeIntervalSeconds The number of seconds to be converted. |
|
782 * @return The date/time duration. |
|
783 */ |
|
784 IMPORT_C static TTime Convert(const TTimeIntervalSeconds& aTimeIntervalSeconds); |
|
785 // |
|
786 /** |
|
787 * Gets the index into the field array of the current field. |
|
788 * |
|
789 * @return The current field's index. |
|
790 */ |
|
791 inline TInt CurrentField() const; |
|
792 |
|
793 /** |
|
794 * Gets the number of fields. |
|
795 * |
|
796 * @return The number of fields in the editor. |
|
797 */ |
|
798 inline TInt NumFields() const; |
|
799 |
|
800 public: // AVKON addition |
|
801 /** |
|
802 * Settable features for MFNE. See SetFeature(). |
|
803 * |
|
804 * @since S60 3.2 |
|
805 */ |
|
806 enum TFeatureId |
|
807 { |
|
808 /** Tries to prevent MFNE drawing outside its rect, |
|
809 event if it smaller than MinimumSize(). |
|
810 0 (or EFalse) parameter disables this, non-zero |
|
811 (or ETrue) enables the feature. */ |
|
812 EClipGcToRect, |
|
813 |
|
814 /** Disables VKB. Non-zero (or ETrue) parameter disables VKB, |
|
815 0 (or EFalse) enables VKB. When disabled, |
|
816 editor doesn't request PenInputServer to start VKB */ |
|
817 EDisablePenInput, |
|
818 |
|
819 /** Support finger input. Paramter is TFingerSupportParams.*/ |
|
820 EFingerSupport, |
|
821 |
|
822 ELaunchPenInputAutomatic, |
|
823 |
|
824 EPartialScreenInput, |
|
825 /* Support the feature change AM and PM with pressing on touch input*/ |
|
826 EChangeAmPm |
|
827 }; |
|
828 /** Parameter for finger support feature: |
|
829 * 0 means disable the suppor; |
|
830 * 1 means enable the support; |
|
831 * 2 means enable the support with highlight of whole text. |
|
832 */ |
|
833 enum TFingerSupportParams |
|
834 { |
|
835 EDisaleFingerSupport, |
|
836 EnableFingerSupport, |
|
837 EnableWithAllHighlight |
|
838 }; |
|
839 |
|
840 /** |
|
841 * Sets the alignment of the editor. The editor alignments, defined in |
|
842 * avkon.hrh, are EAknEditorAlignNone, EAknEditorAlignCenter, |
|
843 * EAknEditorAlignLeft, EAknEditorAlignRight or EAknEditorAlignBidi. |
|
844 * |
|
845 * @param aAlignment The editor's alignment |
|
846 */ |
|
847 IMPORT_C void SetMfneAlignment(TInt aAlignment); |
|
848 |
|
849 /** |
|
850 * Sets whether the editor consumes up and down key events. If this is |
|
851 * set to EFalse, the editor returns EKeyWasNotConsumed upon receiving |
|
852 * EKeyDownArrow or EKeyUpArrow key event and doesn't send the key event to |
|
853 * the current field. |
|
854 * |
|
855 * @param aConsume If EFalse, OfferKeyEventL() returns |
|
856 * EKeyWasNotConsumed when up and down key events are received. |
|
857 */ |
|
858 IMPORT_C void SetUpAndDownKeysConsumed(TBool aConsume); |
|
859 |
|
860 /** |
|
861 * Used for suppressing all editor's background drawing. This is |
|
862 * intended for internal use. |
|
863 * |
|
864 * Note that when this is set, the background is not drawn with skin |
|
865 * nor cleared, so the background MUST be drawn by the parent control |
|
866 * every time the editor changes. |
|
867 * |
|
868 * @param aSuppress If ETrue, suppress background drawing |
|
869 */ |
|
870 IMPORT_C void SetSuppressBackgroundDrawing( TBool aSuppress ); |
|
871 |
|
872 /** |
|
873 * Used for setting various flag-like features to the editor. |
|
874 * |
|
875 * @param aFeatureId The feature id, see TFeatureId |
|
876 * @param aFeatureParam The feature parameter. This is usually |
|
877 * enabled or disabled. For more info, see |
|
878 * the feature documentation in TFeatureId. |
|
879 * @return KErrNone if the feature modification succeeded |
|
880 * @since S60 3.2 |
|
881 **/ |
|
882 IMPORT_C TInt SetFeature( TInt aFeatureId, TInt aFeatureParam ); |
|
883 |
|
884 /** |
|
885 * Used to getting feature statuses. |
|
886 * |
|
887 * @param aFeatureId The feature id, see TFeatureId |
|
888 * @param aFeatureParam On return, the parameter for the feature |
|
889 * (usually non-zero for an enabled feature |
|
890 * and zero for disabled) |
|
891 * @return KErrNone if the feature is supported and fetching its value |
|
892 * succeeded |
|
893 * @since S60 3.2 |
|
894 */ |
|
895 IMPORT_C TInt GetFeature( TInt aFeatureId, TInt& aFeatureParam ) const; |
|
896 |
|
897 /** |
|
898 * Used for checking if the editor supports a feature. |
|
899 * For features, see TFeatureId. |
|
900 * |
|
901 * @param aFeatureId |
|
902 * @return ETrue if the feature is supported |
|
903 * @since S60 3.2 |
|
904 */ |
|
905 IMPORT_C TBool SupportsFeature( TInt aFeatureId ) const; |
|
906 |
|
907 // Highlights a field |
|
908 void HighlightField( TInt aFieldPosition ); |
|
909 |
|
910 /** |
|
911 * Gets a pointer to the CFont object that is used to draw the fields in |
|
912 * this editor. |
|
913 * |
|
914 * @return A pointer to the CFont object used to draw the fields in |
|
915 * this editor. |
|
916 */ |
|
917 IMPORT_C const CFont* Font() const; |
|
918 |
|
919 /** |
|
920 * Sets the font that is used to draw the fields in this editor. |
|
921 * |
|
922 * @param aFont A pointer to a CFont object that is used to draw the |
|
923 * fields in this editor. |
|
924 */ |
|
925 IMPORT_C void SetFont(const CFont* aFont); |
|
926 |
|
927 /** |
|
928 * Sets within in the editor an externally owned Skins background control context. |
|
929 * This background control context will then be used by the editor to draw background. |
|
930 * |
|
931 * If this API is not called, then the editor IS skin enabled, (that is CEikMfnes are skin |
|
932 * enabled by default) but it will try to find a control context with which to perform background |
|
933 * drawing from the Control Environment, via the Object Provider. |
|
934 * |
|
935 * Setting this control context to NULL will have the effect of turning off background |
|
936 * skinning. |
|
937 * |
|
938 * @param aBackgroundControlContext Control context to store. Not owned. Can be NULL |
|
939 */ |
|
940 IMPORT_C void SetSkinBackgroundControlContextL( MAknsControlContext* aControlContext ); |
|
941 |
|
942 |
|
943 /** |
|
944 * From MAknMfneCommandObserver. Allows owning controls to give commands to |
|
945 * MFNE editors. This is interface was added to enable modifying the current field |
|
946 * value with touch buttons. |
|
947 * |
|
948 * @param aCommand Command ID defined in MAknMfneCommandObserver::TMfneCommand |
|
949 */ |
|
950 IMPORT_C void HandleMfneCommandL(TInt aCommand); |
|
951 |
|
952 /** |
|
953 * Sets the MFNE to use the CCoeControl::OverrideColorL() defined |
|
954 * color in drawing. If this is set, no skinning will be used |
|
955 * in drawing. |
|
956 * |
|
957 * @param aUseOverrideColors ETrue to make the MFNE use overridden colors. |
|
958 * @since S60 v3.2 |
|
959 */ |
|
960 IMPORT_C void SetUseOverrideColors( TBool aUseOverrideColors ); |
|
961 |
|
962 |
|
963 public: // from CCoeControl |
|
964 /** |
|
965 * Handles key events. |
|
966 * |
|
967 * Overrides CCoeControl::OfferKeyEventL(). The key event is passed |
|
968 * onto the current field to handle. |
|
969 * |
|
970 * @param aKeyEvent The key event. |
|
971 * @param aType The type of key event. |
|
972 * @return Indicates whether or not the key event was used by this |
|
973 * control. |
|
974 */ |
|
975 IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); |
|
976 |
|
977 /** |
|
978 * Prepares for focus loss. |
|
979 * |
|
980 * Overrides CCoeControl::PrepareForFocusLossL(). |
|
981 * |
|
982 * This function should be called when an attempt is made to remove |
|
983 * focus from a multi-field numeric editor. It redraws the control, removing |
|
984 * highlighting from the current field. |
|
985 * |
|
986 * It may be overridden in derived classes to test the validity of |
|
987 * information entered into the editor. Derived class versions should include |
|
988 * a base function call. |
|
989 */ |
|
990 IMPORT_C virtual void PrepareForFocusLossL(); |
|
991 |
|
992 /** |
|
993 * Gets the minimum size of the control. |
|
994 * |
|
995 * Overrides CCoeControl::MinimumSize(). |
|
996 * |
|
997 * @return The minimum control size. |
|
998 */ |
|
999 IMPORT_C virtual TSize MinimumSize(); |
|
1000 |
|
1001 /** |
|
1002 * Gets the list of logical colours used to draw the control. |
|
1003 * |
|
1004 * The colours are appended to aColorUseList. |
|
1005 * |
|
1006 * Overrides CCoeControl::GetColorUseListL(). |
|
1007 * |
|
1008 * @param aColorUseList On return, the colour list. |
|
1009 */ |
|
1010 IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u |
|
1011 |
|
1012 /** |
|
1013 * Handles a change to the control's resources. |
|
1014 * |
|
1015 * The types of resources handled are those which are shared across the |
|
1016 * environment, e.g. colours or fonts. |
|
1017 * |
|
1018 * Overrides CCoeControl::HandleResourceChange(). |
|
1019 * |
|
1020 * @param aType A message UID value. |
|
1021 */ |
|
1022 IMPORT_C virtual void HandleResourceChange(TInt aType); // not available before Release 005u |
|
1023 |
|
1024 /** |
|
1025 * Gets the total of the input capabilities of all the editor's fields. |
|
1026 * |
|
1027 * Overrides CCoeControl::InputCapabilities(). |
|
1028 * |
|
1029 * If this function is overrided in a subclass, the subclass should |
|
1030 * obtain this class' InputCapabilities' object provider through |
|
1031 * TCoeInputCapabilities::ObjectProvider() and set that as a part of |
|
1032 * the subclass' InputCapabilities object provider chain to ensure |
|
1033 * maximum functionality. |
|
1034 * |
|
1035 * @return The control's input capabilities. |
|
1036 */ |
|
1037 IMPORT_C virtual TCoeInputCapabilities InputCapabilities() const; |
|
1038 |
|
1039 /** |
|
1040 * From @c CCoeControl. |
|
1041 * |
|
1042 * Handles pointer events. |
|
1043 * |
|
1044 * @param aPointerEvent The pointer event. |
|
1045 */ |
|
1046 IMPORT_C virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
1047 |
|
1048 /** |
|
1049 * Retrieves an object of the same type as that encapsulated in aId. |
|
1050 * |
|
1051 * Overrides CCoeControl::MopSupplyObject(). |
|
1052 * |
|
1053 * @param aId An encapsulated object type ID. |
|
1054 * @return Encapsulates the pointer to the object provided. Note that |
|
1055 * the encapsulated pointer may be NULL. |
|
1056 */ |
|
1057 IMPORT_C virtual TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); |
|
1058 |
|
1059 public: // new |
|
1060 /** |
|
1061 * Sets the colors for text and background as skin IDs. Please note that |
|
1062 * bgcolor overrides skinned draw if set |
|
1063 * |
|
1064 * @since 3.0 |
|
1065 * @param aAknSkinIDForTextColor ID for text color. |
|
1066 * @param aAknSkinIDForBgColor ID for background color. |
|
1067 */ |
|
1068 IMPORT_C void SetSkinTextColorL(TInt aAknSkinIDForTextColor, TInt aAknSkinIDForBgColor=KErrNotFound); |
|
1069 |
|
1070 protected: |
|
1071 // framework |
|
1072 /** |
|
1073 * Redraws the current field, so removing or displaying the cursor. |
|
1074 * |
|
1075 * If the editor has lost focus, the current field is reset to the |
|
1076 * first editable field. |
|
1077 * |
|
1078 * @param aDrawNow Whether to draw the control immediately. |
|
1079 */ |
|
1080 IMPORT_C virtual void FocusChanged(TDrawNow aDrawNow); |
|
1081 |
|
1082 /** |
|
1083 * Writes the internal state of the control and its components to |
|
1084 * aStream. |
|
1085 * |
|
1086 * This function is empty in release builds. |
|
1087 */ |
|
1088 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const; |
|
1089 |
|
1090 // miscellaneous functions |
|
1091 |
|
1092 /** |
|
1093 * Handles the redrawing associated with a change to the current field. |
|
1094 * |
|
1095 * Called by OfferKeyEventL(), HandlePointerEventL() and |
|
1096 * PrepareForFocusLossL(). |
|
1097 * |
|
1098 * @param aHandleDeHighlight ETrue if the current field has changed so |
|
1099 * requires de-highlighting. |
|
1100 * @param aNewCurrentField The index of the field to which the user has |
|
1101 * moved. |
|
1102 * @param aOldWidthInPixelsOfOldCurrentField The width in pixels of the |
|
1103 * previous current field. |
|
1104 * @param aOldHighlightTypeOfOldCurrentField The highlight type of the |
|
1105 * previously current field. |
|
1106 * @param aDataAltered ETrue if the data has been changed. |
|
1107 * @param aError On return, ETrue if successful, EFalse if not |
|
1108 * successful. |
|
1109 */ |
|
1110 IMPORT_C void HandleInteraction(TBool aHandleDeHighlight, TInt aNewCurrentField, TInt aOldWidthInPixelsOfOldCurrentField, |
|
1111 CEikMfneField::THighlightType aOldHighlightTypeOfOldCurrentField, TBool& aDataAltered, TBool& aError); |
|
1112 |
|
1113 /** |
|
1114 * Empty virtual function. |
|
1115 * |
|
1116 * Called by HandleInteraction() when switching from the current field. |
|
1117 * Can be implemented by derived classes to maintain consistency between |
|
1118 * fields, e.g. in a range editor. |
|
1119 * |
|
1120 * @param aField The current field. |
|
1121 * @param aDrawAllFields On return, whether all fields have changed and |
|
1122 * need to be redrawn. |
|
1123 */ |
|
1124 IMPORT_C virtual void FieldIsAboutToBeDeHighlighted(CEikMfneField* aField, TBool& aDrawAllFields); // first occurrence of this virtual function - does nothing by default |
|
1125 |
|
1126 /** |
|
1127 * Gets the size of the multi-field numeric editor. |
|
1128 * |
|
1129 * The width is the sum of the maximum widths of every field. |
|
1130 * |
|
1131 * @return The size of the multi-field numeric editor. |
|
1132 */ |
|
1133 IMPORT_C TSize MfneSize() const; |
|
1134 |
|
1135 /** |
|
1136 * Gets the size of the multi-field numeric editor. |
|
1137 * |
|
1138 * The width is the sum of the maximum widths of every field. |
|
1139 * |
|
1140 * @param aShrinkToMinimumSize ETrue to shrink the width to the minimum |
|
1141 * required for each field. |
|
1142 * @return The size of the multi-field numeric editor. |
|
1143 */ |
|
1144 IMPORT_C TSize MfneSize(TBool aShrinkToMinimumSize); |
|
1145 |
|
1146 IMPORT_C virtual void SizeChanged(); |
|
1147 |
|
1148 public: |
|
1149 static void InvalidFieldAlert(); |
|
1150 static void LeaveWithAlert(TInt aResourceId); |
|
1151 void GetCursorInfo( TPoint& aPos, TInt& aHeight, TInt& aWidth, TInt& aAscent ); |
|
1152 void ReportUpdate(); |
|
1153 IMPORT_C virtual void MakeVisible(TBool aVisible); |
|
1154 void SetCurrentField( TInt aCurrentField ); |
|
1155 void SetValidateCallBack( TCallBack aCallBack ); |
|
1156 void ReportStateChangeEventL(); |
|
1157 void SetFirstEditableField(); |
|
1158 |
|
1159 private: |
|
1160 // framework |
|
1161 IMPORT_C virtual void Draw(const TRect& aRect) const; |
|
1162 |
|
1163 // new virtual functions |
|
1164 IMPORT_C virtual void CreatePopoutIfRequiredL(); |
|
1165 // miscellaneous functions |
|
1166 |
|
1167 /** |
|
1168 * Draws the specified fields within the MFNE. |
|
1169 * All fields between and including the @c aFirstField and @c aLastField |
|
1170 * will be drawn. |
|
1171 * |
|
1172 * @param aGc The graphics context to draw to. |
|
1173 * @param aFirstField First field to be drawn. |
|
1174 * @param aLastField Last field to be drawn. |
|
1175 * @param aSkipBackgroundDrawer @c ETrue to skip the background drawing |
|
1176 * with a background drawer if it's used |
|
1177 * for the MFNE. |
|
1178 */ |
|
1179 void DrawRange( CWindowGc& aGc, |
|
1180 TInt aFirstField, |
|
1181 TInt aLastField, |
|
1182 TBool aSkipBackgroundDrawer = EFalse ) const; |
|
1183 |
|
1184 CWindowGc& PreparedGc() const; |
|
1185 void SetGcToNormalVideo(CWindowGc& aGc) const; |
|
1186 void SetGcToInverseVideo(CWindowGc& aGc) const; |
|
1187 void SetGcToDimmedVideo(CWindowGc& aGc) const; |
|
1188 void DrawCursor(); |
|
1189 void HideCursor(); |
|
1190 IMPORT_C void Reserved_2(); |
|
1191 IMPORT_C virtual void CEikMfne_Reserved(); |
|
1192 |
|
1193 void LaunchPenInputL(); |
|
1194 |
|
1195 private: |
|
1196 /** |
|
1197 * From CAknControl |
|
1198 */ |
|
1199 IMPORT_C void* ExtensionInterface( TUid aInterface ); |
|
1200 |
|
1201 private: |
|
1202 enum {ENullIndex=KMaxTInt}; |
|
1203 |
|
1204 /** |
|
1205 * Access to state of whether up/down keys are eaten and used to increment/decrement. If |
|
1206 * these keys are not consumed, then the events are passed on. |
|
1207 * |
|
1208 * @return EFalse iff Up and Down keys are not consumed (and acted upon) |
|
1209 */ |
|
1210 TBool ConsumesUpAndDownKeys() const; |
|
1211 |
|
1212 /** |
|
1213 * This state of enabling means that skinning will actually be drawn |
|
1214 * It is a combination of |
|
1215 * - application is skin enabled |
|
1216 * - current skin has a background or frame bitmap |
|
1217 * It is set during construction and does not change its value after except if the Skin is |
|
1218 * changed, whereupon the control context is re-accessed and checked for bitmaps present |
|
1219 * |
|
1220 * @return EFalse iff background skin will not be drawn. |
|
1221 */ |
|
1222 TBool SkinningBackground() const; |
|
1223 |
|
1224 /** |
|
1225 * Checks if app is skin enabled and that the current control context has bitmap. |
|
1226 * If so, then state is set true. |
|
1227 * This should be called at constuction and when HandleResourceChange is called |
|
1228 * |
|
1229 */ |
|
1230 void EvaluateSkinningBackground(); |
|
1231 |
|
1232 /** |
|
1233 * Access to Skins background control context that is potentially being used by the Editor. |
|
1234 * |
|
1235 * This API will first check to see if an control context has been set by API, and if so, |
|
1236 * return that. If the background control context has been set to NULL by API, then it will |
|
1237 * return NULL. If the background control context has never been set by API, then this returns |
|
1238 * the control context (if one exists) that the object obtains from Object Provider. |
|
1239 * |
|
1240 * @return Pointer to control context potentially in use, or NULL. |
|
1241 */ |
|
1242 MAknsControlContext* SkinBackgroundControlContext() const; |
|
1243 |
|
1244 /** |
|
1245 * Check for the existence of the extension and create if required. |
|
1246 */ |
|
1247 void CreateExtensionIfRequiredL(); |
|
1248 |
|
1249 private: |
|
1250 TInt iNumFields; |
|
1251 TInt iCurrentField; |
|
1252 CEikMfneField** iFields; |
|
1253 CEikMfneExtension* iExtension; |
|
1254 const CFont* iFont; |
|
1255 TInt iAlignment; |
|
1256 TBitFlags iFlags; |
|
1257 private: |
|
1258 friend class CEikTimeEditor; |
|
1259 friend class CEikTimeAndDateEditor; |
|
1260 }; |
|
1261 |
|
1262 inline TInt CEikMfne::CurrentField() const |
|
1263 { |
|
1264 return(iCurrentField); |
|
1265 } |
|
1266 |
|
1267 inline TInt CEikMfne::NumFields() const |
|
1268 { |
|
1269 return(iNumFields); |
|
1270 } |
|
1271 |
|
1272 // |
|
1273 |
|
1274 /** |
|
1275 * Integer editor. |
|
1276 * |
|
1277 * This control supports editing a single integer value. If a number is |
|
1278 * entered which is not within the range specified by the maximum and |
|
1279 * minimum control values it is automatically reset to the nearest |
|
1280 * allowable value. |
|
1281 * |
|
1282 * The editor has an associated resource struct NUMBER_EDITOR and |
|
1283 * control factory identifier EEikCtNumberEditor. |
|
1284 */ |
|
1285 class CEikNumberEditor : public CEikMfne |
|
1286 { |
|
1287 public: |
|
1288 // miscellaneous functions |
|
1289 |
|
1290 /** |
|
1291 * Constructor. |
|
1292 * |
|
1293 * This function should be used as the first stage in two stage |
|
1294 * construction, followed by a call to either ConstructFromResourceL() to |
|
1295 * initialise the editor's field values from a resource file, or ConstructL() |
|
1296 * if no resource file is used. |
|
1297 */ |
|
1298 IMPORT_C CEikNumberEditor(); |
|
1299 |
|
1300 /** |
|
1301 * Second-phase constructor. |
|
1302 * |
|
1303 * Completes the construction of an integer editor. It should be called |
|
1304 * by container only if the editor is not constructed from a resource. |
|
1305 * |
|
1306 * Sets the minimum and maximum values that can be entered into the |
|
1307 * editor, and the initial value. |
|
1308 * |
|
1309 * @param aMinimumValue The minimum allowable value. |
|
1310 * @param aMaximumValue The maximum allowable value. |
|
1311 * @param aInitialValue The initial value. |
|
1312 */ |
|
1313 IMPORT_C void ConstructL(TInt aMinimumValue, TInt aMaximumValue, TInt aInitialValue); // to be called by container only if not constructed from resource |
|
1314 |
|
1315 /** |
|
1316 * Sets the minimum and maximum editor values. |
|
1317 * |
|
1318 * Only values inside the initial minimum and maximum are permitted. |
|
1319 * |
|
1320 * If the editor's value is outside the new bounds when the function is |
|
1321 * called, it is reset to the nearest allowable value. |
|
1322 * |
|
1323 * @param aMinimumValue The minimum allowable value. |
|
1324 * @param aMaximumValue The maximum allowable value. |
|
1325 * @panic 9 If the minimum is greater than the maximum allowable value. |
|
1326 */ |
|
1327 IMPORT_C void SetMinimumAndMaximum(TInt aMinimumValue, TInt aMaximumValue); // only values inside the initial minimum and maximum are permitted |
|
1328 |
|
1329 /** |
|
1330 * Gets the integer editor's minimum and maximum values. |
|
1331 * |
|
1332 * @param aMinimumValue On return, contains the integer editor's |
|
1333 * minimum allowable value. |
|
1334 * @param aMaximumValue On return, contains the integer editor's |
|
1335 * maximum allowable value. |
|
1336 */ |
|
1337 IMPORT_C void GetMinimumAndMaximum(TInt& aMinimumValue, TInt& aMaximumValue) const; |
|
1338 |
|
1339 /** |
|
1340 * Sets the integer editor's value. |
|
1341 * |
|
1342 * The control is not redrawn. |
|
1343 * |
|
1344 * @param aNumber The editor's new value. |
|
1345 * @panic 11 In debug builds, if aNumber is outside the valid range. |
|
1346 */ |
|
1347 IMPORT_C void SetNumber(TInt aNumber); |
|
1348 |
|
1349 /** |
|
1350 * Gets the integer editor's value. |
|
1351 * |
|
1352 * @return The integer editor's value. |
|
1353 * @panic 12 In debug builds, if the editor has no content. |
|
1354 */ |
|
1355 IMPORT_C TInt Number() const; // can only be called if PrepareForFocusLossL() succeeded |
|
1356 |
|
1357 // framework |
|
1358 |
|
1359 /** |
|
1360 * Second-phase construction from a resource file. |
|
1361 * |
|
1362 * The function reads the maximum and minimum editor values from a |
|
1363 * NUMBER_EDITOR resource, and sets the initial number to be the same as the |
|
1364 * maximum value. |
|
1365 * |
|
1366 * @param aResourceReader A resource file reader. |
|
1367 */ |
|
1368 IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aResourceReader); |
|
1369 |
|
1370 // From CCoeControl |
|
1371 |
|
1372 /** |
|
1373 * From @c CCoeControl. |
|
1374 * |
|
1375 * Handles pointer events. |
|
1376 * |
|
1377 * @param aPointerEvent The pointer event. |
|
1378 */ |
|
1379 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
1380 private: |
|
1381 IMPORT_C virtual void CEikMfne_Reserved(); |
|
1382 private: |
|
1383 void RefreshFromLocale(); |
|
1384 private: |
|
1385 /** |
|
1386 * From CAknControl |
|
1387 */ |
|
1388 IMPORT_C void* ExtensionInterface( TUid aInterface ); |
|
1389 private: |
|
1390 // none of these pointers owns anything |
|
1391 CEikMfneNumber* iNumber; |
|
1392 TInt iSpare; |
|
1393 }; |
|
1394 |
|
1395 |
|
1396 // |
|
1397 /** |
|
1398 * Range struct for CEikRangeEditor. |
|
1399 */ |
|
1400 struct SEikRange |
|
1401 { |
|
1402 /** |
|
1403 * The lower limit. |
|
1404 */ |
|
1405 TInt iLowerLimit; |
|
1406 |
|
1407 /** |
|
1408 * The upper limit. |
|
1409 */ |
|
1410 TInt iUpperLimit; |
|
1411 }; |
|
1412 |
|
1413 // |
|
1414 |
|
1415 /** |
|
1416 * Numeric range editor. |
|
1417 * |
|
1418 * This editor supports editing an integer range. It has two fields; |
|
1419 * the first represents the lower value and the second the upper value. The |
|
1420 * second value must be greater than, or equal to, the first. |
|
1421 * |
|
1422 * Minimum and maximum values for the editor are specified during |
|
1423 * construction. If a number is entered which is not within the editor's |
|
1424 * minimum and maximum values, it is automatically reset to the nearest |
|
1425 * allowable value. |
|
1426 * |
|
1427 * The editor has an associated resource struct RANGE_EDITOR and |
|
1428 * control factory identifier EEikCtRangeEditor. |
|
1429 */ |
|
1430 class CEikRangeEditor : public CEikMfne |
|
1431 { |
|
1432 public: |
|
1433 // miscellaneous functions |
|
1434 |
|
1435 /** |
|
1436 * Default constructor. |
|
1437 * |
|
1438 * This function should be used as the first stage in two stage |
|
1439 * construction, followed by a call to either ConstructFromResourceL() to |
|
1440 * initialise the editor's field values from a resource file, or ConstructL() |
|
1441 * if no resource file is used. |
|
1442 */ |
|
1443 IMPORT_C CEikRangeEditor(); |
|
1444 |
|
1445 // ConstructL to be called by container only if not constructed from resource, also ownership of aSeparatorText is transferred when everything that can leave has successfully been done |
|
1446 /** |
|
1447 * Second phase constructor. |
|
1448 * |
|
1449 * This function completes construction of a range editor. It sets the |
|
1450 * minimum and maximum values, initial range and separator text. It |
|
1451 * should be called by the container only if the control is not constructed |
|
1452 * from a resource file. |
|
1453 * |
|
1454 * @param aMinimumValue The minimum value for the range editor. |
|
1455 * @param aMaximumValue The maximum value for the range editor. |
|
1456 * @param aInitialRange Struct containing upper and lower range limits. |
|
1457 * Must be within the minimum and maximum values. |
|
1458 * @param aSeparatorText The text to be used to separate the numeric |
|
1459 * values. |
|
1460 * @panic 8 If the initial lower or upper limit is outside the minimum |
|
1461 * or maximum bounds. |
|
1462 */ |
|
1463 IMPORT_C void ConstructL(TInt aMinimumValue, TInt aMaximumValue, const SEikRange& aInitialRange, HBufC* aSeparatorText); |
|
1464 |
|
1465 /** |
|
1466 * Sets the range editor's minimum and maximum values. |
|
1467 * |
|
1468 * Any values are permitted. If the range values are outside the new |
|
1469 * minimum / maximum they are changed to be within the new minimum / |
|
1470 * maximum. |
|
1471 * |
|
1472 * @param aMinimumValue The minimum value for the range editor. |
|
1473 * @param aMaximumValue The maximum value for the range editor. |
|
1474 */ |
|
1475 IMPORT_C void SetMinimumAndMaximum(TInt aMinimumValue, TInt aMaximumValue); // only values inside the initial minimum and maximum are permitted |
|
1476 |
|
1477 /** |
|
1478 * Gets the range editor's minimum and maximum values. |
|
1479 * |
|
1480 * @param aMinimumValue On return, the minimum value for the range |
|
1481 * editor. |
|
1482 * @param aMaximumValue On return, the maximum value for the range |
|
1483 * editor. |
|
1484 */ |
|
1485 IMPORT_C void GetMinimumAndMaximum(TInt& aMinimumValue, TInt& aMaximumValue) const; |
|
1486 |
|
1487 /** |
|
1488 * Sets the range editor's current values. |
|
1489 * |
|
1490 * @param aRange Struct containing new range values. |
|
1491 */ |
|
1492 IMPORT_C void SetRange(const SEikRange& aRange); |
|
1493 |
|
1494 /** |
|
1495 * Gets the range editor's current values. |
|
1496 * |
|
1497 * Can only be called if CEikMfne::PrepareForFocusLossL() succeeded |
|
1498 * |
|
1499 * @return Struct containing current range values. |
|
1500 */ |
|
1501 IMPORT_C SEikRange Range() const; // can only be called if PrepareForFocusLossL() succeeded |
|
1502 |
|
1503 // framework |
|
1504 |
|
1505 /** |
|
1506 * Second phase constructor from resource. |
|
1507 * |
|
1508 * This function completes construction of a newly-allocated range |
|
1509 * editor. It sets the minimum and maximum values, initial range and |
|
1510 * separator text as specified by the resource. |
|
1511 * |
|
1512 * @param aResourceReader A resource reader. |
|
1513 */ |
|
1514 IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aResourceReader); |
|
1515 |
|
1516 // From CCoeControl |
|
1517 |
|
1518 /** |
|
1519 * From @c CCoeControl. |
|
1520 * |
|
1521 * Handles pointer events. |
|
1522 * |
|
1523 * @param aPointerEvent The pointer event. |
|
1524 */ |
|
1525 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
1526 private: |
|
1527 virtual void FieldIsAboutToBeDeHighlighted(CEikMfneField* aField, TBool& aDrawAllFields); |
|
1528 IMPORT_C virtual void CEikMfne_Reserved(); |
|
1529 void RefreshFromLocale(); |
|
1530 private: |
|
1531 /** |
|
1532 * From CAknControl |
|
1533 */ |
|
1534 IMPORT_C void* ExtensionInterface( TUid aInterface ); |
|
1535 private: |
|
1536 // none of these pointers owns anything |
|
1537 CEikMfneNumber* iLowerLimit; |
|
1538 CEikMfneNumber* iUpperLimit; |
|
1539 TInt iSpare; |
|
1540 }; |
|
1541 |
|
1542 |
|
1543 // |
|
1544 |
|
1545 /** |
|
1546 * Specifies an abstract interface for time and date editors where the |
|
1547 * time and date are set and retrieved using the TTime class. |
|
1548 */ |
|
1549 class CEikTTimeEditor : public CEikMfne |
|
1550 { |
|
1551 public: |
|
1552 /** |
|
1553 * An implementation (of this pure virtual function) should set the |
|
1554 * range of allowable time values. |
|
1555 * |
|
1556 * This defines the maximum and minimum values that may be entered by |
|
1557 * the user. |
|
1558 * |
|
1559 * @param aMinimumTime The minimum allowable value. |
|
1560 * @param aMaximumTime The maximum allowable value. |
|
1561 */ |
|
1562 virtual void SetMinimumAndMaximum(const TTime& aMinimumTime, const TTime& aMaximumTime)=0; |
|
1563 |
|
1564 /** |
|
1565 * An implementation (of this pure virtual function) should get the |
|
1566 * range of allowable time values. |
|
1567 * |
|
1568 * @param aMinimumTime The minimum allowable value. |
|
1569 * @param aMaximum The maximum allowable value. |
|
1570 */ |
|
1571 virtual void GetMinimumAndMaximum(TTime& aMinimumTime, TTime& aMaximum) const=0; |
|
1572 |
|
1573 /** |
|
1574 * An implementation (of this pure virtual function) should set the time |
|
1575 * in the editor. |
|
1576 * |
|
1577 * @param aTime The time. |
|
1578 */ |
|
1579 virtual void SetTTime(const TTime& aTime)=0; |
|
1580 |
|
1581 /** |
|
1582 * An implementation (of this pure virtual function) should get the time |
|
1583 * from the editor. |
|
1584 * |
|
1585 * Can only be called if CEikMfne::PrepareForFocusLossL() succeeded. |
|
1586 * |
|
1587 * @return The time. |
|
1588 */ |
|
1589 virtual TTime GetTTime() const=0; // can only be called if PrepareForFocusLossL() succeeded |
|
1590 }; |
|
1591 |
|
1592 /** |
|
1593 * Time editor. |
|
1594 * |
|
1595 * This control allows a time value to be displayed and edited. By |
|
1596 * default the editor has hours, minutes and seconds fields, although the |
|
1597 * seconds and hours fields may be omitted. 12 and 24-hour format are |
|
1598 * supported. When 12-hour format is used, am or pm text will be included as |
|
1599 * another field, either before or after the time. Locale information is |
|
1600 * used to determine the time separator characters. Locale information is |
|
1601 * set and retrieved using class TLocale. |
|
1602 * |
|
1603 * The upper and lower field bounds are set depending on the format, |
|
1604 * and times outside these bounds are invalid. |
|
1605 * |
|
1606 * The editor has an associated resource struct TIME_EDITOR and control |
|
1607 * factory identifier EEikCtTimeEditor. |
|
1608 */ |
|
1609 class CEikTimeEditor : public CEikTTimeEditor |
|
1610 { |
|
1611 public: |
|
1612 // miscellaneous functions |
|
1613 /** |
|
1614 * Default constructor. |
|
1615 * |
|
1616 * This function should be used as the first stage in two stage |
|
1617 * construction, followed by a call to either: ConstructFromResourceL() to |
|
1618 * initialise the editor's field values from a resource file, or ConstructL() |
|
1619 * if no resource file is used. |
|
1620 */ |
|
1621 IMPORT_C CEikTimeEditor(); |
|
1622 |
|
1623 /** |
|
1624 * Destructor. |
|
1625 * |
|
1626 * This frees the resources owned by the time editor, prior to its |
|
1627 * destruction. |
|
1628 */ |
|
1629 IMPORT_C virtual ~CEikTimeEditor(); |
|
1630 |
|
1631 /** |
|
1632 * Second phase construction. |
|
1633 * |
|
1634 * This function completes the construction of a newly-allocated time |
|
1635 * editor, by setting its minimum, maximum and initial values, and the |
|
1636 * AM/PM text settings - the AM/PM settings and time separator characters |
|
1637 * specified in class TLocale are honoured. It should be called by the |
|
1638 * container only if the control is not constructed from a resource file. |
|
1639 * |
|
1640 * If the initial time is outside the bounds specified, it is reset to |
|
1641 * the nearest available setting. |
|
1642 * |
|
1643 * The aFlags parameter is used to determine whether the seconds or |
|
1644 * hours fields are required. The minutes field is always present. It may |
|
1645 * also be used to specify whether or not to force 24 hour time format, |
|
1646 * overriding the locale's setting. |
|
1647 * |
|
1648 * A panic will occur if the minimum time is later than the maximum |
|
1649 * time. |
|
1650 * |
|
1651 * @param aMinimumTime The minimum allowable time. |
|
1652 * @param aMaximumTime The maximum allowable time. |
|
1653 * @param aInitialTime The initial time. |
|
1654 * @param aFlags Determines which fields are required and whether or |
|
1655 * not to force 24 hour formatting. See eikon.hrh EEiktime etc. |
|
1656 */ |
|
1657 IMPORT_C void ConstructL(const TTime& aMinimumTime, const TTime& aMaximumTime, const TTime& aInitialTime, TUint32 aFlags); // to be called by container only if not constructed from resource |
|
1658 |
|
1659 /** |
|
1660 * Sets the time editor's value. |
|
1661 * |
|
1662 * @param aTime The new value to which to set the editor's fields. |
|
1663 */ |
|
1664 IMPORT_C void SetTime(const TTime& aTime); |
|
1665 |
|
1666 /** |
|
1667 * Gets the time editor's value. |
|
1668 * |
|
1669 * @return The editor's value. (Date values are all zero.) |
|
1670 */ |
|
1671 IMPORT_C TTime Time() const; |
|
1672 |
|
1673 /** |
|
1674 * Sets the uninitialized status of the editor. |
|
1675 * |
|
1676 * @param aUninitialised If ETrue, sets the editor as uninitialized, |
|
1677 * i.e. it doesn't display anything. |
|
1678 */ |
|
1679 IMPORT_C void SetUninitialised(TBool aUninitialised); |
|
1680 |
|
1681 /** |
|
1682 * Gets the uninitialized status of the editor. |
|
1683 * |
|
1684 * @return ETrue, if the editor is set as uninitialized. |
|
1685 */ |
|
1686 IMPORT_C TBool IsUninitialised() const; |
|
1687 // from CEikTTimeEditor |
|
1688 |
|
1689 /** |
|
1690 * Sets the range of allowable time values. |
|
1691 * |
|
1692 * These define the maximum and minimum values that may be entered by |
|
1693 * the user. |
|
1694 * |
|
1695 * If the existing time value is outside the bounds set by this |
|
1696 * function, it is reset to the nearest boundary value. |
|
1697 * |
|
1698 * @param aMinimumTime The minimum allowable value. |
|
1699 * @param aMaximumTime The maximum allowable value. |
|
1700 * @panic 38 If the minimum value exceeds the maximum. |
|
1701 */ |
|
1702 IMPORT_C virtual void SetMinimumAndMaximum(const TTime& aMinimumTime, const TTime& aMaximumTime); // only values inside the initial minimum and maximum are permitted |
|
1703 |
|
1704 /** |
|
1705 * Gets the range of allowable values that may be entered by the user. |
|
1706 * |
|
1707 * @param aMinimumTime On return, contains the time editor's minimum |
|
1708 * allowable value. |
|
1709 * @param aMaximumTime On return, contains the time editor's maximum |
|
1710 * allowable value. |
|
1711 */ |
|
1712 IMPORT_C virtual void GetMinimumAndMaximum(TTime& aMinimumTime, TTime& aMaximumTime) const; |
|
1713 |
|
1714 // from CCoeControl |
|
1715 |
|
1716 /** |
|
1717 * Second phase construction from a resource. |
|
1718 * |
|
1719 * This function completes the construction of a newly-allocated time |
|
1720 * editor from a TIME_EDITOR resource. The minimum and maximum times, and |
|
1721 * the flags settings are read from the resource, and ConstructL() is |
|
1722 * called with these settings. The initial time is set to the maximum time |
|
1723 * value. Honours the locale's AM/PM text setting and time separators. |
|
1724 * |
|
1725 * @param aResourceReader A resource file reader. |
|
1726 * |
|
1727 */ |
|
1728 IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aResourceReader); |
|
1729 |
|
1730 /** |
|
1731 * Prepares the editor for focus loss. |
|
1732 * |
|
1733 * This function should be called to validate the editor's contents |
|
1734 * when an attempt is made to remove focus from the control. If the control |
|
1735 * value is not within the bounds specified by the minimum and maximum |
|
1736 * time values, it is reset to the nearest allowable value, the function |
|
1737 * will leave and will display an appropriate message. |
|
1738 */ |
|
1739 IMPORT_C virtual void PrepareForFocusLossL(); |
|
1740 |
|
1741 /** |
|
1742 * From @c CCoeControl. |
|
1743 * |
|
1744 * Handles pointer events. |
|
1745 * |
|
1746 * @param aPointerEvent The pointer event. |
|
1747 */ |
|
1748 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
1749 private: |
|
1750 // from CEikTTimeEditor |
|
1751 virtual void SetTTime(const TTime& aTime); |
|
1752 virtual TTime GetTTime() const; // can only be called if PrepareForFocusLossL() succeeded |
|
1753 private: |
|
1754 // miscellaneous functions |
|
1755 void DoSetMinimumAndMaximum(const TTime& aMinimumTime, const TTime& aMaximumTime); |
|
1756 IMPORT_C virtual void CEikMfne_Reserved(); |
|
1757 private: |
|
1758 /** |
|
1759 * From CAknControl |
|
1760 */ |
|
1761 IMPORT_C void* ExtensionInterface( TUid aInterface ); |
|
1762 void ChangeAmPm(); |
|
1763 |
|
1764 private: |
|
1765 CTimeEditor* iTimeEditor; |
|
1766 TTime iMinimumTime; |
|
1767 TTime iMaximumTime; |
|
1768 CEikTimeEditorExtension* iTimeExtension; |
|
1769 |
|
1770 private: |
|
1771 friend class CEikTimeEditorExtension; |
|
1772 }; |
|
1773 |
|
1774 |
|
1775 // |
|
1776 |
|
1777 // note: TDateTime uses zero based day numbers, so -1 on the day field |
|
1778 #define KAknMinimumDate (TTime(TDateTime(0001, EJanuary, 1-1, 0, 0, 0, 0))) |
|
1779 #define KAknMaximumDate (TTime(TDateTime(9999, EDecember, 31-1, 23, 59, 59, 999999))) |
|
1780 |
|
1781 /** |
|
1782 * Date editor. |
|
1783 * |
|
1784 * A date editor has five fields: day, month and year, and two separator |
|
1785 * characters. The order of the fields varies depending on the locale's |
|
1786 * date format setting. Locale information, which is set and retrieved using |
|
1787 * class @c TLocale, is used to determine field order and the characters used |
|
1788 * to separate the date components. The upper and lower field bounds are set, |
|
1789 * and dates outside these bounds are invalid. |
|
1790 * |
|
1791 * The editor can be configured to launch a pop-out calendar dialog, |
|
1792 * @c CEikCalendar. This may be used to directly set the day, month and year |
|
1793 * values. |
|
1794 * |
|
1795 * The editor has an associated resource struct @c DATE_EDITOR and control |
|
1796 * factory identifier @c EEikCtDateEditor. |
|
1797 * |
|
1798 */ |
|
1799 class CEikDateEditor : public CEikTTimeEditor, private MEikCalendarObserver |
|
1800 { |
|
1801 |
|
1802 public: |
|
1803 |
|
1804 // miscellaneous functions |
|
1805 /** |
|
1806 * C++ default constructor. |
|
1807 */ |
|
1808 IMPORT_C CEikDateEditor(); |
|
1809 |
|
1810 /** |
|
1811 * Destructor. |
|
1812 */ |
|
1813 IMPORT_C virtual ~CEikDateEditor(); |
|
1814 |
|
1815 // to be called by container only if not constructed from resource |
|
1816 /** |
|
1817 * Handles 2nd phase construction. |
|
1818 * |
|
1819 * This function completes the construction of a newly-allocated date |
|
1820 * editor. This function should be used instead of |
|
1821 * @c ConstructFromResourceL() when not initialising from a resource file. |
|
1822 * The editor's minimum, maximum and initial date values are set and the |
|
1823 * date format and date separator characters specified in class @c TLocale |
|
1824 * are honoured. |
|
1825 * |
|
1826 * @param aMinimumDate The minimum allowable date. |
|
1827 * @param aMaximumDate The maximum allowable date. |
|
1828 * @param aInitialDate The initial value. |
|
1829 * @param aWithoutPopoutCalendar If @c ETrue the editor will not have a |
|
1830 * pop-out calendar dialog / icon. If @c EFalse the editor will have |
|
1831 * a pop-out calendar dialog / icon. |
|
1832 */ |
|
1833 IMPORT_C void ConstructL(const TTime& aMinimumDate, |
|
1834 const TTime& aMaximumDate, |
|
1835 const TTime& aInitialDate, |
|
1836 TBool aWithoutPopoutCalendar); |
|
1837 |
|
1838 /** |
|
1839 * Sets the date editor's value. |
|
1840 * |
|
1841 * @param aDate The editor's value. Time components are ignored. |
|
1842 */ |
|
1843 IMPORT_C void SetDate(const TTime& aDate); |
|
1844 |
|
1845 /** |
|
1846 * Gets the date editor's value. |
|
1847 * |
|
1848 * @return The editor's date value. |
|
1849 */ |
|
1850 IMPORT_C TTime Date() const; |
|
1851 |
|
1852 /** |
|
1853 * Sets date editor to initialised or uninitialised. |
|
1854 * |
|
1855 * @param aUninitialised If @c ETrue then the date editor is set |
|
1856 * to be uninitialised. |
|
1857 */ |
|
1858 IMPORT_C void SetUninitialised(TBool aUninitialised); |
|
1859 |
|
1860 /** |
|
1861 * Tests whether the editor is uninitialised. |
|
1862 * |
|
1863 * @return @c ETrue if uninitialised. |
|
1864 */ |
|
1865 IMPORT_C TBool IsUninitialised() const; |
|
1866 |
|
1867 // from CEikTTimeEditor |
|
1868 // only values inside the initial minimum and maximum are permitted |
|
1869 /** |
|
1870 * From @c CEikTTimeEditor. |
|
1871 * |
|
1872 * Sets the minimum and maximum allowable dates. |
|
1873 * |
|
1874 * If the current date is outside the new bounds it is changed to be within |
|
1875 * them. |
|
1876 * |
|
1877 * @param aMinimumDate The minimum allowable value. |
|
1878 * @param aMaximumDate The maximum allowable value. |
|
1879 */ |
|
1880 IMPORT_C virtual void SetMinimumAndMaximum(const TTime& aMinimumDate, |
|
1881 const TTime& aMaximumDate); |
|
1882 |
|
1883 /** |
|
1884 * From @c CEikTTimeEditor. |
|
1885 * |
|
1886 * Gets the date editor's minimum and maximum values. |
|
1887 * |
|
1888 * @param aMinimumDate On return, the minimum allowable value. |
|
1889 * @param aMaximumDate On return, the maximum allowable value. |
|
1890 */ |
|
1891 IMPORT_C virtual void GetMinimumAndMaximum(TTime& aMinimumDate, |
|
1892 TTime& aMaximumDate) const; |
|
1893 |
|
1894 // from CCoeControl |
|
1895 /** |
|
1896 * From @c CCoeControl. |
|
1897 * |
|
1898 * Handles key events. |
|
1899 * |
|
1900 * @param aKeyEvent The key event. |
|
1901 * @param aType The type of key event. |
|
1902 * @return @c EKeyConsumed if the key has beend handled. |
|
1903 */ |
|
1904 IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, |
|
1905 TEventCode aType); |
|
1906 |
|
1907 /** |
|
1908 * From @c CCoeControl. |
|
1909 * |
|
1910 * Second-phase construction from a resource file. |
|
1911 * |
|
1912 * The function reads the maximum and minimum date values and whether |
|
1913 * or not the editor should support a pop-out calendar and/or date icon |
|
1914 * from a @c DATE_EDITOR resource. It sets the initial date to be the same |
|
1915 * as the maximum date and honours the locale's date format and separators. |
|
1916 * |
|
1917 * @param aResourceReader A resource file reader. |
|
1918 */ |
|
1919 IMPORT_C virtual void ConstructFromResourceL(TResourceReader& |
|
1920 aResourceReader); |
|
1921 |
|
1922 /** |
|
1923 * From @c CCoeControl. |
|
1924 * |
|
1925 * Editor validation. |
|
1926 * |
|
1927 * This function should be called before an attempt is made to remove focus |
|
1928 * from a date editor. If the control value is not within the bounds |
|
1929 * specified by the minimum and maximum date values, it is reset to the |
|
1930 * nearest allowable value, the function then leaves. |
|
1931 */ |
|
1932 IMPORT_C virtual void PrepareForFocusLossL(); |
|
1933 |
|
1934 /** |
|
1935 * From @c CCoeControl. |
|
1936 * |
|
1937 * Handles pointer events. |
|
1938 * |
|
1939 * @param aPointerEvent The pointer event. |
|
1940 */ |
|
1941 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
1942 |
|
1943 private: |
|
1944 |
|
1945 // from CEikMfne |
|
1946 virtual void CreatePopoutIfRequiredL(); |
|
1947 // from CEikTTimeEditor |
|
1948 virtual void SetTTime(const TTime& aDate); |
|
1949 virtual TTime GetTTime() const; // can only be called if PrepareForFocusLossL() succeeded |
|
1950 |
|
1951 private: |
|
1952 |
|
1953 // from MEikCalendarDialogObserver |
|
1954 virtual void GetMinimumAndMaximumAndInitialDatesForCalendarL(TTime& aMinimumDate, |
|
1955 TTime& aMaximumDate, |
|
1956 TTime& aInitialDate) const; |
|
1957 virtual void SetDateFromCalendarAndDrawNow(const TTime& aDate); |
|
1958 // miscellaneous functions |
|
1959 void DoSetMinimumAndMaximum(const TTime& aMinimumDate, const TTime& aMaximumDate); |
|
1960 IMPORT_C virtual void CEikMfne_Reserved(); |
|
1961 |
|
1962 private: |
|
1963 |
|
1964 /** |
|
1965 * From CAknControl |
|
1966 */ |
|
1967 IMPORT_C void* ExtensionInterface( TUid aInterface ); |
|
1968 |
|
1969 private: |
|
1970 |
|
1971 CDateEditor* iDateEditor; |
|
1972 TTime iMinimumDate; |
|
1973 TTime iMaximumDate; |
|
1974 TInt iSpare; |
|
1975 }; |
|
1976 |
|
1977 |
|
1978 // |
|
1979 |
|
1980 /** |
|
1981 * Time and date editor. |
|
1982 * |
|
1983 * This control allows both a time and date to be displayed and edited. |
|
1984 * It contains the following time fields: hours, minutes and seconds, |
|
1985 * two time separator characters and am/pm text, and the following date |
|
1986 * fields: year, month and day, with two date separator characters. The |
|
1987 * seconds and hours fields are optional and the order of the date fields and |
|
1988 * the separator characters are locale-dependent. The upper and lower |
|
1989 * field bounds are set, and dates and times outside these bounds are |
|
1990 * invalid. |
|
1991 * |
|
1992 * Date field values may be edited directly or via a pop-out calendar |
|
1993 * dialog. |
|
1994 * |
|
1995 * The editor has an associated resource struct TIME_AND_DATE_EDITOR |
|
1996 * and control factory identifier EEikCtTimeAndDateEditor. |
|
1997 */ |
|
1998 class CEikTimeAndDateEditor : public CEikTTimeEditor, private MEikCalendarObserver |
|
1999 { |
|
2000 public: |
|
2001 // miscellaneous functions |
|
2002 |
|
2003 /** |
|
2004 * Default constructor. |
|
2005 * |
|
2006 * This function should be used as the first stage in two stage |
|
2007 * construction, followed by a call to either ConstructFromResourceL() to |
|
2008 * initialise the editor's field values from a resource file, or ConstructL() |
|
2009 * (if no resource file is used). |
|
2010 */ |
|
2011 IMPORT_C CEikTimeAndDateEditor(); |
|
2012 |
|
2013 /** |
|
2014 * Destructor. |
|
2015 * |
|
2016 * This frees the resources owned by the time and date editor, prior to |
|
2017 * its destruction. |
|
2018 */ |
|
2019 IMPORT_C virtual ~CEikTimeAndDateEditor(); |
|
2020 |
|
2021 // ConstructL to be called by container only if not constructed from resource, also ownership of aInterveningText is transferred when everything that can leave has successfully been done |
|
2022 |
|
2023 /** |
|
2024 * Second phase construction. |
|
2025 * |
|
2026 * This function completes construction of a newly-allocated date and |
|
2027 * time editor, by setting the minimum, maximum and initial date and time |
|
2028 * values. It should be called by the container only if the control is |
|
2029 * not constructed from a resource file. |
|
2030 * |
|
2031 * The aFlags parameter is used to set whether the seconds or hours |
|
2032 * fields are not required. The minutes field is always present. It may also |
|
2033 * be used to specify whether or not to force 24 hour time format, |
|
2034 * overriding the locale's setting, and whether the editor should have a |
|
2035 * pop-out calendar dialog. |
|
2036 * |
|
2037 * The locale-dependant date and time settings specified in class |
|
2038 * TLocale are honoured. |
|
2039 * |
|
2040 * If the initial date/time is outside the bounds specified by the |
|
2041 * minimum and maximum, it is set to the nearest valid setting. |
|
2042 * |
|
2043 * A panic will occur if the minimum date/time is later than the |
|
2044 * maximum date/time. |
|
2045 * |
|
2046 * @param aMinimumTimeAndDate The minimum date and time value. |
|
2047 * @param aMaximumTimeAndDate The maximum date and time value. |
|
2048 * @param aInitialTimeAndDate The initial date and time value. |
|
2049 * @param aFlags A bitmask of flags. See eikon.hrh file, EEikTime, |
|
2050 * EEikDate etc. |
|
2051 * @param aInterveningText Descriptor containing the text to use to |
|
2052 * separate the time and date portions of the editor. |
|
2053 */ |
|
2054 IMPORT_C void ConstructL(const TTime& aMinimumTimeAndDate, const TTime& aMaximumTimeAndDate, const TTime& aInitialTimeAndDate, TUint32 aFlags, HBufC* aInterveningText=NULL); |
|
2055 |
|
2056 /** |
|
2057 * Sets the values of the time and date editor's fields. |
|
2058 * |
|
2059 * @param aTimeAndDate The new value for the date and time editor's |
|
2060 * fields. |
|
2061 */ |
|
2062 IMPORT_C void SetTimeAndDate(const TTime& aTimeAndDate); |
|
2063 |
|
2064 /** |
|
2065 * Gets the time and date editor's value. |
|
2066 * |
|
2067 * @return The editor's value. |
|
2068 */ |
|
2069 IMPORT_C TTime TimeAndDate() const; |
|
2070 |
|
2071 /** |
|
2072 * Sets the uninitialized status of the editor. |
|
2073 * |
|
2074 * @param aUninitialised If ETrue, sets the editor as uninitialized, |
|
2075 * i.e. it doesn't display anything. |
|
2076 */ |
|
2077 IMPORT_C void SetUninitialised(TBool aUninitialised); |
|
2078 |
|
2079 /** |
|
2080 * Gets the uninitialized status of the editor. |
|
2081 * |
|
2082 * @return ETrue, if the editor is set as uninitialized. |
|
2083 */ |
|
2084 IMPORT_C TBool IsUninitialised() const; |
|
2085 |
|
2086 // from CEikTTimeEditor |
|
2087 |
|
2088 /** |
|
2089 * Sets the range of allowable values. |
|
2090 * |
|
2091 * These define the maximum and minimum time/date values that may be |
|
2092 * entered by the user. |
|
2093 * |
|
2094 * If the existing date/time value is outside the new bounds, it is |
|
2095 * reset to the nearest allowable value. |
|
2096 * |
|
2097 * @param aMinimumTimeAndDate The minimum allowable value. |
|
2098 * @param aMaximumTimeAndDate The maximum allowable value. |
|
2099 */ |
|
2100 IMPORT_C virtual void SetMinimumAndMaximum(const TTime& aMinimumTimeAndDate, const TTime& aMaximumTimeAndDate); // only values inside the initial minimum and maximum are permitted |
|
2101 |
|
2102 /** |
|
2103 * Gets the range of allowable values that may be entered by the user. |
|
2104 * |
|
2105 * @param aMinimumTimeAndDate On return, contains the time and date |
|
2106 * editor's minimum allowable value. |
|
2107 * @param aMaximumTimeAndDate On return, contains the time and date |
|
2108 * editor's maximum allowable value. |
|
2109 */ |
|
2110 IMPORT_C virtual void GetMinimumAndMaximum(TTime& aMinimumTimeAndDate, TTime& aMaximumTimeAndDate) const; |
|
2111 |
|
2112 // from CCoeControl |
|
2113 |
|
2114 /** |
|
2115 * Handles key events. |
|
2116 * |
|
2117 * For example, the Tab key validates and launches a calendar popout. |
|
2118 * |
|
2119 * Calls CEikMfne::OfferKeyEventL() if the control does not consume the |
|
2120 * key. |
|
2121 * |
|
2122 * @param aKeyEvent The key event. |
|
2123 * @param aType The type of key event. |
|
2124 * @return Returns EKeyWasConsumed if the control consumes the key. |
|
2125 */ |
|
2126 IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); |
|
2127 |
|
2128 /** |
|
2129 * Second phase construction from a resource. |
|
2130 * |
|
2131 * This function completes the construction of a newly-allocated |
|
2132 * date/time editor from a TIME_AND_DATE_EDITOR resource. The minimum and |
|
2133 * maximum date/times, the date and time flag settings, and the intervening |
|
2134 * text are read from the resource, and ConstructL() is called with these |
|
2135 * settings. The initial date/time is set to the maximum date/time value. |
|
2136 * |
|
2137 * @param aResourceReader A resource file reader. |
|
2138 */ |
|
2139 IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aResourceReader); |
|
2140 |
|
2141 /** |
|
2142 * Prepares the editor for focus loss. |
|
2143 * |
|
2144 * This function should be called to validate the editor's contents |
|
2145 * when an attempt is made to remove focus from the control. If the control |
|
2146 * value is not within the bounds specified by the minimum and maximum |
|
2147 * date/time values, it is reset to the nearest allowable value, the |
|
2148 * function will leave and display an appropriate message. |
|
2149 */ |
|
2150 IMPORT_C virtual void PrepareForFocusLossL(); |
|
2151 |
|
2152 /** |
|
2153 * From @c CCoeControl. |
|
2154 * |
|
2155 * Handles pointer events. |
|
2156 * |
|
2157 * @param aPointerEvent The pointer event. |
|
2158 */ |
|
2159 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
2160 |
|
2161 private: |
|
2162 // from CEikMfne |
|
2163 virtual void CreatePopoutIfRequiredL(); |
|
2164 IMPORT_C virtual void CEikMfne_Reserved(); |
|
2165 // from CEikTTimeEditor |
|
2166 virtual void SetTTime(const TTime& aTimeAndDate); |
|
2167 virtual TTime GetTTime() const; // can only be called if PrepareForFocusLossL() succeeded |
|
2168 private: |
|
2169 // from MEikCalendarDialogObserver |
|
2170 virtual void GetMinimumAndMaximumAndInitialDatesForCalendarL(TTime& aMinimumDate, TTime& aMaximumDate, TTime& aInitialDate) const; |
|
2171 virtual void SetDateFromCalendarAndDrawNow(const TTime& aDate); |
|
2172 // miscellaneous functions |
|
2173 void DoSetMinimumAndMaximum(const TTime& aMinimumTimeAndDate, const TTime& aMaximumTimeAndDate); |
|
2174 private: |
|
2175 /** |
|
2176 * From CAknControl |
|
2177 */ |
|
2178 IMPORT_C void* ExtensionInterface( TUid aInterface ); |
|
2179 void ChangeAmPm(); |
|
2180 |
|
2181 private: |
|
2182 CTimeEditor* iTimeEditor; |
|
2183 CDateEditor* iDateEditor; |
|
2184 TTime iMinimumTimeAndDate; |
|
2185 TTime iMaximumTimeAndDate; |
|
2186 CEikTimeAndDateEditorExtension* iTimeDateExtension; |
|
2187 private: |
|
2188 friend class CEikTimeAndDateEditorExtension; |
|
2189 }; |
|
2190 |
|
2191 |
|
2192 // |
|
2193 |
|
2194 /** |
|
2195 * Duration editor. |
|
2196 * |
|
2197 * The duration editor allows a time duration to be displayed and |
|
2198 * edited. The editor has a clock icon and an edit field with separators for |
|
2199 * hours, minutes, and seconds. These fields can all be suppressed using |
|
2200 * the appropriate flags in the resource declaration. |
|
2201 * |
|
2202 * Unlike the time editor control, the duration editor has no am or pm |
|
2203 * text. This is because the duration is a length of time (from 0 to 24 |
|
2204 * hours), rather than a point in time. |
|
2205 * |
|
2206 * The minimum and maximum values are set, and values outside these |
|
2207 * limits are invalid. |
|
2208 * |
|
2209 * The editor has an associated resource struct DURATION_EDITOR and |
|
2210 * control factory identifier EEikCtDurationEditor. |
|
2211 */ |
|
2212 class CEikDurationEditor : public CEikMfne |
|
2213 { |
|
2214 public: |
|
2215 // miscellaneous functions |
|
2216 |
|
2217 /** |
|
2218 * Default constructor. |
|
2219 * |
|
2220 * This function should be used as the first stage in two stage |
|
2221 * construction, followed by a call to either ConstructFromResourceL() to |
|
2222 * initialise the editor's field values from a resource file, or ConstructL() |
|
2223 * if no resource file is used. |
|
2224 */ |
|
2225 IMPORT_C CEikDurationEditor(); |
|
2226 |
|
2227 /** |
|
2228 * Destructor. |
|
2229 * |
|
2230 * The destructor frees the resources owned by the duration editor, |
|
2231 * prior to its destruction. |
|
2232 */ |
|
2233 IMPORT_C virtual ~CEikDurationEditor(); |
|
2234 |
|
2235 /** |
|
2236 * Second phase construction. |
|
2237 * |
|
2238 * This function completes the construction of a newly-allocated |
|
2239 * duration editor. This function should be used instead of |
|
2240 * ConstructFromResourceL() when not initialising from a resource file. |
|
2241 * |
|
2242 * The function sets the editor's minimum, maximum and initial values. |
|
2243 * The time separator characters specified in class TLocale are honoured. |
|
2244 * If the initial duration is less than the minimum value the minimum |
|
2245 * value is used as the initial setting. If the initial duration is greater |
|
2246 * than the maximum value the maximum value is used as the initial |
|
2247 * setting. |
|
2248 * |
|
2249 * The aFlags parameter is used to determine whether the seconds or |
|
2250 * hours fields are not required. The minutes field is always present. |
|
2251 * Regardless of the value specified in aFlags, 24 hour time format is set, |
|
2252 * overriding the locale's setting. |
|
2253 * |
|
2254 * @param aMinimumDuration The minimum interval in seconds. |
|
2255 * @param aMaximumDuration The maximum interval in seconds. |
|
2256 * @param aInitialDuration The initial interval in seconds. |
|
2257 * @param aFlags Duration editor flags. |
|
2258 */ |
|
2259 IMPORT_C void ConstructL(const TTimeIntervalSeconds& aMinimumDuration, const TTimeIntervalSeconds& aMaximumDuration, const TTimeIntervalSeconds& aInitialDuration, TUint32 aFlags); |
|
2260 |
|
2261 /** |
|
2262 * Sets the minimum and maximum duration values. |
|
2263 * |
|
2264 * The user can only enter values between these bounds. |
|
2265 * |
|
2266 * @param aMinimumDuration The minimum duration. |
|
2267 * @param aMaximumDuration The maximum duration. |
|
2268 * @panic 48 If the minimum duration exceeds the maximum. |
|
2269 */ |
|
2270 IMPORT_C void SetMinimumAndMaximum(const TTimeIntervalSeconds& aMinimumDuration, const TTimeIntervalSeconds& aMaximumDuration); // only values inside the initial minimum and maximum are permitted |
|
2271 |
|
2272 /** |
|
2273 * Gets the duration editor's minimum and maximum values. |
|
2274 * |
|
2275 * @param aMinimumDuration On return, the minimum value. |
|
2276 * @param aMaximumDuration On return, the maximum value. |
|
2277 */ |
|
2278 IMPORT_C void GetMinimumAndMaximum(TTimeIntervalSeconds& aMinimumDuration, TTimeIntervalSeconds& aMaximumDuration) const; |
|
2279 |
|
2280 /** |
|
2281 * Sets the duration editor's value. |
|
2282 * |
|
2283 * @param aDuration The new value to convert into hours, minutes and |
|
2284 * seconds and to which the duration editor's fields will be set. |
|
2285 */ |
|
2286 IMPORT_C void SetDuration(const TTimeIntervalSeconds& aDuration); |
|
2287 |
|
2288 /** |
|
2289 * Gets the duration editor's value and returns it as a period of |
|
2290 * seconds. |
|
2291 * |
|
2292 * @return The editor's value in seconds. |
|
2293 */ |
|
2294 IMPORT_C TTimeIntervalSeconds Duration() const; // can only be called if PrepareForFocusLossL() succeeded |
|
2295 |
|
2296 // framework |
|
2297 |
|
2298 /** |
|
2299 * Second-phase construction from a resource. |
|
2300 * |
|
2301 * The function reads the maximum and minimum duration values, and the |
|
2302 * flags settings, from a DURATION_EDITOR resource. It sets the initial |
|
2303 * duration to be the same as the maximum value and honours the locale's |
|
2304 * time separators. |
|
2305 * |
|
2306 * @param aResourceReader A resource file reader. |
|
2307 */ |
|
2308 IMPORT_C void ConstructFromResourceL(TResourceReader& aResourceReader); |
|
2309 |
|
2310 /** |
|
2311 * Editor validation. |
|
2312 * |
|
2313 * This function should be called when an attempt is made to remove |
|
2314 * focus from a duration editor. If the editor value is not within the |
|
2315 * bounds specified by the minimum and maximum duration values, it is reset to |
|
2316 * the nearest allowable value - the function will leave. |
|
2317 */ |
|
2318 IMPORT_C void PrepareForFocusLossL(); |
|
2319 |
|
2320 // From CCoeControl |
|
2321 /** |
|
2322 * From @c CCoeControl. |
|
2323 * |
|
2324 * Handles pointer events. |
|
2325 * |
|
2326 * @param aPointerEvent The pointer event. |
|
2327 */ |
|
2328 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
2329 private: |
|
2330 // miscellaneous functions |
|
2331 void DoSetMinimumAndMaximum(const TTimeIntervalSeconds& aMinimumDuration, const TTimeIntervalSeconds& aMaximumDuration); |
|
2332 IMPORT_C virtual void CEikMfne_Reserved(); |
|
2333 private: |
|
2334 /** |
|
2335 * From CAknControl |
|
2336 */ |
|
2337 IMPORT_C void* ExtensionInterface( TUid aInterface ); |
|
2338 private: |
|
2339 CTimeEditor* iTimeEditor; |
|
2340 TTimeIntervalSeconds iMinimumDuration; |
|
2341 TTimeIntervalSeconds iMaximumDuration; |
|
2342 TInt iSpare; |
|
2343 }; |
|
2344 |
|
2345 /** |
|
2346 * Time offset editor. |
|
2347 * |
|
2348 * This control allows a signed time offset to be displayed and edited. |
|
2349 * It has the same fields as the time editor control CEikTimeEditor, |
|
2350 * except there is no AM or PM text because the value is a time offset, |
|
2351 * positive or negative, from 0 to 24 hours rather than a point in time. |
|
2352 * |
|
2353 * The editor has an associated resource struct TIME_OFFSET_EDITOR and |
|
2354 * control factory identifier EEikCtTimeOffsetEditor. |
|
2355 */ |
|
2356 class CEikTimeOffsetEditor : public CEikMfne |
|
2357 { |
|
2358 public: |
|
2359 // miscellaneous functions |
|
2360 |
|
2361 /** |
|
2362 * Default constructor. |
|
2363 * |
|
2364 * This function should be used as the first stage in two stage |
|
2365 * construction, followed by a call to either ConstructFromResourceL() to |
|
2366 * initialise the editor's field values from a resource file, or ConstructL() |
|
2367 * if no resource file is used. |
|
2368 */ |
|
2369 IMPORT_C CEikTimeOffsetEditor(); |
|
2370 |
|
2371 /** |
|
2372 * Destructor. This frees the resources owned by the time offset editor, |
|
2373 * prior to its destruction. |
|
2374 */ |
|
2375 IMPORT_C virtual ~CEikTimeOffsetEditor(); |
|
2376 |
|
2377 /** |
|
2378 * Second phase constructor. |
|
2379 * |
|
2380 * This function completes the construction of a time offset editor, by |
|
2381 * setting its minimum, maximum and initial values. The time separator |
|
2382 * characters specified in the system's locale are honoured. It should be |
|
2383 * called by the container only if the control is not constructed from a |
|
2384 * resource file. |
|
2385 * |
|
2386 * The aFlags parameter is used to determine whether the seconds or |
|
2387 * hours fields are displayed by the editor. The minutes field is always |
|
2388 * displayed. This function forces 24 hour time format for the time offset |
|
2389 * editor, overriding the locale's setting. |
|
2390 * |
|
2391 * If the initial time offset is outside the bounds specified, it is |
|
2392 * invalid and will be reset to the upper or lower bound. |
|
2393 * |
|
2394 * The minimum value for a time offset editor is -23:59:59, and the |
|
2395 * maximum value is 23:59:59. |
|
2396 * |
|
2397 * @param aMinimumTimeOffset The minimum allowable value, in seconds. |
|
2398 * @param aMaximumTimeOffset The maximum allowable value, in seconds. |
|
2399 * @param aInitialTimeOffset The initial value, in seconds. |
|
2400 * @param aFlags Determines which fields are required. Specify |
|
2401 * CTimeEditor::EWithoutSecondsField for no seconds field, |
|
2402 * CTimeEditor::EWithoutHoursField for no hours field. 24 hour clock format is set, regardless |
|
2403 * of the flag setting specified in this parameter. |
|
2404 */ |
|
2405 IMPORT_C void ConstructL(const TTimeIntervalSeconds& aMinimumTimeOffset, const TTimeIntervalSeconds& aMaximumTimeOffset, const TTimeIntervalSeconds& aInitialTimeOffset, TUint32 aFlags); |
|
2406 |
|
2407 /** |
|
2408 * Sets the range of allowable offset values. |
|
2409 * |
|
2410 * These define the maximum and minimum values that may be entered by |
|
2411 * the user. |
|
2412 * |
|
2413 * If the existing offset value is outside the bounds set by this |
|
2414 * function, it is reset to the nearest boundary value. |
|
2415 * |
|
2416 * @param aMinimumTimeOffset The minimum allowable value. |
|
2417 * @param aMaximumTimeOffset The maximum allowable value. |
|
2418 * @panic 49 If the minimum exceeds the maximum. |
|
2419 */ |
|
2420 IMPORT_C void SetMinimumAndMaximum(const TTimeIntervalSeconds& aMinimumTimeOffset, const TTimeIntervalSeconds& aMaximumTimeOffset); // only values inside the initial minimum and maximum are permitted |
|
2421 |
|
2422 /** |
|
2423 * Gets the range of allowable values that may be entered by the user. |
|
2424 * |
|
2425 * @param aMinimumTimeOffset On return, contains the time offset |
|
2426 * editor’s minimum allowable value. |
|
2427 * @param aMaximumTimeOffset On return, contains the time offset |
|
2428 * editor’s maximum allowable value. |
|
2429 */ |
|
2430 IMPORT_C void GetMinimumAndMaximum(TTimeIntervalSeconds& aMinimumTimeOffset, TTimeIntervalSeconds& aMaximumTimeOffset) const; |
|
2431 |
|
2432 /** |
|
2433 * Sets the time offset editor's value. |
|
2434 * |
|
2435 * The sign is set according to whether the value specified is positive |
|
2436 * or negative. |
|
2437 * |
|
2438 * @param aTimeOffset The new offset value to which to assign to the |
|
2439 * editor. |
|
2440 */ |
|
2441 IMPORT_C void SetTimeOffset(const TTimeIntervalSeconds& aTimeOffset); |
|
2442 |
|
2443 /** |
|
2444 * Gets the time offset editor's value converted into seconds. |
|
2445 * |
|
2446 * @return The editor's value in seconds. |
|
2447 */ |
|
2448 IMPORT_C TTimeIntervalSeconds TimeOffset() const; // can only be called if PrepareForFocusLossL() succeeded |
|
2449 |
|
2450 // framework |
|
2451 |
|
2452 /** |
|
2453 * Second phase construction from a resource. |
|
2454 * |
|
2455 * This function completes the construction of a time offset editor |
|
2456 * from a TIME_OFFSET_EDITOR resource. |
|
2457 * |
|
2458 * The minimum and maximum time offsets, and the flags settings are |
|
2459 * read from the resource, and ConstructL() is called with these settings. |
|
2460 * The initial time offset is set to the maximum time offset value. |
|
2461 * |
|
2462 * @param aResourceReader A resource file reader. |
|
2463 */ |
|
2464 IMPORT_C void ConstructFromResourceL(TResourceReader& aResourceReader); |
|
2465 |
|
2466 /** |
|
2467 * Prepares editor for focus loss. |
|
2468 * |
|
2469 * This function should be called to validate the editor’s contents |
|
2470 * when an attempt is made to remove focus from the control. |
|
2471 * |
|
2472 * If the control value is not within the bounds specified by the |
|
2473 * minimum and maximum time offset values, it is reset to the nearest |
|
2474 * allowable value. The function then leaves. |
|
2475 */ |
|
2476 IMPORT_C void PrepareForFocusLossL(); |
|
2477 |
|
2478 // From CCoeControl |
|
2479 |
|
2480 /** |
|
2481 * From @c CCoeControl. |
|
2482 * |
|
2483 * Handles pointer events. |
|
2484 * |
|
2485 * @param aPointerEvent The pointer event. |
|
2486 */ |
|
2487 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
2488 |
|
2489 private: |
|
2490 // miscellaneous functions |
|
2491 void DoSetMinimumAndMaximum(const TTimeIntervalSeconds& aMinimumTimeOffset, const TTimeIntervalSeconds& aMaximumTimeOffset); |
|
2492 IMPORT_C virtual void CEikMfne_Reserved(); |
|
2493 private: |
|
2494 /** |
|
2495 * From CAknControl |
|
2496 */ |
|
2497 IMPORT_C void* ExtensionInterface( TUid aInterface ); |
|
2498 private: |
|
2499 CTimeEditor* iTimeEditor; |
|
2500 TTimeIntervalSeconds iMinimumTimeOffset; |
|
2501 TTimeIntervalSeconds iMaximumTimeOffset; |
|
2502 // none of these pointers owns anything |
|
2503 CEikMfneSymbol* iSign; |
|
2504 TInt iSpare; |
|
2505 }; |
|
2506 |
|
2507 |
|
2508 // |
|
2509 // Longitude and Latitude editors removed 2.4.2002: |
|
2510 |
|
2511 enum |
|
2512 { |
|
2513 EEikOrientationNorthSouth =0x1000, |
|
2514 EEikOrientationWestEast =0x2000, |
|
2515 EEikOrientationMask=EEikOrientationNorthSouth|EEikOrientationWestEast |
|
2516 }; |
|
2517 |
|
2518 |
|
2519 enum |
|
2520 { |
|
2521 EEikDirectionNegative, |
|
2522 EEikDirectionPositive, |
|
2523 EEikDirectionMask=EEikDirectionNegative|EEikDirectionPositive |
|
2524 }; |
|
2525 |
|
2526 |
|
2527 enum TEikCompass |
|
2528 { |
|
2529 EEikCompassNorth=EEikOrientationNorthSouth|EEikDirectionNegative, |
|
2530 EEikCompassSouth=EEikOrientationNorthSouth|EEikDirectionPositive, |
|
2531 EEikCompassEast=EEikOrientationWestEast|EEikDirectionNegative, |
|
2532 EEikCompassWest=EEikOrientationWestEast|EEikDirectionPositive |
|
2533 }; |
|
2534 |
|
2535 |
|
2536 struct SEikDegreesMinutesDirection |
|
2537 { |
|
2538 TInt iDegrees; |
|
2539 TInt iMinutes; |
|
2540 TInt iSeconds; |
|
2541 TEikCompass iDirection; |
|
2542 }; |
|
2543 |
|
2544 #endif // __EIKMFNE_H__ |
|
2545 // End of file |