1.1 --- a/epoc32/include/mw/eikmfne.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/eikmfne.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,2502 @@
1.4 -eikmfne.h
1.5 +/*
1.6 +* Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description:
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +#if !defined(__EIKMFNE_H__)
1.24 +#define __EIKMFNE_H__
1.25 +
1.26 +#if !defined(__EIKBCTRL_H__)
1.27 +#include <eikbctrl.h>
1.28 +#endif
1.29 +
1.30 +#if !defined(__COEDEF_H__)
1.31 +#include <coedef.h>
1.32 +#endif
1.33 +
1.34 +#if !defined(__COEINPUT_H__)
1.35 +#include <coeinput.h>
1.36 +#endif
1.37 +
1.38 +// For MEikCalendarObserver
1.39 +#if !defined(__EIKCAL_H__)
1.40 +#include <eikcal.h>
1.41 +#endif
1.42 +
1.43 +#if !defined(__EIKDEF_H__)
1.44 +#include <eikdef.h>
1.45 +#endif
1.46 +
1.47 +#if !defined(__BABITFLAGS_H__)
1.48 +#include <babitflags.h>
1.49 +#endif
1.50 +
1.51 +// For MAknMfneCommandObserver
1.52 +#if !defined(__AKNMFNECOMMANDOBSERVER)
1.53 +#include <AknMfneCommandObserver.h>
1.54 +#endif //!defined(__AKNMFNECOMMANDOBSERVER)
1.55 +
1.56 +//
1.57 +// Forward Declarations
1.58 +//
1.59 +class CEikonEnv;
1.60 +class CTimeEditor;
1.61 +class CDateEditor;
1.62 +
1.63 +// Skin-related API forward declarations
1.64 +class MAknsControlContext;
1.65 +
1.66 +// Extension object within CEikMfne
1.67 +class CEikMfneExtension;
1.68 +
1.69 +//
1.70 +/**
1.71 + * Abstract base class for fields within a multi-field numeric editor.
1.72 + */
1.73 +class CEikMfneField : public CBase
1.74 + {
1.75 +public:
1.76 + /**
1.77 + * The type of highlight.
1.78 + */
1.79 + enum THighlightType
1.80 + {
1.81 + /** Inverse video. */
1.82 + EInverseVideo,
1.83 + /** The cursor is visible in the field so that highlighting is not used. */
1.84 + ECursor
1.85 + };
1.86 +protected:
1.87 + /**
1.88 + * Protected default constructor.
1.89 + *
1.90 + * Sets the minimum width of the field to zero pixels.
1.91 + */
1.92 + IMPORT_C CEikMfneField();
1.93 +public:
1.94 + void Draw(CWindowGc& aGc, const CFont& aFont, const TPoint& aTopLeft) const;
1.95 + TInt WidthInPixels(const CFont& aFont) const;
1.96 + TInt DistanceFromStartOfFieldToEndOfTextInPixels(const CFont& aFont) const;
1.97 +
1.98 + /**
1.99 + * An implementation of this pure virtual function should
1.100 + * get the field's maximum width in pixels.
1.101 + *
1.102 + * @param aFont The font.
1.103 + * @param aShrinkToMinimumSize ETrue to shrink the width to the minimum required.
1.104 + * @return The field's maximum width in pixels.
1.105 + */
1.106 + virtual TInt MaximumWidthInPixels(const CFont& aFont, TBool aShrinkToMinimumSize)=0;
1.107 +
1.108 + /**
1.109 + * An implementation of this pure virtual function should
1.110 + * return the field's input capabilities.
1.111 + *
1.112 + * @return The field's input capabilities.
1.113 + */
1.114 + virtual TCoeInputCapabilities InputCapabilities() const=0;
1.115 +
1.116 + /**
1.117 + * Derived classes' implementation of function should
1.118 + * return whether the field is editable.
1.119 + *
1.120 + * This implementation returns EFalse.
1.121 + *
1.122 + * @return EFalse.
1.123 + */
1.124 + IMPORT_C virtual TBool IsEditable() const;
1.125 +
1.126 + /**
1.127 + * Derived classes' implementation of function should
1.128 + * return whether the field is valid
1.129 + *
1.130 + * This implementation returns ETrue.
1.131 + *
1.132 + * @return ETrue.
1.133 + */
1.134 + IMPORT_C virtual TBool IsValid() const;
1.135 +
1.136 + /**
1.137 + * An implementation of this function should get the
1.138 + * field's highlight type.
1.139 + *
1.140 + * May only be called if IsEditable() returns ETrue.
1.141 + *
1.142 + * This implementation panics in debug builds and returns
1.143 + * a dummy value in release builds.
1.144 + *
1.145 + * @return EInverseVideo.
1.146 + */
1.147 + IMPORT_C virtual THighlightType HighlightType() const;
1.148 +
1.149 + /**
1.150 + * An implementation of this function should handle a key event.
1.151 + *
1.152 + * May only be called if IsEditable() returns ETrue.
1.153 + * This implementation panics in debug builds and is
1.154 + * empty in release builds.
1.155 + *
1.156 + * @param aFont The control's font.
1.157 + * @param aKeyEvent The key event passed on from the multi-field numeric editor.
1.158 + * @param aInterpretLeftAndRightAsEarEvents Not used.
1.159 + * @param aDataAltered On return, indicates whether or not the field
1.160 + * contents changed. If EFalse, left and right arrow
1.161 + * key presses indicate a movement to the preceding of
1.162 + * following field, if ETrue they are ignored.
1.163 + * @param aHighlightIncrement On return: -1 indicates the previous field is
1.164 + * highlighted,0 indicates the highlight is
1.165 + * unchanged and 1 indicates the following field
1.166 + * is highlighted.
1.167 + */
1.168 + IMPORT_C virtual void HandleKey(const CFont& aFont, const TKeyEvent& aKeyEvent, TBool aInterpretLeftAndRightAsEarEvents, TBool& aDataAltered, TInt& aHighlightIncrement);
1.169 +
1.170 + /**
1.171 + * An implementation of this function should
1.172 + * handle de-highlighting the field.
1.173 + *
1.174 + * May only be called if IsEditable() returns ETrue.
1.175 + *
1.176 + * This implementation panics in debug builds and is empty
1.177 + * in release builds.
1.178 + *
1.179 + * @param aFont The control's font.
1.180 + * @param aEikonEnv The control's environment.
1.181 + * @param aDataAltered On return, set to ETrue if the function caused
1.182 + * the field's contents to change, otherwise unchanged.
1.183 + * @param aError On return, changed to ETrue if an error occurred e.g.
1.184 + * the user entered an invalid value, otherwise unchanged.
1.185 + */
1.186 + IMPORT_C virtual void HandleDeHighlight(const CFont& aFont, CEikonEnv& aEikonEnv, TBool& aDataAltered, TBool& aError);
1.187 +
1.188 + const TDesC& FieldText() const;
1.189 +protected:
1.190 + /**
1.191 + * Handles a left or right arrow key press.
1.192 + *
1.193 + * @param aKey Left or right arrow key: either EKeyLeftArrow or EKeyRightArrow.
1.194 + * @param aDataAltered On return, ETrue if data is altered as a result of this function.
1.195 + * @param aHighlightIncrement On return, the direction to move the cursor:
1.196 + * either -1 if aKey is a left arrow key, or 1 if aKey is a right arrow key.
1.197 + * @panic 3 In debug builds, if aKey is neither a left nor a right arrow key.
1.198 + */
1.199 + IMPORT_C void HandleLeftOrRightArrow(TChar aKey, TBool& aDataAltered, TInt& aHighlightIncrement);
1.200 +
1.201 + TInt AdditionalWidthForHighlights(const CFont& aFont) const;
1.202 +private:
1.203 + virtual const TDesC& Text() const=0;
1.204 +protected:
1.205 + /**
1.206 + * The field's minimum width in pixels.
1.207 + */
1.208 + TInt iMinimumWidthInPixels;
1.209 + };
1.210 +
1.211 +//
1.212 +
1.213 +/**
1.214 + * A separator field for a multi-field numeric editor.
1.215 + *
1.216 + * For instance, the character that separates time or date components.
1.217 + */
1.218 +NONSHARABLE_CLASS(CEikMfneSeparator) : public CEikMfneField
1.219 + {
1.220 +private:
1.221 + CEikMfneSeparator(HBufC* aText);
1.222 +public:
1.223 + /**
1.224 + * Destructor.
1.225 + *
1.226 + * Deletes the separator text that is owned by the object.
1.227 + */
1.228 + IMPORT_C virtual ~CEikMfneSeparator();
1.229 +
1.230 + /**
1.231 + * Allocates and constructs a CEikMfneSeparator from resource.
1.232 + *
1.233 + * Uses an MFNE_SEPARATOR resource.
1.234 + *
1.235 + * @param aResourceReader The resource reader to use.
1.236 + * @return A newly constructed separator field.
1.237 + */
1.238 + IMPORT_C static CEikMfneSeparator* NewL(TResourceReader& aResourceReader);
1.239 +
1.240 + /**
1.241 + * Allocates and constructs a separator.
1.242 + *
1.243 + * @param aText The separator's text. Ownership of aText is transferred.
1.244 + * @return A newly constructed separator.
1.245 + */
1.246 + IMPORT_C static CEikMfneSeparator* NewL(HBufC* aText); // ownership of aText is transferred when everything that can leave has successfully been done
1.247 +
1.248 + /**
1.249 + * Sets the separator's text.
1.250 + *
1.251 + * This function transfers ownership of the text and can only be called if the field's text was previously NULL.
1.252 + *
1.253 + * @param aText The separator's text.
1.254 + * @panic 4 If the separator's text was not previously Null.
1.255 + */
1.256 + IMPORT_C void SetText(HBufC* aText); // allows later transfer of ownership of text - can only be called if aText was previously NULL
1.257 +
1.258 +private: // framework
1.259 + virtual TInt MaximumWidthInPixels(const CFont& aFont, TBool aShrinkToMinimumSize);
1.260 + virtual TCoeInputCapabilities InputCapabilities() const;
1.261 + virtual const TDesC& Text() const;
1.262 +private:
1.263 + HBufC* iText;
1.264 + };
1.265 +
1.266 +//
1.267 +
1.268 +/**
1.269 + * A number field within a multi-field numeric editor.
1.270 + */
1.271 +NONSHARABLE_CLASS(CEikMfneNumber) : public CEikMfneField
1.272 + {
1.273 +public:
1.274 + /**
1.275 + * Flags for the number field.
1.276 + *
1.277 + * EFillWithLeadingZeros, EPreserveOldWidthBeforeEditing and ERepresentsYear can only be set if EPublicallySettableFlags is set.
1.278 + */
1.279 + enum
1.280 + {
1.281 + /** Prepends the number field's value with leading zeros up to the maximum allowable width of the field. */
1.282 + EFillWithLeadingZeros =0x1,
1.283 + /** The field's minimum width in pixels is set to the current text's width in pixels. */
1.284 + EPreserveOldWidthBeforeEditing =0x2,
1.285 + /** The number is a year. */
1.286 + ERepresentsYear =0x4,
1.287 + /** Used internally to make sure only the previous three values are set. */
1.288 + EPublicallySettableFlags =EFillWithLeadingZeros|EPreserveOldWidthBeforeEditing|ERepresentsYear
1.289 + };
1.290 +private:
1.291 + enum
1.292 + {
1.293 + EIsBeingEditedWithCursor =0x8,
1.294 + EIsUninitialised =0x10,
1.295 + EFillWithTrailingZeros =0x20
1.296 + };
1.297 +private:
1.298 + CEikMfneNumber(TInt aMinimumValue, TInt aMaximumValue, TUint32 aFlags);
1.299 + void ConstructL();
1.300 +public:
1.301 + /**
1.302 + * Destructor.
1.303 + *
1.304 + * Deletes the number field's text.
1.305 + */
1.306 + IMPORT_C virtual ~CEikMfneNumber();
1.307 +
1.308 + /**
1.309 + * Allocates and constructs a CEikMfneNumber from resource.
1.310 + *
1.311 + * Obtains flags and the minimum and maximum values from an MFNE_NUMBER resource. Then calls the overloaded NewL() function.
1.312 + *
1.313 + * @param aFont The font to use.
1.314 + * @param aResourceReader The resource reader to use.
1.315 + * @return A newly constructed number field.
1.316 + */
1.317 + IMPORT_C static CEikMfneNumber* NewL(const CFont& aFont, TResourceReader& aResourceReader);
1.318 +
1.319 + /**
1.320 + * Allocates and constructs a CEikMfneNumber with the specified parameters.
1.321 + *
1.322 + * @param aFont The font to use.
1.323 + * @param aMinimumValue The minimum value.
1.324 + * @param aMaximumValue The maximum value.
1.325 + * @param aInitialValue The initial value. This must be greater than the minimum value and less than the maximum value.
1.326 + * @param aFlags The number field's flags. See the Anonymous enum.
1.327 + * @return A newly constructed number field.
1.328 + * @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.
1.329 + */
1.330 + IMPORT_C static CEikMfneNumber* NewL(const CFont& aFont, TInt aMinimumValue, TInt aMaximumValue, TInt aInitialValue, TUint32 aFlags);
1.331 +
1.332 + /**
1.333 + * Sets the minimum and maximum allowable values.
1.334 + *
1.335 + * @param aMinimumValue The minimum value. Must be less than or equal to the maximum value.
1.336 + * @param aMaximumValue The maximum value.
1.337 + * @param aFont The font in use.
1.338 + * @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.
1.339 + */
1.340 + IMPORT_C void SetMinimumAndMaximum(TInt aMinimumValue, TInt aMaximumValue, const CFont& aFont); // only values inside the initial minimum and maximum are permitted
1.341 +
1.342 + /**
1.343 + * Gets the minimum and maximum allowable values.
1.344 + *
1.345 + * @param aMinimumValue On return, the minimum allowable value.
1.346 + * @param aMaximumValue On return, the maximum allowable value.
1.347 + */
1.348 + IMPORT_C void GetMinimumAndMaximum(TInt& aMinimumValue, TInt& aMaximumValue) const;
1.349 +
1.350 + /**
1.351 + * Sets the field's current value.
1.352 + * @param aValue The field's current value. This must be between the minimum value and the maximum value.
1.353 + * @param aFont The font.
1.354 + * @panic 11 In debug builds only, if the value is less than the minimum value or greater than the maximum value.
1.355 + */
1.356 + IMPORT_C void SetValue(TInt aValue, const CFont& aFont);
1.357 +
1.358 + /**
1.359 + * Gets the number field's value. Note that this function will leave
1.360 + * if the value is not valid, i.e. the number of digits is zero
1.361 + * or the value is outside of the minimum and maximum range.
1.362 + *
1.363 + * @return The field's value.
1.364 + */
1.365 + IMPORT_C TInt Value() const;
1.366 +
1.367 + /**
1.368 + * Returns ETrue if the field contains more than zero
1.369 + * digits.
1.370 + *
1.371 + * @return ETrue if the field contains more than zero digits.
1.372 + */
1.373 + IMPORT_C virtual TBool IsValid() const;
1.374 +
1.375 + /**
1.376 + * Sets the uninitialized status of the field.
1.377 + *
1.378 + * @param aUninitialised If ETrue, sets the field as uninitialized,
1.379 + * i.e. it doesn't display anything.
1.380 + */
1.381 + IMPORT_C void SetUninitialised(TBool aUninitialised);
1.382 +
1.383 + /**
1.384 + * Gets the uninitialized status of the field.
1.385 + *
1.386 + * @return ETrue, if the field is set as uninitialized.
1.387 + */
1.388 + IMPORT_C TBool IsUninitialised() const;
1.389 +
1.390 +public:
1.391 + /**
1.392 + * Sets the digit display type.
1.393 + *
1.394 + * @since S60 v3.1
1.395 + * @param aDigitType The digit display type to bet set for this number field
1.396 + * @param aFont The font of the MFNE that owns this field, usually retrieved with CEikMfne::Font()
1.397 + */
1.398 + IMPORT_C void SetDigitType(TDigitType aDigitType, const CFont& aFont);
1.399 +
1.400 + /**
1.401 + * Gets the digit display type.
1.402 + *
1.403 + * @since S60 v3.1
1.404 + * @return The digit display type of this number field
1.405 + */
1.406 + IMPORT_C TDigitType DigitType() const;
1.407 +
1.408 + /**
1.409 + * Derive and set digit display type from locale information.
1.410 + *
1.411 + * @since S60 v3.1
1.412 + * @param aFont The font of the MFNE that owns this field, usually retrieved with CEikMfne::Font()
1.413 + */
1.414 + IMPORT_C void RefreshDigitType(const CFont& aFont);
1.415 +
1.416 + void SetTrailingZeros();
1.417 +
1.418 +public:
1.419 + TBool IsTextNull() const;
1.420 +private: // framework
1.421 + virtual TInt MaximumWidthInPixels(const CFont& aFont, TBool aShrinkToMinimumSize);
1.422 + virtual TCoeInputCapabilities InputCapabilities() const;
1.423 + virtual TBool IsEditable() const;
1.424 + virtual THighlightType HighlightType() const;
1.425 + virtual void HandleKey(const CFont& aFont, const TKeyEvent& aKeyEvent, TBool aInterpretLeftAndRightAsEarEvents, TBool& aDataAltered, TInt& aHighlightIncrement);
1.426 + virtual void HandleDeHighlight(const CFont& aFont, CEikonEnv& aEikonEnv, TBool& aDataAltered, TBool& aError);
1.427 + virtual const TDesC& Text() const;
1.428 +private:
1.429 + TInt MaximumNumberOfDigits() const;
1.430 + TInt NumberOfDigits() const;
1.431 + void SetTextToValue(TInt aValue, const CFont& aFont);
1.432 + TInt ValueFromText() const;
1.433 + TBool ConvertsIntoValidValue(TInt& aValue) const;
1.434 +
1.435 +private: // International digit support
1.436 + TChar NormalizeDigit(TChar aChar);
1.437 + TText ZeroCharacter() const;
1.438 + TText NegativeCharacter() const;
1.439 +
1.440 +private:
1.441 + TInt iMinimumValue;
1.442 + TInt iMaximumValue;
1.443 + TInt iMaxDigits;
1.444 + TUint32 iFlags;
1.445 + HBufC* iText;
1.446 + TChar iNudgeCharMinus;
1.447 + TChar iNudgeCharPlus;
1.448 + TInt iMaxDigitsMinimumValue;
1.449 + TInt iMaxDigitsMaximumValue;
1.450 + TDigitType iDigitType;
1.451 + };
1.452 +
1.453 +//
1.454 +
1.455 +/**
1.456 + * A symbol field for a multi-field numeric editor.
1.457 + *
1.458 + * 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.
1.459 + */
1.460 +NONSHARABLE_CLASS(CEikMfneSymbol) : public CEikMfneField
1.461 + {
1.462 +public:
1.463 + /**
1.464 + * An item within a symbol field in an MFNE.
1.465 + */
1.466 + NONSHARABLE_CLASS(CItem) : public CBase
1.467 + {
1.468 + private:
1.469 + CItem(TInt aId, TChar aKeyToMatch, HBufC* aText);
1.470 + public:
1.471 + /**
1.472 + * Destructor.
1.473 + *
1.474 + * Deletes the item's text.
1.475 + */
1.476 + IMPORT_C virtual ~CItem();
1.477 +
1.478 + /**
1.479 + * Allocates and constructs a symbolic item from resource.
1.480 + *
1.481 + * Uses a MFNE_SYMBOLIC_ITEM resource.
1.482 + * @param aResourceReader The resource reader to use.
1.483 + * @return A newly constructed symbolic item.
1.484 + */
1.485 + IMPORT_C static CItem* NewL(TResourceReader& aResourceReader);
1.486 +
1.487 + /**
1.488 + * Allocates and constructs a symbolic item.
1.489 + *
1.490 + * @param aId The ID of the symbolic item that uniquely identifies the item in the field.
1.491 + * @param aKeyToMatch The key that represents the item. This is for character matching, not for display.
1.492 + * @param aText The text to be drawn. Ownership of aText is transferred when everything that can leave has successfully completed.
1.493 + * @return A newly constructed symbolic item.
1.494 + */
1.495 + 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
1.496 +
1.497 + /**
1.498 + * Sets the symbolic item's text.
1.499 + *
1.500 + * The item takes ownership of aText.
1.501 + *
1.502 + * @param aText The symbolic item's text.
1.503 + * @panic 19 In debug builds if the symbolic item's text was not
1.504 + * previously Null.
1.505 + */
1.506 + IMPORT_C void SetText(HBufC* aText); // allows later transfer of ownership of text - can only be called if aText was previously NULL
1.507 + private:
1.508 + friend class CEikMfneSymbol;
1.509 + private:
1.510 + TInt iId;
1.511 + TCharF iKeyToMatch;
1.512 + HBufC* iText;
1.513 + };
1.514 +private:
1.515 + CEikMfneSymbol(TInt aNumSymbolicItems);
1.516 +public:
1.517 + /**
1.518 + * Destructor.
1.519 + *
1.520 + * Deletes the array of symbolic items owned by the object.
1.521 + */
1.522 + IMPORT_C virtual ~CEikMfneSymbol();
1.523 +
1.524 + /**
1.525 + * Allocates and constructs a CEikMfneSymbol from resource.
1.526 + *
1.527 + * Uses a MFNE_SYMBOL resource. The first item is set as current.
1.528 + *
1.529 + * @param aResourceReader The resource reader to use.
1.530 + * @return A newly constructed symbol.
1.531 + * @panic 15 If there is not more than one symbol.
1.532 + */
1.533 + IMPORT_C static CEikMfneSymbol* NewL(TResourceReader& aResourceReader);
1.534 +
1.535 + /**
1.536 + * Allocates and constructs a CEikMfneSymbol.
1.537 + *
1.538 + * The first item is set as current.
1.539 + *
1.540 + * @param aNumSymbolicItems The number of symbolic items. Must be
1.541 + * greater than one. All items are set to NULL.
1.542 + * @return A newly constructed symbol.
1.543 + * @panic 15 If there is not more than one symbol.
1.544 + */
1.545 + IMPORT_C static CEikMfneSymbol* NewL(TInt aNumSymbolicItems);
1.546 +
1.547 + /**
1.548 + * Adds the specified symbolic item at the first available position in
1.549 + * the array.
1.550 + *
1.551 + * This should be called by the container only if construction was not
1.552 + * made from resource.
1.553 + *
1.554 + * @param aSymbolicItem The symbol to add. Ownership of aSymbolicItem
1.555 + * is transferred to this.
1.556 + * @param aMakeCurrent ETrue to make the added symbol current.
1.557 + * @panic 16 In debug build if the symbolic item array has not yet been
1.558 + * created.
1.559 + * @panic 17 If the array is full.
1.560 + */
1.561 + 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"
1.562 +
1.563 + /**
1.564 + * Sets the current item to the one specified.
1.565 + *
1.566 + *
1.567 + * @param aId The id of the new current item.
1.568 + * @panic 18 If the specified item does not exist.
1.569 + */
1.570 + IMPORT_C void SetCurrentSymbolicItemToId(TInt aId);
1.571 +
1.572 + /**
1.573 + * Gets the current symbol's ID.
1.574 + *
1.575 + * @return The current symbol's ID.
1.576 + */
1.577 + IMPORT_C TInt IdOfCurrentSymbolicItem() const;
1.578 +
1.579 + /**
1.580 + * Sets the uninitialized status of the field.
1.581 + *
1.582 + * @param aUninitialised If ETrue, sets the field as uninitialized,
1.583 + * i.e. doesn't display anything.
1.584 + */
1.585 + IMPORT_C void SetUninitialised(TBool aUninitialised);
1.586 +
1.587 + /**
1.588 + * Gets the uninitialized status of the field.
1.589 + *
1.590 + * @return ETrue, if the field is set as uninitialized.
1.591 + */
1.592 + IMPORT_C TBool IsUninitialised() const;
1.593 +
1.594 +private: // framework
1.595 + virtual TInt MaximumWidthInPixels(const CFont& aFont, TBool aShrinkToMinimumSize);
1.596 + virtual TCoeInputCapabilities InputCapabilities() const;
1.597 + virtual TBool IsEditable() const;
1.598 + virtual THighlightType HighlightType() const;
1.599 + virtual void HandleKey(const CFont& aFont, const TKeyEvent& aKeyEvent, TBool aInterpretLeftAndRightAsEarEvents, TBool& aDataAltered, TInt& aHighlightIncrement);
1.600 + virtual void HandleDeHighlight(const CFont& aFont, CEikonEnv& aEikonEnv, TBool& aDataAltered, TBool& aError);
1.601 + virtual const TDesC& Text() const;
1.602 +private:
1.603 + TInt CurrentSymbolicItem() const;
1.604 + void SetCurrentSymbolicItem(TInt aCurrentSymbolicItem);
1.605 +private:
1.606 + TInt iNumSymbolicItems;
1.607 + TInt iCurrentSymbolicItem;
1.608 + CItem** iSymbolicItems;
1.609 + };
1.610 +
1.611 +//
1.612 +
1.613 +/**
1.614 + * Multi-field numeric editor abstract base class.
1.615 + *
1.616 + * This is a set of fields, where a field can be a number, a symbol or
1.617 + * a separator. Field classes are derived from CEikMfneField.
1.618 + *
1.619 + * Concrete multi-field numeric editors are derived from this class and
1.620 + * should provide the following:
1.621 + *
1.622 + * * A virtual destructor if the class introduces new data members which
1.623 + * are allocated on the heap.
1.624 + *
1.625 + * * A ConstructL() function; this is used to initialise a multi-field
1.626 + * numeric editor.
1.627 + *
1.628 + * * A ConstructFromResourceL() function; this is used to initialise a
1.629 + * multi-field numeric editor from a resource.
1.630 + *
1.631 + * * A data member to store the editor's value.
1.632 + *
1.633 + * * Functions to set and get the editor's value.
1.634 + *
1.635 + * * Functions to set the minimum and maximum allowable values.
1.636 + */
1.637 +class CEikMfne : public CEikBorderedControl, public MAknMfneCommandObserver
1.638 + {
1.639 +public:
1.640 + // miscellaneous functions
1.641 + /**
1.642 + * Default constructor.
1.643 + */
1.644 + IMPORT_C CEikMfne();
1.645 +
1.646 + /**
1.647 + * Destructor.
1.648 + *
1.649 + * This function is virtual which ensures that if delete is explicitly
1.650 + * called on a CEikMfne pointer which points to a derived class
1.651 + * instance, the derived class destructor is called.
1.652 + */
1.653 + IMPORT_C virtual ~CEikMfne();
1.654 +
1.655 + /**
1.656 + * Allocates a field array containing aNumFields elements.
1.657 + *
1.658 + * This should be called by the container only if a derived control is
1.659 + * not constructed from a resource.
1.660 + *
1.661 + * @param aNumFields The number of fields.
1.662 + * @panic 20 In debug builds, if there is already a field in the editor.
1.663 + */
1.664 + IMPORT_C void CreateFieldArrayL(TInt aNumFields); // to be called by container only if not constructed from resource
1.665 +
1.666 + /**
1.667 + * Adds a field.
1.668 + *
1.669 + * The field is added as the first empty element in the field array or,
1.670 + * if there is no current field, aField becomes the current field.
1.671 + *
1.672 + * This should be called by the container only if a derived control is
1.673 + * not constructed from a resource.
1.674 + *
1.675 + * Ownership of aField is transferred to this multi-field numeric
1.676 + * editor.
1.677 + *
1.678 + * @param aField A field.
1.679 + * @panic 22 If the field array has not been allocated.
1.680 + */
1.681 + IMPORT_C void AddField(CEikMfneField* aField); // to be called by container only if not constructed from resource - ownership of aField is transferred to "this"
1.682 +
1.683 + /**
1.684 + * Deletes the editor's field and the field array.
1.685 + *
1.686 + * After a call to this, CreateFieldArrayL() can be called again.
1.687 + */
1.688 + IMPORT_C void ResetFieldArray(); // after this CreateFieldArrayL() can be called again
1.689 +
1.690 + /**
1.691 + * Gets the control's border margins.
1.692 + *
1.693 + * @return The control's margins.
1.694 + */
1.695 + IMPORT_C TMargins BorderMargins() const;
1.696 +
1.697 + /**
1.698 + * Draws immediately, and then leaves with an info message containing a
1.699 + * formatted time/date string.
1.700 + *
1.701 + * The time/date is passed to the function, as is the resource which
1.702 + * contains the format string which defines how it is to be formatted.
1.703 + *
1.704 + * @param aResourceId The resource containing the time/date format. See
1.705 + * TTime::FormatL().
1.706 + * @param aTimeDate The object containing the time/date to be displayed.
1.707 + */
1.708 + IMPORT_C void DrawNowAndLeaveWithTimeDateFormatInfoMsgL(TInt aResourceId, const TTime& aTimeDate) const;
1.709 +
1.710 + /**
1.711 + * Gets the CEikMfneField at the specified index.
1.712 + *
1.713 + * @param aField The field index.
1.714 + * @return The requested field, or NULL if the index is less than zero
1.715 + * or greater than the number of fields.
1.716 + */
1.717 + IMPORT_C CEikMfneField* Field(TInt aField) const;
1.718 +
1.719 +public:
1.720 + // some utility functions which other classes may find useful
1.721 +
1.722 + /**
1.723 + * A utility function which reads seconds, minutes and hours from a
1.724 + * resource and returns the corresponding TTime value.
1.725 + *
1.726 + * @param aResourceReader A resource reader.
1.727 + * @return The time value read from the resource.
1.728 + */
1.729 + IMPORT_C static TTime ReadTime(TResourceReader& aResourceReader);
1.730 +
1.731 + /**
1.732 + * A utility function which reads days, months and years from a resource
1.733 + * and returns the corresponding TTime value.
1.734 + *
1.735 + * @param aResourceReader A resource reader.
1.736 + * @return The date value read from the resource. The hours, minutes,
1.737 + * seconds values are set to zero.
1.738 + */
1.739 + IMPORT_C static TTime ReadDate(TResourceReader& aResourceReader);
1.740 +
1.741 + /**
1.742 + * A utility function which reads seconds, minutes, hours, days, months
1.743 + * and years from a resource and returns the corresponding TTime value.
1.744 + *
1.745 + * @param aResourceReader A resource reader.
1.746 + * @return The time/date value read from the resource.
1.747 + */
1.748 + IMPORT_C static TTime ReadTimeAndDate(TResourceReader& aResourceReader);
1.749 +
1.750 + /**
1.751 + * Reads a duration value from a resource.
1.752 + *
1.753 + * @param aResourceReader A resource reader.
1.754 + * @return The duration, in seconds.
1.755 + */
1.756 + IMPORT_C static TTimeIntervalSeconds ReadDuration(TResourceReader& aResourceReader);
1.757 +
1.758 + /**
1.759 + * Reads a time offset from a resource.
1.760 + *
1.761 + * This is identical to ReadDuration(), except that negative offsets
1.762 + * are allowed.
1.763 + *
1.764 + * @param aResourceReader A resource reader.
1.765 + * @return The duration, in seconds.
1.766 + */
1.767 + IMPORT_C static TTimeIntervalSeconds ReadTimeOffset(TResourceReader& aResourceReader);
1.768 +
1.769 + /**
1.770 + * Converts a time duration to seconds.
1.771 + *
1.772 + * @param aTime The date and time to be converted.
1.773 + * @return The time duration in seconds.
1.774 + */
1.775 + IMPORT_C static TTimeIntervalSeconds Convert(const TTime& aTime);
1.776 +
1.777 + /**
1.778 + * Converts a time duration in seconds to hours, minutes and seconds.
1.779 + *
1.780 + * @param aTimeIntervalSeconds The number of seconds to be converted.
1.781 + * @return The date/time duration.
1.782 + */
1.783 + IMPORT_C static TTime Convert(const TTimeIntervalSeconds& aTimeIntervalSeconds);
1.784 + //
1.785 + /**
1.786 + * Gets the index into the field array of the current field.
1.787 + *
1.788 + * @return The current field's index.
1.789 + */
1.790 + inline TInt CurrentField() const;
1.791 +
1.792 + /**
1.793 + * Gets the number of fields.
1.794 + *
1.795 + * @return The number of fields in the editor.
1.796 + */
1.797 + inline TInt NumFields() const;
1.798 +
1.799 +public: // AVKON addition
1.800 + /**
1.801 + * Settable features for MFNE. See SetFeature().
1.802 + *
1.803 + * @since S60 3.2
1.804 + */
1.805 + enum TFeatureId
1.806 + {
1.807 + /** Tries to prevent MFNE drawing outside its rect,
1.808 + event if it smaller than MinimumSize().
1.809 + 0 (or EFalse) parameter disables this, non-zero
1.810 + (or ETrue) enables the feature. */
1.811 + EClipGcToRect,
1.812 +
1.813 + /** Disables VKB. Non-zero (or ETrue) parameter disables VKB,
1.814 + 0 (or EFalse) enables VKB. When disabled,
1.815 + editor doesn't request PenInputServer to start VKB */
1.816 + EDisablePenInput,
1.817 +
1.818 + /** Support finger input. Paramter is TFingerSupportParams.*/
1.819 + EFingerSupport
1.820 + };
1.821 + /** Parameter for finger support feature:
1.822 + * 0 means disable the suppor;
1.823 + * 1 means enable the support;
1.824 + * 2 means enable the support with highlight of whole text.
1.825 + */
1.826 + enum TFingerSupportParams
1.827 + {
1.828 + EDisaleFingerSupport,
1.829 + EnableFingerSupport,
1.830 + EnableWithAllHighlight
1.831 + };
1.832 +
1.833 + /**
1.834 + * Sets the alignment of the editor. The editor alignments, defined in
1.835 + * avkon.hrh, are EAknEditorAlignNone, EAknEditorAlignCenter,
1.836 + * EAknEditorAlignLeft, EAknEditorAlignRight or EAknEditorAlignBidi.
1.837 + *
1.838 + * @param aAlignment The editor's alignment
1.839 + */
1.840 + IMPORT_C void SetMfneAlignment(TInt aAlignment);
1.841 +
1.842 + /**
1.843 + * Sets whether the editor consumes up and down key events. If this is
1.844 + * set to EFalse, the editor returns EKeyWasNotConsumed upon receiving
1.845 + * EKeyDownArrow or EKeyUpArrow key event and doesn't send the key event to
1.846 + * the current field.
1.847 + *
1.848 + * @param aConsume If EFalse, OfferKeyEventL() returns
1.849 + * EKeyWasNotConsumed when up and down key events are received.
1.850 + */
1.851 + IMPORT_C void SetUpAndDownKeysConsumed(TBool aConsume);
1.852 +
1.853 + /**
1.854 + * Used for suppressing all editor's background drawing. This is
1.855 + * intended for internal use.
1.856 + *
1.857 + * Note that when this is set, the background is not drawn with skin
1.858 + * nor cleared, so the background MUST be drawn by the parent control
1.859 + * every time the editor changes.
1.860 + *
1.861 + * @param aSuppress If ETrue, suppress background drawing
1.862 + */
1.863 + IMPORT_C void SetSuppressBackgroundDrawing( TBool aSuppress );
1.864 +
1.865 + /**
1.866 + * Used for setting various flag-like features to the editor.
1.867 + *
1.868 + * @param aFeatureId The feature id, see TFeatureId
1.869 + * @param aFeatureParam The feature parameter. This is usually
1.870 + * enabled or disabled. For more info, see
1.871 + * the feature documentation in TFeatureId.
1.872 + * @return KErrNone if the feature modification succeeded
1.873 + * @since S60 3.2
1.874 + **/
1.875 + IMPORT_C TInt SetFeature( TInt aFeatureId, TInt aFeatureParam );
1.876 +
1.877 + /**
1.878 + * Used to getting feature statuses.
1.879 + *
1.880 + * @param aFeatureId The feature id, see TFeatureId
1.881 + * @param aFeatureParam On return, the parameter for the feature
1.882 + * (usually non-zero for an enabled feature
1.883 + * and zero for disabled)
1.884 + * @return KErrNone if the feature is supported and fetching its value
1.885 + * succeeded
1.886 + * @since S60 3.2
1.887 + */
1.888 + IMPORT_C TInt GetFeature( TInt aFeatureId, TInt& aFeatureParam ) const;
1.889 +
1.890 + /**
1.891 + * Used for checking if the editor supports a feature.
1.892 + * For features, see TFeatureId.
1.893 + *
1.894 + * @param aFeatureId
1.895 + * @return ETrue if the feature is supported
1.896 + * @since S60 3.2
1.897 + */
1.898 + IMPORT_C TBool SupportsFeature( TInt aFeatureId ) const;
1.899 +
1.900 + // Highlights a field
1.901 + void HighlightField( TInt aFieldPosition );
1.902 +
1.903 + /**
1.904 + * Gets a pointer to the CFont object that is used to draw the fields in
1.905 + * this editor.
1.906 + *
1.907 + * @return A pointer to the CFont object used to draw the fields in
1.908 + * this editor.
1.909 + */
1.910 + IMPORT_C const CFont* Font() const;
1.911 +
1.912 + /**
1.913 + * Sets the font that is used to draw the fields in this editor.
1.914 + *
1.915 + * @param aFont A pointer to a CFont object that is used to draw the
1.916 + * fields in this editor.
1.917 + */
1.918 + IMPORT_C void SetFont(const CFont* aFont);
1.919 +
1.920 + /**
1.921 + * Sets within in the editor an externally owned Skins background control context.
1.922 + * This background control context will then be used by the editor to draw background.
1.923 + *
1.924 + * If this API is not called, then the editor IS skin enabled, (that is CEikMfnes are skin
1.925 + * enabled by default) but it will try to find a control context with which to perform background
1.926 + * drawing from the Control Environment, via the Object Provider.
1.927 + *
1.928 + * Setting this control context to NULL will have the effect of turning off background
1.929 + * skinning.
1.930 + *
1.931 + * @param aBackgroundControlContext Control context to store. Not owned. Can be NULL
1.932 + */
1.933 + IMPORT_C void SetSkinBackgroundControlContextL( MAknsControlContext* aControlContext );
1.934 +
1.935 +
1.936 + /**
1.937 + * From MAknMfneCommandObserver. Allows owning controls to give commands to
1.938 + * MFNE editors. This is interface was added to enable modifying the current field
1.939 + * value with touch buttons.
1.940 + *
1.941 + * @param aCommand Command ID defined in MAknMfneCommandObserver::TMfneCommand
1.942 + */
1.943 + IMPORT_C void HandleMfneCommandL(TInt aCommand);
1.944 +
1.945 + /**
1.946 + * Sets the MFNE to use the CCoeControl::OverrideColorL() defined
1.947 + * color in drawing. If this is set, no skinning will be used
1.948 + * in drawing.
1.949 + *
1.950 + * @param aUseOverrideColors ETrue to make the MFNE use overridden colors.
1.951 + * @since S60 v3.2
1.952 + */
1.953 + IMPORT_C void SetUseOverrideColors( TBool aUseOverrideColors );
1.954 +
1.955 +
1.956 +public: // from CCoeControl
1.957 + /**
1.958 + * Handles key events.
1.959 + *
1.960 + * Overrides CCoeControl::OfferKeyEventL(). The key event is passed
1.961 + * onto the current field to handle.
1.962 + *
1.963 + * @param aKeyEvent The key event.
1.964 + * @param aType The type of key event.
1.965 + * @return Indicates whether or not the key event was used by this
1.966 + * control.
1.967 + */
1.968 + IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
1.969 +
1.970 + /**
1.971 + * Prepares for focus loss.
1.972 + *
1.973 + * Overrides CCoeControl::PrepareForFocusLossL().
1.974 + *
1.975 + * This function should be called when an attempt is made to remove
1.976 + * focus from a multi-field numeric editor. It redraws the control, removing
1.977 + * highlighting from the current field.
1.978 + *
1.979 + * It may be overridden in derived classes to test the validity of
1.980 + * information entered into the editor. Derived class versions should include
1.981 + * a base function call.
1.982 + */
1.983 + IMPORT_C virtual void PrepareForFocusLossL();
1.984 +
1.985 + /**
1.986 + * Gets the minimum size of the control.
1.987 + *
1.988 + * Overrides CCoeControl::MinimumSize().
1.989 + *
1.990 + * @return The minimum control size.
1.991 + */
1.992 + IMPORT_C virtual TSize MinimumSize();
1.993 +
1.994 + /**
1.995 + * Gets the list of logical colours used to draw the control.
1.996 + *
1.997 + * The colours are appended to aColorUseList.
1.998 + *
1.999 + * Overrides CCoeControl::GetColorUseListL().
1.1000 + *
1.1001 + * @param aColorUseList On return, the colour list.
1.1002 + */
1.1003 + IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u
1.1004 +
1.1005 + /**
1.1006 + * Handles a change to the control's resources.
1.1007 + *
1.1008 + * The types of resources handled are those which are shared across the
1.1009 + * environment, e.g. colours or fonts.
1.1010 + *
1.1011 + * Overrides CCoeControl::HandleResourceChange().
1.1012 + *
1.1013 + * @param aType A message UID value.
1.1014 + */
1.1015 + IMPORT_C virtual void HandleResourceChange(TInt aType); // not available before Release 005u
1.1016 +
1.1017 + /**
1.1018 + * Gets the total of the input capabilities of all the editor's fields.
1.1019 + *
1.1020 + * Overrides CCoeControl::InputCapabilities().
1.1021 + *
1.1022 + * If this function is overrided in a subclass, the subclass should
1.1023 + * obtain this class' InputCapabilities' object provider through
1.1024 + * TCoeInputCapabilities::ObjectProvider() and set that as a part of
1.1025 + * the subclass' InputCapabilities object provider chain to ensure
1.1026 + * maximum functionality.
1.1027 + *
1.1028 + * @return The control's input capabilities.
1.1029 + */
1.1030 + IMPORT_C virtual TCoeInputCapabilities InputCapabilities() const;
1.1031 +
1.1032 + /**
1.1033 + * From @c CCoeControl.
1.1034 + *
1.1035 + * Handles pointer events.
1.1036 + *
1.1037 + * @param aPointerEvent The pointer event.
1.1038 + */
1.1039 + IMPORT_C virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.1040 +
1.1041 + /**
1.1042 + * Retrieves an object of the same type as that encapsulated in aId.
1.1043 + *
1.1044 + * Overrides CCoeControl::MopSupplyObject().
1.1045 + *
1.1046 + * @param aId An encapsulated object type ID.
1.1047 + * @return Encapsulates the pointer to the object provided. Note that
1.1048 + * the encapsulated pointer may be NULL.
1.1049 + */
1.1050 + IMPORT_C virtual TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
1.1051 +
1.1052 +public: // new
1.1053 + /**
1.1054 + * Sets the colors for text and background as skin IDs. Please note that
1.1055 + * bgcolor overrides skinned draw if set
1.1056 + *
1.1057 + * @since 3.0
1.1058 + * @param aAknSkinIDForTextColor ID for text color.
1.1059 + * @param aAknSkinIDForBgColor ID for background color.
1.1060 + */
1.1061 + IMPORT_C void SetSkinTextColorL(TInt aAknSkinIDForTextColor, TInt aAknSkinIDForBgColor=KErrNotFound);
1.1062 +
1.1063 +protected:
1.1064 + // framework
1.1065 + /**
1.1066 + * Redraws the current field, so removing or displaying the cursor.
1.1067 + *
1.1068 + * If the editor has lost focus, the current field is reset to the
1.1069 + * first editable field.
1.1070 + *
1.1071 + * @param aDrawNow Whether to draw the control immediately.
1.1072 + */
1.1073 + IMPORT_C virtual void FocusChanged(TDrawNow aDrawNow);
1.1074 +
1.1075 + /**
1.1076 + * Writes the internal state of the control and its components to
1.1077 + * aStream.
1.1078 + *
1.1079 + * This function is empty in release builds.
1.1080 + */
1.1081 + IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
1.1082 +
1.1083 + // miscellaneous functions
1.1084 +
1.1085 + /**
1.1086 + * Handles the redrawing associated with a change to the current field.
1.1087 + *
1.1088 + * Called by OfferKeyEventL(), HandlePointerEventL() and
1.1089 + * PrepareForFocusLossL().
1.1090 + *
1.1091 + * @param aHandleDeHighlight ETrue if the current field has changed so
1.1092 + * requires de-highlighting.
1.1093 + * @param aNewCurrentField The index of the field to which the user has
1.1094 + * moved.
1.1095 + * @param aOldWidthInPixelsOfOldCurrentField The width in pixels of the
1.1096 + * previous current field.
1.1097 + * @param aOldHighlightTypeOfOldCurrentField The highlight type of the
1.1098 + * previously current field.
1.1099 + * @param aDataAltered ETrue if the data has been changed.
1.1100 + * @param aError On return, ETrue if successful, EFalse if not
1.1101 + * successful.
1.1102 + */
1.1103 + IMPORT_C void HandleInteraction(TBool aHandleDeHighlight, TInt aNewCurrentField, TInt aOldWidthInPixelsOfOldCurrentField,
1.1104 + CEikMfneField::THighlightType aOldHighlightTypeOfOldCurrentField, TBool& aDataAltered, TBool& aError);
1.1105 +
1.1106 + /**
1.1107 + * Empty virtual function.
1.1108 + *
1.1109 + * Called by HandleInteraction() when switching from the current field.
1.1110 + * Can be implemented by derived classes to maintain consistency between
1.1111 + * fields, e.g. in a range editor.
1.1112 + *
1.1113 + * @param aField The current field.
1.1114 + * @param aDrawAllFields On return, whether all fields have changed and
1.1115 + * need to be redrawn.
1.1116 + */
1.1117 + IMPORT_C virtual void FieldIsAboutToBeDeHighlighted(CEikMfneField* aField, TBool& aDrawAllFields); // first occurrence of this virtual function - does nothing by default
1.1118 +
1.1119 + /**
1.1120 + * Gets the size of the multi-field numeric editor.
1.1121 + *
1.1122 + * The width is the sum of the maximum widths of every field.
1.1123 + *
1.1124 + * @return The size of the multi-field numeric editor.
1.1125 + */
1.1126 + IMPORT_C TSize MfneSize() const;
1.1127 +
1.1128 + /**
1.1129 + * Gets the size of the multi-field numeric editor.
1.1130 + *
1.1131 + * The width is the sum of the maximum widths of every field.
1.1132 + *
1.1133 + * @param aShrinkToMinimumSize ETrue to shrink the width to the minimum
1.1134 + * required for each field.
1.1135 + * @return The size of the multi-field numeric editor.
1.1136 + */
1.1137 + IMPORT_C TSize MfneSize(TBool aShrinkToMinimumSize);
1.1138 +
1.1139 + IMPORT_C virtual void SizeChanged();
1.1140 +
1.1141 +public:
1.1142 + static void InvalidFieldAlert();
1.1143 + static void LeaveWithAlert(TInt aResourceId);
1.1144 + void GetCursorInfo( TPoint& aPos, TInt& aHeight, TInt& aWidth, TInt& aAscent );
1.1145 + void ReportUpdate();
1.1146 + IMPORT_C virtual void MakeVisible(TBool aVisible);
1.1147 + void SetCurrentField( TInt aCurrentField );
1.1148 + void SetValidateCallBack( TCallBack aCallBack );
1.1149 + void ReportStateChangeEventL();
1.1150 +
1.1151 +private:
1.1152 + // framework
1.1153 + IMPORT_C virtual void Draw(const TRect& aRect) const;
1.1154 +
1.1155 + // new virtual functions
1.1156 + IMPORT_C virtual void CreatePopoutIfRequiredL();
1.1157 + // miscellaneous functions
1.1158 + void DrawRange(CWindowGc& aGc, TInt aFirstField, TInt aLastField) const;
1.1159 + CWindowGc& PreparedGc() const;
1.1160 + void SetGcToNormalVideo(CWindowGc& aGc) const;
1.1161 + void SetGcToInverseVideo(CWindowGc& aGc) const;
1.1162 + void SetGcToDimmedVideo(CWindowGc& aGc) const;
1.1163 + void DrawCursor();
1.1164 + void HideCursor();
1.1165 + IMPORT_C void Reserved_2();
1.1166 + IMPORT_C virtual void CEikMfne_Reserved();
1.1167 +
1.1168 +private:
1.1169 + /**
1.1170 + * From CAknControl
1.1171 + */
1.1172 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.1173 +
1.1174 +private:
1.1175 + enum {ENullIndex=KMaxTInt};
1.1176 +
1.1177 + /**
1.1178 + * Access to state of whether up/down keys are eaten and used to increment/decrement. If
1.1179 + * these keys are not consumed, then the events are passed on.
1.1180 + *
1.1181 + * @return EFalse iff Up and Down keys are not consumed (and acted upon)
1.1182 + */
1.1183 + TBool ConsumesUpAndDownKeys() const;
1.1184 +
1.1185 + /**
1.1186 + * This state of enabling means that skinning will actually be drawn
1.1187 + * It is a combination of
1.1188 + * - application is skin enabled
1.1189 + * - current skin has a background or frame bitmap
1.1190 + * It is set during construction and does not change its value after except if the Skin is
1.1191 + * changed, whereupon the control context is re-accessed and checked for bitmaps present
1.1192 + *
1.1193 + * @return EFalse iff background skin will not be drawn.
1.1194 + */
1.1195 + TBool SkinningBackground() const;
1.1196 +
1.1197 + /**
1.1198 + * Checks if app is skin enabled and that the current control context has bitmap.
1.1199 + * If so, then state is set true.
1.1200 + * This should be called at constuction and when HandleResourceChange is called
1.1201 + *
1.1202 + */
1.1203 + void EvaluateSkinningBackground();
1.1204 +
1.1205 + /**
1.1206 + * Access to Skins background control context that is potentially being used by the Editor.
1.1207 + *
1.1208 + * This API will first check to see if an control context has been set by API, and if so,
1.1209 + * return that. If the background control context has been set to NULL by API, then it will
1.1210 + * return NULL. If the background control context has never been set by API, then this returns
1.1211 + * the control context (if one exists) that the object obtains from Object Provider.
1.1212 + *
1.1213 + * @return Pointer to control context potentially in use, or NULL.
1.1214 + */
1.1215 + MAknsControlContext* SkinBackgroundControlContext() const;
1.1216 +
1.1217 + /**
1.1218 + * Check for the existence of the extension and create if required.
1.1219 + */
1.1220 + void CreateExtensionIfRequiredL();
1.1221 +
1.1222 +private:
1.1223 + TInt iNumFields;
1.1224 + TInt iCurrentField;
1.1225 + CEikMfneField** iFields;
1.1226 + CEikMfneExtension* iExtension;
1.1227 + const CFont* iFont;
1.1228 + TInt iAlignment;
1.1229 + TBitFlags iFlags;
1.1230 + };
1.1231 +
1.1232 +inline TInt CEikMfne::CurrentField() const
1.1233 + {
1.1234 + return(iCurrentField);
1.1235 + }
1.1236 +
1.1237 +inline TInt CEikMfne::NumFields() const
1.1238 + {
1.1239 + return(iNumFields);
1.1240 + }
1.1241 +
1.1242 +//
1.1243 +
1.1244 +/**
1.1245 + * Integer editor.
1.1246 + *
1.1247 + * This control supports editing a single integer value. If a number is
1.1248 + * entered which is not within the range specified by the maximum and
1.1249 + * minimum control values it is automatically reset to the nearest
1.1250 + * allowable value.
1.1251 + *
1.1252 + * The editor has an associated resource struct NUMBER_EDITOR and
1.1253 + * control factory identifier EEikCtNumberEditor.
1.1254 + */
1.1255 +class CEikNumberEditor : public CEikMfne
1.1256 + {
1.1257 +public:
1.1258 + // miscellaneous functions
1.1259 +
1.1260 + /**
1.1261 + * Constructor.
1.1262 + *
1.1263 + * This function should be used as the first stage in two stage
1.1264 + * construction, followed by a call to either ConstructFromResourceL() to
1.1265 + * initialise the editor's field values from a resource file, or ConstructL()
1.1266 + * if no resource file is used.
1.1267 + */
1.1268 + IMPORT_C CEikNumberEditor();
1.1269 +
1.1270 + /**
1.1271 + * Second-phase constructor.
1.1272 + *
1.1273 + * Completes the construction of an integer editor. It should be called
1.1274 + * by container only if the editor is not constructed from a resource.
1.1275 + *
1.1276 + * Sets the minimum and maximum values that can be entered into the
1.1277 + * editor, and the initial value.
1.1278 + *
1.1279 + * @param aMinimumValue The minimum allowable value.
1.1280 + * @param aMaximumValue The maximum allowable value.
1.1281 + * @param aInitialValue The initial value.
1.1282 + */
1.1283 + IMPORT_C void ConstructL(TInt aMinimumValue, TInt aMaximumValue, TInt aInitialValue); // to be called by container only if not constructed from resource
1.1284 +
1.1285 + /**
1.1286 + * Sets the minimum and maximum editor values.
1.1287 + *
1.1288 + * Only values inside the initial minimum and maximum are permitted.
1.1289 + *
1.1290 + * If the editor's value is outside the new bounds when the function is
1.1291 + * called, it is reset to the nearest allowable value.
1.1292 + *
1.1293 + * @param aMinimumValue The minimum allowable value.
1.1294 + * @param aMaximumValue The maximum allowable value.
1.1295 + * @panic 9 If the minimum is greater than the maximum allowable value.
1.1296 + */
1.1297 + IMPORT_C void SetMinimumAndMaximum(TInt aMinimumValue, TInt aMaximumValue); // only values inside the initial minimum and maximum are permitted
1.1298 +
1.1299 + /**
1.1300 + * Gets the integer editor's minimum and maximum values.
1.1301 + *
1.1302 + * @param aMinimumValue On return, contains the integer editor's
1.1303 + * minimum allowable value.
1.1304 + * @param aMaximumValue On return, contains the integer editor's
1.1305 + * maximum allowable value.
1.1306 + */
1.1307 + IMPORT_C void GetMinimumAndMaximum(TInt& aMinimumValue, TInt& aMaximumValue) const;
1.1308 +
1.1309 + /**
1.1310 + * Sets the integer editor's value.
1.1311 + *
1.1312 + * The control is not redrawn.
1.1313 + *
1.1314 + * @param aNumber The editor's new value.
1.1315 + * @panic 11 In debug builds, if aNumber is outside the valid range.
1.1316 + */
1.1317 + IMPORT_C void SetNumber(TInt aNumber);
1.1318 +
1.1319 + /**
1.1320 + * Gets the integer editor's value.
1.1321 + *
1.1322 + * @return The integer editor's value.
1.1323 + * @panic 12 In debug builds, if the editor has no content.
1.1324 + */
1.1325 + IMPORT_C TInt Number() const; // can only be called if PrepareForFocusLossL() succeeded
1.1326 +
1.1327 + // framework
1.1328 +
1.1329 + /**
1.1330 + * Second-phase construction from a resource file.
1.1331 + *
1.1332 + * The function reads the maximum and minimum editor values from a
1.1333 + * NUMBER_EDITOR resource, and sets the initial number to be the same as the
1.1334 + * maximum value.
1.1335 + *
1.1336 + * @param aResourceReader A resource file reader.
1.1337 + */
1.1338 + IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aResourceReader);
1.1339 +
1.1340 + // From CCoeControl
1.1341 +
1.1342 + /**
1.1343 + * From @c CCoeControl.
1.1344 + *
1.1345 + * Handles pointer events.
1.1346 + *
1.1347 + * @param aPointerEvent The pointer event.
1.1348 + */
1.1349 + IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.1350 +private:
1.1351 + IMPORT_C virtual void CEikMfne_Reserved();
1.1352 +private:
1.1353 + void RefreshFromLocale();
1.1354 +private:
1.1355 + /**
1.1356 + * From CAknControl
1.1357 + */
1.1358 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.1359 +private:
1.1360 + // none of these pointers owns anything
1.1361 + CEikMfneNumber* iNumber;
1.1362 + TInt iSpare;
1.1363 + };
1.1364 +
1.1365 +
1.1366 +//
1.1367 +/**
1.1368 + * Range struct for CEikRangeEditor.
1.1369 + */
1.1370 +struct SEikRange
1.1371 + {
1.1372 + /**
1.1373 + * The lower limit.
1.1374 + */
1.1375 + TInt iLowerLimit;
1.1376 +
1.1377 + /**
1.1378 + * The upper limit.
1.1379 + */
1.1380 + TInt iUpperLimit;
1.1381 + };
1.1382 +
1.1383 +//
1.1384 +
1.1385 +/**
1.1386 + * Numeric range editor.
1.1387 + *
1.1388 + * This editor supports editing an integer range. It has two fields;
1.1389 + * the first represents the lower value and the second the upper value. The
1.1390 + * second value must be greater than, or equal to, the first.
1.1391 + *
1.1392 + * Minimum and maximum values for the editor are specified during
1.1393 + * construction. If a number is entered which is not within the editor's
1.1394 + * minimum and maximum values, it is automatically reset to the nearest
1.1395 + * allowable value.
1.1396 + *
1.1397 + * The editor has an associated resource struct RANGE_EDITOR and
1.1398 + * control factory identifier EEikCtRangeEditor.
1.1399 + */
1.1400 +class CEikRangeEditor : public CEikMfne
1.1401 + {
1.1402 +public:
1.1403 + // miscellaneous functions
1.1404 +
1.1405 + /**
1.1406 + * Default constructor.
1.1407 + *
1.1408 + * This function should be used as the first stage in two stage
1.1409 + * construction, followed by a call to either ConstructFromResourceL() to
1.1410 + * initialise the editor's field values from a resource file, or ConstructL()
1.1411 + * if no resource file is used.
1.1412 + */
1.1413 + IMPORT_C CEikRangeEditor();
1.1414 +
1.1415 + // 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
1.1416 + /**
1.1417 + * Second phase constructor.
1.1418 + *
1.1419 + * This function completes construction of a range editor. It sets the
1.1420 + * minimum and maximum values, initial range and separator text. It
1.1421 + * should be called by the container only if the control is not constructed
1.1422 + * from a resource file.
1.1423 + *
1.1424 + * @param aMinimumValue The minimum value for the range editor.
1.1425 + * @param aMaximumValue The maximum value for the range editor.
1.1426 + * @param aInitialRange Struct containing upper and lower range limits.
1.1427 + * Must be within the minimum and maximum values.
1.1428 + * @param aSeparatorText The text to be used to separate the numeric
1.1429 + * values.
1.1430 + * @panic 8 If the initial lower or upper limit is outside the minimum
1.1431 + * or maximum bounds.
1.1432 + */
1.1433 + IMPORT_C void ConstructL(TInt aMinimumValue, TInt aMaximumValue, const SEikRange& aInitialRange, HBufC* aSeparatorText);
1.1434 +
1.1435 + /**
1.1436 + * Sets the range editor's minimum and maximum values.
1.1437 + *
1.1438 + * Any values are permitted. If the range values are outside the new
1.1439 + * minimum / maximum they are changed to be within the new minimum /
1.1440 + * maximum.
1.1441 + *
1.1442 + * @param aMinimumValue The minimum value for the range editor.
1.1443 + * @param aMaximumValue The maximum value for the range editor.
1.1444 + */
1.1445 + IMPORT_C void SetMinimumAndMaximum(TInt aMinimumValue, TInt aMaximumValue); // only values inside the initial minimum and maximum are permitted
1.1446 +
1.1447 + /**
1.1448 + * Gets the range editor's minimum and maximum values.
1.1449 + *
1.1450 + * @param aMinimumValue On return, the minimum value for the range
1.1451 + * editor.
1.1452 + * @param aMaximumValue On return, the maximum value for the range
1.1453 + * editor.
1.1454 + */
1.1455 + IMPORT_C void GetMinimumAndMaximum(TInt& aMinimumValue, TInt& aMaximumValue) const;
1.1456 +
1.1457 + /**
1.1458 + * Sets the range editor's current values.
1.1459 + *
1.1460 + * @param aRange Struct containing new range values.
1.1461 + */
1.1462 + IMPORT_C void SetRange(const SEikRange& aRange);
1.1463 +
1.1464 + /**
1.1465 + * Gets the range editor's current values.
1.1466 + *
1.1467 + * Can only be called if CEikMfne::PrepareForFocusLossL() succeeded
1.1468 + *
1.1469 + * @return Struct containing current range values.
1.1470 + */
1.1471 + IMPORT_C SEikRange Range() const; // can only be called if PrepareForFocusLossL() succeeded
1.1472 +
1.1473 + // framework
1.1474 +
1.1475 + /**
1.1476 + * Second phase constructor from resource.
1.1477 + *
1.1478 + * This function completes construction of a newly-allocated range
1.1479 + * editor. It sets the minimum and maximum values, initial range and
1.1480 + * separator text as specified by the resource.
1.1481 + *
1.1482 + * @param aResourceReader A resource reader.
1.1483 + */
1.1484 + IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aResourceReader);
1.1485 +
1.1486 + // From CCoeControl
1.1487 +
1.1488 + /**
1.1489 + * From @c CCoeControl.
1.1490 + *
1.1491 + * Handles pointer events.
1.1492 + *
1.1493 + * @param aPointerEvent The pointer event.
1.1494 + */
1.1495 + IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.1496 +private:
1.1497 + virtual void FieldIsAboutToBeDeHighlighted(CEikMfneField* aField, TBool& aDrawAllFields);
1.1498 + IMPORT_C virtual void CEikMfne_Reserved();
1.1499 + void RefreshFromLocale();
1.1500 +private:
1.1501 + /**
1.1502 + * From CAknControl
1.1503 + */
1.1504 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.1505 +private:
1.1506 + // none of these pointers owns anything
1.1507 + CEikMfneNumber* iLowerLimit;
1.1508 + CEikMfneNumber* iUpperLimit;
1.1509 + TInt iSpare;
1.1510 + };
1.1511 +
1.1512 +
1.1513 +//
1.1514 +
1.1515 +/**
1.1516 + * Specifies an abstract interface for time and date editors where the
1.1517 + * time and date are set and retrieved using the TTime class.
1.1518 + */
1.1519 +class CEikTTimeEditor : public CEikMfne
1.1520 + {
1.1521 +public:
1.1522 + /**
1.1523 + * An implementation (of this pure virtual function) should set the
1.1524 + * range of allowable time values.
1.1525 + *
1.1526 + * This defines the maximum and minimum values that may be entered by
1.1527 + * the user.
1.1528 + *
1.1529 + * @param aMinimumTime The minimum allowable value.
1.1530 + * @param aMaximumTime The maximum allowable value.
1.1531 + */
1.1532 + virtual void SetMinimumAndMaximum(const TTime& aMinimumTime, const TTime& aMaximumTime)=0;
1.1533 +
1.1534 + /**
1.1535 + * An implementation (of this pure virtual function) should get the
1.1536 + * range of allowable time values.
1.1537 + *
1.1538 + * @param aMinimumTime The minimum allowable value.
1.1539 + * @param aMaximum The maximum allowable value.
1.1540 + */
1.1541 + virtual void GetMinimumAndMaximum(TTime& aMinimumTime, TTime& aMaximum) const=0;
1.1542 +
1.1543 + /**
1.1544 + * An implementation (of this pure virtual function) should set the time
1.1545 + * in the editor.
1.1546 + *
1.1547 + * @param aTime The time.
1.1548 + */
1.1549 + virtual void SetTTime(const TTime& aTime)=0;
1.1550 +
1.1551 + /**
1.1552 + * An implementation (of this pure virtual function) should get the time
1.1553 + * from the editor.
1.1554 + *
1.1555 + * Can only be called if CEikMfne::PrepareForFocusLossL() succeeded.
1.1556 + *
1.1557 + * @return The time.
1.1558 + */
1.1559 + virtual TTime GetTTime() const=0; // can only be called if PrepareForFocusLossL() succeeded
1.1560 + };
1.1561 +
1.1562 +/**
1.1563 + * Time editor.
1.1564 + *
1.1565 + * This control allows a time value to be displayed and edited. By
1.1566 + * default the editor has hours, minutes and seconds fields, although the
1.1567 + * seconds and hours fields may be omitted. 12 and 24-hour format are
1.1568 + * supported. When 12-hour format is used, am or pm text will be included as
1.1569 + * another field, either before or after the time. Locale information is
1.1570 + * used to determine the time separator characters. Locale information is
1.1571 + * set and retrieved using class TLocale.
1.1572 + *
1.1573 + * The upper and lower field bounds are set depending on the format,
1.1574 + * and times outside these bounds are invalid.
1.1575 + *
1.1576 + * The editor has an associated resource struct TIME_EDITOR and control
1.1577 + * factory identifier EEikCtTimeEditor.
1.1578 + */
1.1579 +class CEikTimeEditor : public CEikTTimeEditor
1.1580 + {
1.1581 +public:
1.1582 + // miscellaneous functions
1.1583 + /**
1.1584 + * Default constructor.
1.1585 + *
1.1586 + * This function should be used as the first stage in two stage
1.1587 + * construction, followed by a call to either: ConstructFromResourceL() to
1.1588 + * initialise the editor's field values from a resource file, or ConstructL()
1.1589 + * if no resource file is used.
1.1590 + */
1.1591 + IMPORT_C CEikTimeEditor();
1.1592 +
1.1593 + /**
1.1594 + * Destructor.
1.1595 + *
1.1596 + * This frees the resources owned by the time editor, prior to its
1.1597 + * destruction.
1.1598 + */
1.1599 + IMPORT_C virtual ~CEikTimeEditor();
1.1600 +
1.1601 + /**
1.1602 + * Second phase construction.
1.1603 + *
1.1604 + * This function completes the construction of a newly-allocated time
1.1605 + * editor, by setting its minimum, maximum and initial values, and the
1.1606 + * AM/PM text settings - the AM/PM settings and time separator characters
1.1607 + * specified in class TLocale are honoured. It should be called by the
1.1608 + * container only if the control is not constructed from a resource file.
1.1609 + *
1.1610 + * If the initial time is outside the bounds specified, it is reset to
1.1611 + * the nearest available setting.
1.1612 + *
1.1613 + * The aFlags parameter is used to determine whether the seconds or
1.1614 + * hours fields are required. The minutes field is always present. It may
1.1615 + * also be used to specify whether or not to force 24 hour time format,
1.1616 + * overriding the locale's setting.
1.1617 + *
1.1618 + * A panic will occur if the minimum time is later than the maximum
1.1619 + * time.
1.1620 + *
1.1621 + * @param aMinimumTime The minimum allowable time.
1.1622 + * @param aMaximumTime The maximum allowable time.
1.1623 + * @param aInitialTime The initial time.
1.1624 + * @param aFlags Determines which fields are required and whether or
1.1625 + * not to force 24 hour formatting. See eikon.hrh EEiktime etc.
1.1626 + */
1.1627 + 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
1.1628 +
1.1629 + /**
1.1630 + * Sets the time editor's value.
1.1631 + *
1.1632 + * @param aTime The new value to which to set the editor's fields.
1.1633 + */
1.1634 + IMPORT_C void SetTime(const TTime& aTime);
1.1635 +
1.1636 + /**
1.1637 + * Gets the time editor's value.
1.1638 + *
1.1639 + * @return The editor's value. (Date values are all zero.)
1.1640 + */
1.1641 + IMPORT_C TTime Time() const;
1.1642 +
1.1643 + /**
1.1644 + * Sets the uninitialized status of the editor.
1.1645 + *
1.1646 + * @param aUninitialised If ETrue, sets the editor as uninitialized,
1.1647 + * i.e. it doesn't display anything.
1.1648 + */
1.1649 + IMPORT_C void SetUninitialised(TBool aUninitialised);
1.1650 +
1.1651 + /**
1.1652 + * Gets the uninitialized status of the editor.
1.1653 + *
1.1654 + * @return ETrue, if the editor is set as uninitialized.
1.1655 + */
1.1656 + IMPORT_C TBool IsUninitialised() const;
1.1657 + // from CEikTTimeEditor
1.1658 +
1.1659 + /**
1.1660 + * Sets the range of allowable time values.
1.1661 + *
1.1662 + * These define the maximum and minimum values that may be entered by
1.1663 + * the user.
1.1664 + *
1.1665 + * If the existing time value is outside the bounds set by this
1.1666 + * function, it is reset to the nearest boundary value.
1.1667 + *
1.1668 + * @param aMinimumTime The minimum allowable value.
1.1669 + * @param aMaximumTime The maximum allowable value.
1.1670 + * @panic 38 If the minimum value exceeds the maximum.
1.1671 + */
1.1672 + IMPORT_C virtual void SetMinimumAndMaximum(const TTime& aMinimumTime, const TTime& aMaximumTime); // only values inside the initial minimum and maximum are permitted
1.1673 +
1.1674 + /**
1.1675 + * Gets the range of allowable values that may be entered by the user.
1.1676 + *
1.1677 + * @param aMinimumTime On return, contains the time editor's minimum
1.1678 + * allowable value.
1.1679 + * @param aMaximumTime On return, contains the time editor's maximum
1.1680 + * allowable value.
1.1681 + */
1.1682 + IMPORT_C virtual void GetMinimumAndMaximum(TTime& aMinimumTime, TTime& aMaximumTime) const;
1.1683 +
1.1684 + // from CCoeControl
1.1685 +
1.1686 + /**
1.1687 + * Second phase construction from a resource.
1.1688 + *
1.1689 + * This function completes the construction of a newly-allocated time
1.1690 + * editor from a TIME_EDITOR resource. The minimum and maximum times, and
1.1691 + * the flags settings are read from the resource, and ConstructL() is
1.1692 + * called with these settings. The initial time is set to the maximum time
1.1693 + * value. Honours the locale's AM/PM text setting and time separators.
1.1694 + *
1.1695 + * @param aResourceReader A resource file reader.
1.1696 + *
1.1697 + */
1.1698 + IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aResourceReader);
1.1699 +
1.1700 + /**
1.1701 + * Prepares the editor for focus loss.
1.1702 + *
1.1703 + * This function should be called to validate the editor's contents
1.1704 + * when an attempt is made to remove focus from the control. If the control
1.1705 + * value is not within the bounds specified by the minimum and maximum
1.1706 + * time values, it is reset to the nearest allowable value, the function
1.1707 + * will leave and will display an appropriate message.
1.1708 + */
1.1709 + IMPORT_C virtual void PrepareForFocusLossL();
1.1710 +
1.1711 + /**
1.1712 + * From @c CCoeControl.
1.1713 + *
1.1714 + * Handles pointer events.
1.1715 + *
1.1716 + * @param aPointerEvent The pointer event.
1.1717 + */
1.1718 + IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.1719 +private:
1.1720 + // from CEikTTimeEditor
1.1721 + virtual void SetTTime(const TTime& aTime);
1.1722 + virtual TTime GetTTime() const; // can only be called if PrepareForFocusLossL() succeeded
1.1723 +private:
1.1724 + // miscellaneous functions
1.1725 + void DoSetMinimumAndMaximum(const TTime& aMinimumTime, const TTime& aMaximumTime);
1.1726 + IMPORT_C virtual void CEikMfne_Reserved();
1.1727 +private:
1.1728 + /**
1.1729 + * From CAknControl
1.1730 + */
1.1731 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.1732 +private:
1.1733 + CTimeEditor* iTimeEditor;
1.1734 + TTime iMinimumTime;
1.1735 + TTime iMaximumTime;
1.1736 + TInt iSpare;
1.1737 + };
1.1738 +
1.1739 +
1.1740 +//
1.1741 +
1.1742 +// note: TDateTime uses zero based day numbers, so -1 on the day field
1.1743 +#define KAknMinimumDate (TTime(TDateTime(0001, EJanuary, 1-1, 0, 0, 0, 0)))
1.1744 +#define KAknMaximumDate (TTime(TDateTime(9999, EDecember, 31-1, 23, 59, 59, 999999)))
1.1745 +
1.1746 +/**
1.1747 + * Date editor.
1.1748 + *
1.1749 + * A date editor has five fields: day, month and year, and two separator
1.1750 + * characters. The order of the fields varies depending on the locale's
1.1751 + * date format setting. Locale information, which is set and retrieved using
1.1752 + * class @c TLocale, is used to determine field order and the characters used
1.1753 + * to separate the date components. The upper and lower field bounds are set,
1.1754 + * and dates outside these bounds are invalid.
1.1755 + *
1.1756 + * The editor can be configured to launch a pop-out calendar dialog,
1.1757 + * @c CEikCalendar. This may be used to directly set the day, month and year
1.1758 + * values.
1.1759 + *
1.1760 + * The editor has an associated resource struct @c DATE_EDITOR and control
1.1761 + * factory identifier @c EEikCtDateEditor.
1.1762 + *
1.1763 + */
1.1764 +class CEikDateEditor : public CEikTTimeEditor, private MEikCalendarObserver
1.1765 + {
1.1766 +
1.1767 +public:
1.1768 +
1.1769 + // miscellaneous functions
1.1770 + /**
1.1771 + * C++ default constructor.
1.1772 + */
1.1773 + IMPORT_C CEikDateEditor();
1.1774 +
1.1775 + /**
1.1776 + * Destructor.
1.1777 + */
1.1778 + IMPORT_C virtual ~CEikDateEditor();
1.1779 +
1.1780 + // to be called by container only if not constructed from resource
1.1781 + /**
1.1782 + * Handles 2nd phase construction.
1.1783 + *
1.1784 + * This function completes the construction of a newly-allocated date
1.1785 + * editor. This function should be used instead of
1.1786 + * @c ConstructFromResourceL() when not initialising from a resource file.
1.1787 + * The editor's minimum, maximum and initial date values are set and the
1.1788 + * date format and date separator characters specified in class @c TLocale
1.1789 + * are honoured.
1.1790 + *
1.1791 + * @param aMinimumDate The minimum allowable date.
1.1792 + * @param aMaximumDate The maximum allowable date.
1.1793 + * @param aInitialDate The initial value.
1.1794 + * @param aWithoutPopoutCalendar If @c ETrue the editor will not have a
1.1795 + * pop-out calendar dialog / icon. If @c EFalse the editor will have
1.1796 + * a pop-out calendar dialog / icon.
1.1797 + */
1.1798 + IMPORT_C void ConstructL(const TTime& aMinimumDate,
1.1799 + const TTime& aMaximumDate,
1.1800 + const TTime& aInitialDate,
1.1801 + TBool aWithoutPopoutCalendar);
1.1802 +
1.1803 + /**
1.1804 + * Sets the date editor's value.
1.1805 + *
1.1806 + * @param aDate The editor's value. Time components are ignored.
1.1807 + */
1.1808 + IMPORT_C void SetDate(const TTime& aDate);
1.1809 +
1.1810 + /**
1.1811 + * Gets the date editor's value.
1.1812 + *
1.1813 + * @return The editor's date value.
1.1814 + */
1.1815 + IMPORT_C TTime Date() const;
1.1816 +
1.1817 + /**
1.1818 + * Sets date editor to initialised or uninitialised.
1.1819 + *
1.1820 + * @param aUninitialised If @c ETrue then the date editor is set
1.1821 + * to be uninitialised.
1.1822 + */
1.1823 + IMPORT_C void SetUninitialised(TBool aUninitialised);
1.1824 +
1.1825 + /**
1.1826 + * Tests whether the editor is uninitialised.
1.1827 + *
1.1828 + * @return @c ETrue if uninitialised.
1.1829 + */
1.1830 + IMPORT_C TBool IsUninitialised() const;
1.1831 +
1.1832 + // from CEikTTimeEditor
1.1833 + // only values inside the initial minimum and maximum are permitted
1.1834 + /**
1.1835 + * From @c CEikTTimeEditor.
1.1836 + *
1.1837 + * Sets the minimum and maximum allowable dates.
1.1838 + *
1.1839 + * If the current date is outside the new bounds it is changed to be within
1.1840 + * them.
1.1841 + *
1.1842 + * @param aMinimumDate The minimum allowable value.
1.1843 + * @param aMaximumDate The maximum allowable value.
1.1844 + */
1.1845 + IMPORT_C virtual void SetMinimumAndMaximum(const TTime& aMinimumDate,
1.1846 + const TTime& aMaximumDate);
1.1847 +
1.1848 + /**
1.1849 + * From @c CEikTTimeEditor.
1.1850 + *
1.1851 + * Gets the date editor's minimum and maximum values.
1.1852 + *
1.1853 + * @param aMinimumDate On return, the minimum allowable value.
1.1854 + * @param aMaximumDate On return, the maximum allowable value.
1.1855 + */
1.1856 + IMPORT_C virtual void GetMinimumAndMaximum(TTime& aMinimumDate,
1.1857 + TTime& aMaximumDate) const;
1.1858 +
1.1859 + // from CCoeControl
1.1860 + /**
1.1861 + * From @c CCoeControl.
1.1862 + *
1.1863 + * Handles key events.
1.1864 + *
1.1865 + * @param aKeyEvent The key event.
1.1866 + * @param aType The type of key event.
1.1867 + * @return @c EKeyConsumed if the key has beend handled.
1.1868 + */
1.1869 + IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
1.1870 + TEventCode aType);
1.1871 +
1.1872 + /**
1.1873 + * From @c CCoeControl.
1.1874 + *
1.1875 + * Second-phase construction from a resource file.
1.1876 + *
1.1877 + * The function reads the maximum and minimum date values and whether
1.1878 + * or not the editor should support a pop-out calendar and/or date icon
1.1879 + * from a @c DATE_EDITOR resource. It sets the initial date to be the same
1.1880 + * as the maximum date and honours the locale's date format and separators.
1.1881 + *
1.1882 + * @param aResourceReader A resource file reader.
1.1883 + */
1.1884 + IMPORT_C virtual void ConstructFromResourceL(TResourceReader&
1.1885 + aResourceReader);
1.1886 +
1.1887 + /**
1.1888 + * From @c CCoeControl.
1.1889 + *
1.1890 + * Editor validation.
1.1891 + *
1.1892 + * This function should be called before an attempt is made to remove focus
1.1893 + * from a date editor. If the control value is not within the bounds
1.1894 + * specified by the minimum and maximum date values, it is reset to the
1.1895 + * nearest allowable value, the function then leaves.
1.1896 + */
1.1897 + IMPORT_C virtual void PrepareForFocusLossL();
1.1898 +
1.1899 + /**
1.1900 + * From @c CCoeControl.
1.1901 + *
1.1902 + * Handles pointer events.
1.1903 + *
1.1904 + * @param aPointerEvent The pointer event.
1.1905 + */
1.1906 + IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.1907 +
1.1908 +private:
1.1909 +
1.1910 + // from CEikMfne
1.1911 + virtual void CreatePopoutIfRequiredL();
1.1912 + // from CEikTTimeEditor
1.1913 + virtual void SetTTime(const TTime& aDate);
1.1914 + virtual TTime GetTTime() const; // can only be called if PrepareForFocusLossL() succeeded
1.1915 +
1.1916 +private:
1.1917 +
1.1918 + // from MEikCalendarDialogObserver
1.1919 + virtual void GetMinimumAndMaximumAndInitialDatesForCalendarL(TTime& aMinimumDate,
1.1920 + TTime& aMaximumDate,
1.1921 + TTime& aInitialDate) const;
1.1922 + virtual void SetDateFromCalendarAndDrawNow(const TTime& aDate);
1.1923 + // miscellaneous functions
1.1924 + void DoSetMinimumAndMaximum(const TTime& aMinimumDate, const TTime& aMaximumDate);
1.1925 + IMPORT_C virtual void CEikMfne_Reserved();
1.1926 +
1.1927 +private:
1.1928 +
1.1929 + /**
1.1930 + * From CAknControl
1.1931 + */
1.1932 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.1933 +
1.1934 +private:
1.1935 +
1.1936 + CDateEditor* iDateEditor;
1.1937 + TTime iMinimumDate;
1.1938 + TTime iMaximumDate;
1.1939 + TInt iSpare;
1.1940 + };
1.1941 +
1.1942 +
1.1943 +//
1.1944 +
1.1945 +/**
1.1946 + * Time and date editor.
1.1947 + *
1.1948 + * This control allows both a time and date to be displayed and edited.
1.1949 + * It contains the following time fields: hours, minutes and seconds,
1.1950 + * two time separator characters and am/pm text, and the following date
1.1951 + * fields: year, month and day, with two date separator characters. The
1.1952 + * seconds and hours fields are optional and the order of the date fields and
1.1953 + * the separator characters are locale-dependent. The upper and lower
1.1954 + * field bounds are set, and dates and times outside these bounds are
1.1955 + * invalid.
1.1956 + *
1.1957 + * Date field values may be edited directly or via a pop-out calendar
1.1958 + * dialog.
1.1959 + *
1.1960 + * The editor has an associated resource struct TIME_AND_DATE_EDITOR
1.1961 + * and control factory identifier EEikCtTimeAndDateEditor.
1.1962 + */
1.1963 +class CEikTimeAndDateEditor : public CEikTTimeEditor, private MEikCalendarObserver
1.1964 + {
1.1965 +public:
1.1966 + // miscellaneous functions
1.1967 +
1.1968 + /**
1.1969 + * Default constructor.
1.1970 + *
1.1971 + * This function should be used as the first stage in two stage
1.1972 + * construction, followed by a call to either ConstructFromResourceL() to
1.1973 + * initialise the editor's field values from a resource file, or ConstructL()
1.1974 + * (if no resource file is used).
1.1975 + */
1.1976 + IMPORT_C CEikTimeAndDateEditor();
1.1977 +
1.1978 + /**
1.1979 + * Destructor.
1.1980 + *
1.1981 + * This frees the resources owned by the time and date editor, prior to
1.1982 + * its destruction.
1.1983 + */
1.1984 + IMPORT_C virtual ~CEikTimeAndDateEditor();
1.1985 +
1.1986 + // 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
1.1987 +
1.1988 + /**
1.1989 + * Second phase construction.
1.1990 + *
1.1991 + * This function completes construction of a newly-allocated date and
1.1992 + * time editor, by setting the minimum, maximum and initial date and time
1.1993 + * values. It should be called by the container only if the control is
1.1994 + * not constructed from a resource file.
1.1995 + *
1.1996 + * The aFlags parameter is used to set whether the seconds or hours
1.1997 + * fields are not required. The minutes field is always present. It may also
1.1998 + * be used to specify whether or not to force 24 hour time format,
1.1999 + * overriding the locale's setting, and whether the editor should have a
1.2000 + * pop-out calendar dialog.
1.2001 + *
1.2002 + * The locale-dependant date and time settings specified in class
1.2003 + * TLocale are honoured.
1.2004 + *
1.2005 + * If the initial date/time is outside the bounds specified by the
1.2006 + * minimum and maximum, it is set to the nearest valid setting.
1.2007 + *
1.2008 + * A panic will occur if the minimum date/time is later than the
1.2009 + * maximum date/time.
1.2010 + *
1.2011 + * @param aMinimumTimeAndDate The minimum date and time value.
1.2012 + * @param aMaximumTimeAndDate The maximum date and time value.
1.2013 + * @param aInitialTimeAndDate The initial date and time value.
1.2014 + * @param aFlags A bitmask of flags. See eikon.hrh file, EEikTime,
1.2015 + * EEikDate etc.
1.2016 + * @param aInterveningText Descriptor containing the text to use to
1.2017 + * separate the time and date portions of the editor.
1.2018 + */
1.2019 + IMPORT_C void ConstructL(const TTime& aMinimumTimeAndDate, const TTime& aMaximumTimeAndDate, const TTime& aInitialTimeAndDate, TUint32 aFlags, HBufC* aInterveningText=NULL);
1.2020 +
1.2021 + /**
1.2022 + * Sets the values of the time and date editor's fields.
1.2023 + *
1.2024 + * @param aTimeAndDate The new value for the date and time editor's
1.2025 + * fields.
1.2026 + */
1.2027 + IMPORT_C void SetTimeAndDate(const TTime& aTimeAndDate);
1.2028 +
1.2029 + /**
1.2030 + * Gets the time and date editor's value.
1.2031 + *
1.2032 + * @return The editor's value.
1.2033 + */
1.2034 + IMPORT_C TTime TimeAndDate() const;
1.2035 +
1.2036 + /**
1.2037 + * Sets the uninitialized status of the editor.
1.2038 + *
1.2039 + * @param aUninitialised If ETrue, sets the editor as uninitialized,
1.2040 + * i.e. it doesn't display anything.
1.2041 + */
1.2042 + IMPORT_C void SetUninitialised(TBool aUninitialised);
1.2043 +
1.2044 + /**
1.2045 + * Gets the uninitialized status of the editor.
1.2046 + *
1.2047 + * @return ETrue, if the editor is set as uninitialized.
1.2048 + */
1.2049 + IMPORT_C TBool IsUninitialised() const;
1.2050 +
1.2051 + // from CEikTTimeEditor
1.2052 +
1.2053 + /**
1.2054 + * Sets the range of allowable values.
1.2055 + *
1.2056 + * These define the maximum and minimum time/date values that may be
1.2057 + * entered by the user.
1.2058 + *
1.2059 + * If the existing date/time value is outside the new bounds, it is
1.2060 + * reset to the nearest allowable value.
1.2061 + *
1.2062 + * @param aMinimumTimeAndDate The minimum allowable value.
1.2063 + * @param aMaximumTimeAndDate The maximum allowable value.
1.2064 + */
1.2065 + IMPORT_C virtual void SetMinimumAndMaximum(const TTime& aMinimumTimeAndDate, const TTime& aMaximumTimeAndDate); // only values inside the initial minimum and maximum are permitted
1.2066 +
1.2067 + /**
1.2068 + * Gets the range of allowable values that may be entered by the user.
1.2069 + *
1.2070 + * @param aMinimumTimeAndDate On return, contains the time and date
1.2071 + * editor's minimum allowable value.
1.2072 + * @param aMaximumTimeAndDate On return, contains the time and date
1.2073 + * editor's maximum allowable value.
1.2074 + */
1.2075 + IMPORT_C virtual void GetMinimumAndMaximum(TTime& aMinimumTimeAndDate, TTime& aMaximumTimeAndDate) const;
1.2076 +
1.2077 + // from CCoeControl
1.2078 +
1.2079 + /**
1.2080 + * Handles key events.
1.2081 + *
1.2082 + * For example, the Tab key validates and launches a calendar popout.
1.2083 + *
1.2084 + * Calls CEikMfne::OfferKeyEventL() if the control does not consume the
1.2085 + * key.
1.2086 + *
1.2087 + * @param aKeyEvent The key event.
1.2088 + * @param aType The type of key event.
1.2089 + * @return Returns EKeyWasConsumed if the control consumes the key.
1.2090 + */
1.2091 + IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
1.2092 +
1.2093 + /**
1.2094 + * Second phase construction from a resource.
1.2095 + *
1.2096 + * This function completes the construction of a newly-allocated
1.2097 + * date/time editor from a TIME_AND_DATE_EDITOR resource. The minimum and
1.2098 + * maximum date/times, the date and time flag settings, and the intervening
1.2099 + * text are read from the resource, and ConstructL() is called with these
1.2100 + * settings. The initial date/time is set to the maximum date/time value.
1.2101 + *
1.2102 + * @param aResourceReader A resource file reader.
1.2103 + */
1.2104 + IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aResourceReader);
1.2105 +
1.2106 + /**
1.2107 + * Prepares the editor for focus loss.
1.2108 + *
1.2109 + * This function should be called to validate the editor's contents
1.2110 + * when an attempt is made to remove focus from the control. If the control
1.2111 + * value is not within the bounds specified by the minimum and maximum
1.2112 + * date/time values, it is reset to the nearest allowable value, the
1.2113 + * function will leave and display an appropriate message.
1.2114 + */
1.2115 + IMPORT_C virtual void PrepareForFocusLossL();
1.2116 +
1.2117 + /**
1.2118 + * From @c CCoeControl.
1.2119 + *
1.2120 + * Handles pointer events.
1.2121 + *
1.2122 + * @param aPointerEvent The pointer event.
1.2123 + */
1.2124 + IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.2125 +
1.2126 +private:
1.2127 + // from CEikMfne
1.2128 + virtual void CreatePopoutIfRequiredL();
1.2129 + IMPORT_C virtual void CEikMfne_Reserved();
1.2130 + // from CEikTTimeEditor
1.2131 + virtual void SetTTime(const TTime& aTimeAndDate);
1.2132 + virtual TTime GetTTime() const; // can only be called if PrepareForFocusLossL() succeeded
1.2133 +private:
1.2134 + // from MEikCalendarDialogObserver
1.2135 + virtual void GetMinimumAndMaximumAndInitialDatesForCalendarL(TTime& aMinimumDate, TTime& aMaximumDate, TTime& aInitialDate) const;
1.2136 + virtual void SetDateFromCalendarAndDrawNow(const TTime& aDate);
1.2137 + // miscellaneous functions
1.2138 + void DoSetMinimumAndMaximum(const TTime& aMinimumTimeAndDate, const TTime& aMaximumTimeAndDate);
1.2139 +private:
1.2140 + /**
1.2141 + * From CAknControl
1.2142 + */
1.2143 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.2144 +private:
1.2145 + CTimeEditor* iTimeEditor;
1.2146 + CDateEditor* iDateEditor;
1.2147 + TTime iMinimumTimeAndDate;
1.2148 + TTime iMaximumTimeAndDate;
1.2149 + TInt iSpare;
1.2150 + };
1.2151 +
1.2152 +
1.2153 +//
1.2154 +
1.2155 +/**
1.2156 + * Duration editor.
1.2157 + *
1.2158 + * The duration editor allows a time duration to be displayed and
1.2159 + * edited. The editor has a clock icon and an edit field with separators for
1.2160 + * hours, minutes, and seconds. These fields can all be suppressed using
1.2161 + * the appropriate flags in the resource declaration.
1.2162 + *
1.2163 + * Unlike the time editor control, the duration editor has no am or pm
1.2164 + * text. This is because the duration is a length of time (from 0 to 24
1.2165 + * hours), rather than a point in time.
1.2166 + *
1.2167 + * The minimum and maximum values are set, and values outside these
1.2168 + * limits are invalid.
1.2169 + *
1.2170 + * The editor has an associated resource struct DURATION_EDITOR and
1.2171 + * control factory identifier EEikCtDurationEditor.
1.2172 + */
1.2173 +class CEikDurationEditor : public CEikMfne
1.2174 + {
1.2175 +public:
1.2176 + // miscellaneous functions
1.2177 +
1.2178 + /**
1.2179 + * Default constructor.
1.2180 + *
1.2181 + * This function should be used as the first stage in two stage
1.2182 + * construction, followed by a call to either ConstructFromResourceL() to
1.2183 + * initialise the editor's field values from a resource file, or ConstructL()
1.2184 + * if no resource file is used.
1.2185 + */
1.2186 + IMPORT_C CEikDurationEditor();
1.2187 +
1.2188 + /**
1.2189 + * Destructor.
1.2190 + *
1.2191 + * The destructor frees the resources owned by the duration editor,
1.2192 + * prior to its destruction.
1.2193 + */
1.2194 + IMPORT_C virtual ~CEikDurationEditor();
1.2195 +
1.2196 + /**
1.2197 + * Second phase construction.
1.2198 + *
1.2199 + * This function completes the construction of a newly-allocated
1.2200 + * duration editor. This function should be used instead of
1.2201 + * ConstructFromResourceL() when not initialising from a resource file.
1.2202 + *
1.2203 + * The function sets the editor's minimum, maximum and initial values.
1.2204 + * The time separator characters specified in class TLocale are honoured.
1.2205 + * If the initial duration is less than the minimum value the minimum
1.2206 + * value is used as the initial setting. If the initial duration is greater
1.2207 + * than the maximum value the maximum value is used as the initial
1.2208 + * setting.
1.2209 + *
1.2210 + * The aFlags parameter is used to determine whether the seconds or
1.2211 + * hours fields are not required. The minutes field is always present.
1.2212 + * Regardless of the value specified in aFlags, 24 hour time format is set,
1.2213 + * overriding the locale's setting.
1.2214 + *
1.2215 + * @param aMinimumDuration The minimum interval in seconds.
1.2216 + * @param aMaximumDuration The maximum interval in seconds.
1.2217 + * @param aInitialDuration The initial interval in seconds.
1.2218 + * @param aFlags Duration editor flags.
1.2219 + */
1.2220 + IMPORT_C void ConstructL(const TTimeIntervalSeconds& aMinimumDuration, const TTimeIntervalSeconds& aMaximumDuration, const TTimeIntervalSeconds& aInitialDuration, TUint32 aFlags);
1.2221 +
1.2222 + /**
1.2223 + * Sets the minimum and maximum duration values.
1.2224 + *
1.2225 + * The user can only enter values between these bounds.
1.2226 + *
1.2227 + * @param aMinimumDuration The minimum duration.
1.2228 + * @param aMaximumDuration The maximum duration.
1.2229 + * @panic 48 If the minimum duration exceeds the maximum.
1.2230 + */
1.2231 + IMPORT_C void SetMinimumAndMaximum(const TTimeIntervalSeconds& aMinimumDuration, const TTimeIntervalSeconds& aMaximumDuration); // only values inside the initial minimum and maximum are permitted
1.2232 +
1.2233 + /**
1.2234 + * Gets the duration editor's minimum and maximum values.
1.2235 + *
1.2236 + * @param aMinimumDuration On return, the minimum value.
1.2237 + * @param aMaximumDuration On return, the maximum value.
1.2238 + */
1.2239 + IMPORT_C void GetMinimumAndMaximum(TTimeIntervalSeconds& aMinimumDuration, TTimeIntervalSeconds& aMaximumDuration) const;
1.2240 +
1.2241 + /**
1.2242 + * Sets the duration editor's value.
1.2243 + *
1.2244 + * @param aDuration The new value to convert into hours, minutes and
1.2245 + * seconds and to which the duration editor's fields will be set.
1.2246 + */
1.2247 + IMPORT_C void SetDuration(const TTimeIntervalSeconds& aDuration);
1.2248 +
1.2249 + /**
1.2250 + * Gets the duration editor's value and returns it as a period of
1.2251 + * seconds.
1.2252 + *
1.2253 + * @return The editor's value in seconds.
1.2254 + */
1.2255 + IMPORT_C TTimeIntervalSeconds Duration() const; // can only be called if PrepareForFocusLossL() succeeded
1.2256 +
1.2257 + // framework
1.2258 +
1.2259 + /**
1.2260 + * Second-phase construction from a resource.
1.2261 + *
1.2262 + * The function reads the maximum and minimum duration values, and the
1.2263 + * flags settings, from a DURATION_EDITOR resource. It sets the initial
1.2264 + * duration to be the same as the maximum value and honours the locale's
1.2265 + * time separators.
1.2266 + *
1.2267 + * @param aResourceReader A resource file reader.
1.2268 + */
1.2269 + IMPORT_C void ConstructFromResourceL(TResourceReader& aResourceReader);
1.2270 +
1.2271 + /**
1.2272 + * Editor validation.
1.2273 + *
1.2274 + * This function should be called when an attempt is made to remove
1.2275 + * focus from a duration editor. If the editor value is not within the
1.2276 + * bounds specified by the minimum and maximum duration values, it is reset to
1.2277 + * the nearest allowable value - the function will leave.
1.2278 + */
1.2279 + IMPORT_C void PrepareForFocusLossL();
1.2280 +
1.2281 + // From CCoeControl
1.2282 + /**
1.2283 + * From @c CCoeControl.
1.2284 + *
1.2285 + * Handles pointer events.
1.2286 + *
1.2287 + * @param aPointerEvent The pointer event.
1.2288 + */
1.2289 + IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.2290 +private:
1.2291 + // miscellaneous functions
1.2292 + void DoSetMinimumAndMaximum(const TTimeIntervalSeconds& aMinimumDuration, const TTimeIntervalSeconds& aMaximumDuration);
1.2293 + IMPORT_C virtual void CEikMfne_Reserved();
1.2294 +private:
1.2295 + /**
1.2296 + * From CAknControl
1.2297 + */
1.2298 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.2299 +private:
1.2300 + CTimeEditor* iTimeEditor;
1.2301 + TTimeIntervalSeconds iMinimumDuration;
1.2302 + TTimeIntervalSeconds iMaximumDuration;
1.2303 + TInt iSpare;
1.2304 + };
1.2305 +
1.2306 +/**
1.2307 + * Time offset editor.
1.2308 + *
1.2309 + * This control allows a signed time offset to be displayed and edited.
1.2310 + * It has the same fields as the time editor control CEikTimeEditor,
1.2311 + * except there is no AM or PM text because the value is a time offset,
1.2312 + * positive or negative, from 0 to 24 hours rather than a point in time.
1.2313 + *
1.2314 + * The editor has an associated resource struct TIME_OFFSET_EDITOR and
1.2315 + * control factory identifier EEikCtTimeOffsetEditor.
1.2316 + */
1.2317 +class CEikTimeOffsetEditor : public CEikMfne
1.2318 + {
1.2319 +public:
1.2320 + // miscellaneous functions
1.2321 +
1.2322 + /**
1.2323 + * Default constructor.
1.2324 + *
1.2325 + * This function should be used as the first stage in two stage
1.2326 + * construction, followed by a call to either ConstructFromResourceL() to
1.2327 + * initialise the editor's field values from a resource file, or ConstructL()
1.2328 + * if no resource file is used.
1.2329 + */
1.2330 + IMPORT_C CEikTimeOffsetEditor();
1.2331 +
1.2332 + /**
1.2333 + * Destructor. This frees the resources owned by the time offset editor,
1.2334 + * prior to its destruction.
1.2335 + */
1.2336 + IMPORT_C virtual ~CEikTimeOffsetEditor();
1.2337 +
1.2338 + /**
1.2339 + * Second phase constructor.
1.2340 + *
1.2341 + * This function completes the construction of a time offset editor, by
1.2342 + * setting its minimum, maximum and initial values. The time separator
1.2343 + * characters specified in the system's locale are honoured. It should be
1.2344 + * called by the container only if the control is not constructed from a
1.2345 + * resource file.
1.2346 + *
1.2347 + * The aFlags parameter is used to determine whether the seconds or
1.2348 + * hours fields are displayed by the editor. The minutes field is always
1.2349 + * displayed. This function forces 24 hour time format for the time offset
1.2350 + * editor, overriding the locale's setting.
1.2351 + *
1.2352 + * If the initial time offset is outside the bounds specified, it is
1.2353 + * invalid and will be reset to the upper or lower bound.
1.2354 + *
1.2355 + * The minimum value for a time offset editor is -23:59:59, and the
1.2356 + * maximum value is 23:59:59.
1.2357 + *
1.2358 + * @param aMinimumTimeOffset The minimum allowable value, in seconds.
1.2359 + * @param aMaximumTimeOffset The maximum allowable value, in seconds.
1.2360 + * @param aInitialTimeOffset The initial value, in seconds.
1.2361 + * @param aFlags Determines which fields are required. Specify
1.2362 + * CTimeEditor::EWithoutSecondsField for no seconds field,
1.2363 + * CTimeEditor::EWithoutHoursField for no hours field. 24 hour clock format is set, regardless
1.2364 + * of the flag setting specified in this parameter.
1.2365 + */
1.2366 + IMPORT_C void ConstructL(const TTimeIntervalSeconds& aMinimumTimeOffset, const TTimeIntervalSeconds& aMaximumTimeOffset, const TTimeIntervalSeconds& aInitialTimeOffset, TUint32 aFlags);
1.2367 +
1.2368 + /**
1.2369 + * Sets the range of allowable offset values.
1.2370 + *
1.2371 + * These define the maximum and minimum values that may be entered by
1.2372 + * the user.
1.2373 + *
1.2374 + * If the existing offset value is outside the bounds set by this
1.2375 + * function, it is reset to the nearest boundary value.
1.2376 + *
1.2377 + * @param aMinimumTimeOffset The minimum allowable value.
1.2378 + * @param aMaximumTimeOffset The maximum allowable value.
1.2379 + * @panic 49 If the minimum exceeds the maximum.
1.2380 + */
1.2381 + IMPORT_C void SetMinimumAndMaximum(const TTimeIntervalSeconds& aMinimumTimeOffset, const TTimeIntervalSeconds& aMaximumTimeOffset); // only values inside the initial minimum and maximum are permitted
1.2382 +
1.2383 + /**
1.2384 + * Gets the range of allowable values that may be entered by the user.
1.2385 + *
1.2386 + * @param aMinimumTimeOffset On return, contains the time offset
1.2387 + * editor’s minimum allowable value.
1.2388 + * @param aMaximumTimeOffset On return, contains the time offset
1.2389 + * editor’s maximum allowable value.
1.2390 + */
1.2391 + IMPORT_C void GetMinimumAndMaximum(TTimeIntervalSeconds& aMinimumTimeOffset, TTimeIntervalSeconds& aMaximumTimeOffset) const;
1.2392 +
1.2393 + /**
1.2394 + * Sets the time offset editor's value.
1.2395 + *
1.2396 + * The sign is set according to whether the value specified is positive
1.2397 + * or negative.
1.2398 + *
1.2399 + * @param aTimeOffset The new offset value to which to assign to the
1.2400 + * editor.
1.2401 + */
1.2402 + IMPORT_C void SetTimeOffset(const TTimeIntervalSeconds& aTimeOffset);
1.2403 +
1.2404 + /**
1.2405 + * Gets the time offset editor's value converted into seconds.
1.2406 + *
1.2407 + * @return The editor's value in seconds.
1.2408 + */
1.2409 + IMPORT_C TTimeIntervalSeconds TimeOffset() const; // can only be called if PrepareForFocusLossL() succeeded
1.2410 +
1.2411 + // framework
1.2412 +
1.2413 + /**
1.2414 + * Second phase construction from a resource.
1.2415 + *
1.2416 + * This function completes the construction of a time offset editor
1.2417 + * from a TIME_OFFSET_EDITOR resource.
1.2418 + *
1.2419 + * The minimum and maximum time offsets, and the flags settings are
1.2420 + * read from the resource, and ConstructL() is called with these settings.
1.2421 + * The initial time offset is set to the maximum time offset value.
1.2422 + *
1.2423 + * @param aResourceReader A resource file reader.
1.2424 + */
1.2425 + IMPORT_C void ConstructFromResourceL(TResourceReader& aResourceReader);
1.2426 +
1.2427 + /**
1.2428 + * Prepares editor for focus loss.
1.2429 + *
1.2430 + * This function should be called to validate the editor’s contents
1.2431 + * when an attempt is made to remove focus from the control.
1.2432 + *
1.2433 + * If the control value is not within the bounds specified by the
1.2434 + * minimum and maximum time offset values, it is reset to the nearest
1.2435 + * allowable value. The function then leaves.
1.2436 + */
1.2437 + IMPORT_C void PrepareForFocusLossL();
1.2438 +
1.2439 + // From CCoeControl
1.2440 +
1.2441 + /**
1.2442 + * From @c CCoeControl.
1.2443 + *
1.2444 + * Handles pointer events.
1.2445 + *
1.2446 + * @param aPointerEvent The pointer event.
1.2447 + */
1.2448 + IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.2449 +
1.2450 +private:
1.2451 + // miscellaneous functions
1.2452 + void DoSetMinimumAndMaximum(const TTimeIntervalSeconds& aMinimumTimeOffset, const TTimeIntervalSeconds& aMaximumTimeOffset);
1.2453 + IMPORT_C virtual void CEikMfne_Reserved();
1.2454 +private:
1.2455 + /**
1.2456 + * From CAknControl
1.2457 + */
1.2458 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.2459 +private:
1.2460 + CTimeEditor* iTimeEditor;
1.2461 + TTimeIntervalSeconds iMinimumTimeOffset;
1.2462 + TTimeIntervalSeconds iMaximumTimeOffset;
1.2463 + // none of these pointers owns anything
1.2464 + CEikMfneSymbol* iSign;
1.2465 + TInt iSpare;
1.2466 + };
1.2467 +
1.2468 +
1.2469 +//
1.2470 +// Longitude and Latitude editors removed 2.4.2002:
1.2471 +
1.2472 +enum
1.2473 + {
1.2474 + EEikOrientationNorthSouth =0x1000,
1.2475 + EEikOrientationWestEast =0x2000,
1.2476 + EEikOrientationMask=EEikOrientationNorthSouth|EEikOrientationWestEast
1.2477 + };
1.2478 +
1.2479 +
1.2480 +enum
1.2481 + {
1.2482 + EEikDirectionNegative,
1.2483 + EEikDirectionPositive,
1.2484 + EEikDirectionMask=EEikDirectionNegative|EEikDirectionPositive
1.2485 + };
1.2486 +
1.2487 +
1.2488 +enum TEikCompass
1.2489 + {
1.2490 + EEikCompassNorth=EEikOrientationNorthSouth|EEikDirectionNegative,
1.2491 + EEikCompassSouth=EEikOrientationNorthSouth|EEikDirectionPositive,
1.2492 + EEikCompassEast=EEikOrientationWestEast|EEikDirectionNegative,
1.2493 + EEikCompassWest=EEikOrientationWestEast|EEikDirectionPositive
1.2494 + };
1.2495 +
1.2496 +
1.2497 +struct SEikDegreesMinutesDirection
1.2498 + {
1.2499 + TInt iDegrees;
1.2500 + TInt iMinutes;
1.2501 + TInt iSeconds;
1.2502 + TEikCompass iDirection;
1.2503 + };
1.2504 +
1.2505 +#endif // __EIKMFNE_H__
1.2506 +// End of file