epoc32/include/mw/aknlocationed.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* 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
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  Location editors 
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
#ifndef AKNLOCATIONED_H
williamr@2
    19
#define AKNLOCATIONED_H
williamr@2
    20
williamr@2
    21
#include <eikmfne.h>
williamr@2
    22
williamr@2
    23
class TPosition;
williamr@2
    24
class CLocationStrings;
williamr@2
    25
/**
williamr@2
    26
 * Editor for TPosition type; latitude and longitude editor
williamr@2
    27
 *
williamr@2
    28
 * There exists two ways to construct CAknLocationEditor:
williamr@2
    29
 *
williamr@2
    30
 * @code
williamr@2
    31
 * CAknLocationEditor *editor = CAknLocationEditor::NewL(pos, context);
williamr@2
    32
 * @endcode
williamr@2
    33
 * 
williamr@2
    34
 * Using resources:
williamr@2
    35
 *
williamr@2
    36
 * @code
williamr@2
    37
 * CAknLocationEditor *editor = new (ELeave) CAknLocationEditor
williamr@2
    38
 * TResourceReader reader;
williamr@2
    39
 * iCoeEnv->CreateResourceReaderLC(reader,R_RES_ID_FOR_EDITOR);
williamr@2
    40
 * editor->ConstructFromResourceL(reader);
williamr@2
    41
 * editor->Set(pos);
williamr@2
    42
 * CleanupStack::PopAndDestroy();
williamr@2
    43
 * @endcode
williamr@2
    44
 * 
williamr@2
    45
 * Resource file format is as follows:
williamr@2
    46
 * @code
williamr@2
    47
 *     LATITUDE_EDITOR
williamr@2
    48
 *        {
williamr@2
    49
 *	      flags = ELocationEdFlagLatitude;
williamr@2
    50
 *		  latlongresourceid = R_EIK_LATITUDE_AND_LONGITUDE;
williamr@2
    51
 *        };
williamr@2
    52
 * @endcode
williamr@2
    53
 *  or:
williamr@2
    54
 * @code
williamr@2
    55
 *      LONGITUDE_EDITOR
williamr@2
    56
 *        {
williamr@2
    57
 *		  flags = ELocationEdFlagLongitude;
williamr@2
    58
 *		  latlongresourceid = R_EIK_LATITUDE_AND_LONGITUDE;
williamr@2
    59
 *        };
williamr@2
    60
 * @endcode
williamr@2
    61
 *
williamr@2
    62
 *  @lib eikctl.lib
williamr@2
    63
 *  @lib lbs.lib (for TPosition class)
williamr@2
    64
 *  @since 3.2
williamr@2
    65
 *  @see TPosition
williamr@2
    66
 */
williamr@2
    67
class CAknLocationEditor : public CEikMfne
williamr@2
    68
	{
williamr@2
    69
public:
williamr@2
    70
	/**
williamr@2
    71
	 * TLocationContext determines what part of TPosition class is used for this editor.
williamr@2
    72
     *  ELongitudeOnly means only longitude part of TPosition is used.
williamr@2
    73
     *  ELatitudeOnly means only latitude part of TPosition is used.
williamr@2
    74
	 */
williamr@2
    75
	enum TLocationContext
williamr@2
    76
		{
williamr@2
    77
		ELongitudeOnly = 0x1,
williamr@2
    78
		ELatitudeOnly  = 0x2
williamr@2
    79
		};
williamr@2
    80
    /**
williamr@2
    81
     * Constructor
williamr@2
    82
     */
williamr@2
    83
	IMPORT_C CAknLocationEditor();
williamr@2
    84
    /**
williamr@2
    85
     * Destructor
williamr@2
    86
     */
williamr@2
    87
	IMPORT_C ~CAknLocationEditor();
williamr@2
    88
    /**
williamr@2
    89
     * NewL()
williamr@2
    90
     *    Creates location editor and initializes it's value to value determined by the aValue parameter.
williamr@2
    91
	 *
williamr@2
    92
     * @param aValue Initial value for location editor.
williamr@2
    93
     * @param aContext Which part of the TPosition is used for this location editor
williamr@2
    94
     */
williamr@2
    95
	IMPORT_C static CAknLocationEditor* NewL( TPosition &aValue, TLocationContext aContext );
williamr@2
    96
williamr@2
    97
	/**
williamr@2
    98
	 * ConstructFromResourceL
williamr@2
    99
     *     Constructs location editor using information from resource files
williamr@2
   100
     *
williamr@2
   101
     * @param aResourceReader resource reader
williamr@2
   102
	 */
williamr@2
   103
	IMPORT_C void ConstructFromResourceL( TResourceReader& aResourceReader );
williamr@2
   104
williamr@2
   105
	/**
williamr@2
   106
	 * DisplayableLocationL()
williamr@2
   107
	 *    Converts TPosition into displayable descriptor usable for listboxes
williamr@2
   108
     *
williamr@2
   109
	 * @param aValue value of the location
williamr@2
   110
	 * @param aContext which part of the TPosition is used
williamr@2
   111
	 */
williamr@2
   112
	IMPORT_C static HBufC* DisplayableLocationL( const TPosition &aValue, TLocationContext aContext );
williamr@2
   113
williamr@2
   114
williamr@2
   115
    /**
williamr@2
   116
     * PrepareForFocusLossL()
williamr@2
   117
     *     detects focus changes to validate editor contents
williamr@2
   118
     */
williamr@2
   119
	IMPORT_C virtual void PrepareForFocusLossL();
williamr@2
   120
williamr@2
   121
	/**
williamr@2
   122
     * Set()
williamr@2
   123
     *     Sets either longitude or latitude values of aValue
williamr@2
   124
     *
williamr@2
   125
	 *  @param aValue new value for the editor
williamr@2
   126
     */
williamr@2
   127
	IMPORT_C void Set(const TPosition &aValue);
williamr@2
   128
	/**
williamr@2
   129
	 * Get()
williamr@2
   130
     *      Gets either longitude or latitude values of aValue
williamr@2
   131
     *
williamr@2
   132
     * @param aValue TPosition object that will be modified
williamr@2
   133
     */
williamr@2
   134
	IMPORT_C void Get( TPosition &aValue ) const;
williamr@2
   135
	/**
williamr@2
   136
	 * OfferKeyEventL()
williamr@2
   137
	 *         key event handling of location editor
williamr@2
   138
	 */
williamr@2
   139
	IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
williamr@2
   140
private:
williamr@2
   141
	enum TLocationType
williamr@2
   142
		{
williamr@2
   143
		EDD,
williamr@2
   144
		EDMM,
williamr@2
   145
		EDMSD
williamr@2
   146
		};
williamr@2
   147
	TLocationType Type() const;
williamr@2
   148
	static void Split( const TPosition &aValue, 
williamr@2
   149
					   TLocationContext aContext, 
williamr@2
   150
					   TInt &aDegrees, 
williamr@2
   151
					   TInt &aDeciDegrees, 
williamr@2
   152
					   TInt &aMinutes, 
williamr@2
   153
					   TInt &aDeciMinutes, 
williamr@2
   154
					   TInt &aSeconds, 
williamr@2
   155
					   TInt &aDeciSeconds, 
williamr@2
   156
					   TBool &aNeg, 
williamr@2
   157
					   TBool &aNan );
williamr@2
   158
	static void SplitDD( const TPosition &aValue, 
williamr@2
   159
						 TLocationContext aContext, 
williamr@2
   160
						 TInt &aDegrees,
williamr@2
   161
						 TInt &aDeciDegrees, 
williamr@2
   162
						 TBool &aNeg, 
williamr@2
   163
						 TBool &aNan );
williamr@2
   164
	static void SplitDMM( const TPosition &aValue, 
williamr@2
   165
	                      TLocationContext aContext, 
williamr@2
   166
	                      TInt &aDegrees, 
williamr@2
   167
	                      TInt &aMinutes, 
williamr@2
   168
	                      TInt &aDeciMinutes, 
williamr@2
   169
	                      TBool &aNeg, 
williamr@2
   170
	                      TBool &aNan );
williamr@2
   171
	static void SplitDMSD( const TPosition &aValue, 
williamr@2
   172
						   TLocationContext aContext, 
williamr@2
   173
						   TInt &aDegrees, 
williamr@2
   174
						   TInt &aMinutes, 
williamr@2
   175
						   TInt &aSeconds, 
williamr@2
   176
						   TInt &aDeciSeconds, 
williamr@2
   177
						   TBool &aNeg, 
williamr@2
   178
						   TBool &aNan );
williamr@2
   179
	static void CombineDD( TPosition &aValue, 
williamr@2
   180
						   TLocationContext aContext, 
williamr@2
   181
						   TInt aDegrees, 
williamr@2
   182
						   TInt aDeciDegrees, 
williamr@2
   183
						   TBool aNeg, 
williamr@2
   184
						   TBool aNan );
williamr@2
   185
	static void CombineDMM( TPosition &aValue, 
williamr@2
   186
							TLocationContext aContext, 
williamr@2
   187
							TInt aDegrees, 
williamr@2
   188
							TInt aMinutes, 
williamr@2
   189
							TInt aDeciMinutes, 
williamr@2
   190
							TBool aNeg, 
williamr@2
   191
							TBool aNan );
williamr@2
   192
	static void CombineDMSD( TPosition &aValue, 
williamr@2
   193
							 TLocationContext aContext, 
williamr@2
   194
							 TInt aDegrees, 
williamr@2
   195
							 TInt aMinutes, 
williamr@2
   196
							 TInt aSeconds, 
williamr@2
   197
							 TInt aDeciSeconds, 
williamr@2
   198
							 TBool aNeg, 
williamr@2
   199
							 TBool aNan );
williamr@2
   200
private:
williamr@2
   201
	void SetUninitialised(TBool aInitialised);
williamr@2
   202
	void RefreshFromLocale();
williamr@2
   203
	void ConstructL( TPosition &aValue, TLocationContext aContext );
williamr@2
   204
public:
williamr@2
   205
	void HandleCenRepChangedL(TUint32 aKey, TInt aValue);
williamr@2
   206
	void CreateMfneFieldsL(const TPosition &aValue);
williamr@2
   207
private:
williamr@2
   208
	void LoadStringsL( TInt aResourceId );
williamr@2
   209
	
williamr@2
   210
	/**
williamr@2
   211
	* Maps logical MFNE field order to correct visual order.
williamr@2
   212
	* @param aFieldNumber Field position in logical format.
williamr@2
   213
	* @param aType Used location editor format.
williamr@2
   214
	* @return Field position in visual format.
williamr@2
   215
	*/
williamr@2
   216
	TInt FieldMapping(const TInt aFieldNumber, const TLocationType aType) const;
williamr@2
   217
williamr@2
   218
protected:
williamr@2
   219
	IMPORT_C virtual void* CAknLocationEditor_ExtensionInterface( TUid aInterface ); 
williamr@2
   220
private:
williamr@2
   221
	CLocationStrings* iStrings;
williamr@2
   222
	TLocationContext iContext;
williamr@2
   223
	};
williamr@2
   224
williamr@2
   225
williamr@2
   226
#endif