2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Location editors
18 #ifndef AKNLOCATIONED_H
19 #define AKNLOCATIONED_H
24 class CLocationStrings;
26 * Editor for TPosition type; latitude and longitude editor
28 * There exists two ways to construct CAknLocationEditor:
31 * CAknLocationEditor *editor = CAknLocationEditor::NewL(pos, context);
37 * CAknLocationEditor *editor = new (ELeave) CAknLocationEditor
38 * TResourceReader reader;
39 * iCoeEnv->CreateResourceReaderLC(reader,R_RES_ID_FOR_EDITOR);
40 * editor->ConstructFromResourceL(reader);
42 * CleanupStack::PopAndDestroy();
45 * Resource file format is as follows:
49 * flags = ELocationEdFlagLatitude;
50 * latlongresourceid = R_EIK_LATITUDE_AND_LONGITUDE;
57 * flags = ELocationEdFlagLongitude;
58 * latlongresourceid = R_EIK_LATITUDE_AND_LONGITUDE;
63 * @lib lbs.lib (for TPosition class)
67 class CAknLocationEditor : public CEikMfne
71 * TLocationContext determines what part of TPosition class is used for this editor.
72 * ELongitudeOnly means only longitude part of TPosition is used.
73 * ELatitudeOnly means only latitude part of TPosition is used.
83 IMPORT_C CAknLocationEditor();
87 IMPORT_C ~CAknLocationEditor();
90 * Creates location editor and initializes it's value to value determined by the aValue parameter.
92 * @param aValue Initial value for location editor.
93 * @param aContext Which part of the TPosition is used for this location editor
95 IMPORT_C static CAknLocationEditor* NewL( TPosition &aValue, TLocationContext aContext );
98 * ConstructFromResourceL
99 * Constructs location editor using information from resource files
101 * @param aResourceReader resource reader
103 IMPORT_C void ConstructFromResourceL( TResourceReader& aResourceReader );
106 * DisplayableLocationL()
107 * Converts TPosition into displayable descriptor usable for listboxes
109 * @param aValue value of the location
110 * @param aContext which part of the TPosition is used
112 IMPORT_C static HBufC* DisplayableLocationL( const TPosition &aValue, TLocationContext aContext );
116 * PrepareForFocusLossL()
117 * detects focus changes to validate editor contents
119 IMPORT_C virtual void PrepareForFocusLossL();
123 * Sets either longitude or latitude values of aValue
125 * @param aValue new value for the editor
127 IMPORT_C void Set(const TPosition &aValue);
130 * Gets either longitude or latitude values of aValue
132 * @param aValue TPosition object that will be modified
134 IMPORT_C void Get( TPosition &aValue ) const;
137 * key event handling of location editor
139 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
147 TLocationType Type() const;
148 static void Split( const TPosition &aValue,
149 TLocationContext aContext,
158 static void SplitDD( const TPosition &aValue,
159 TLocationContext aContext,
164 static void SplitDMM( const TPosition &aValue,
165 TLocationContext aContext,
171 static void SplitDMSD( const TPosition &aValue,
172 TLocationContext aContext,
179 static void CombineDD( TPosition &aValue,
180 TLocationContext aContext,
185 static void CombineDMM( TPosition &aValue,
186 TLocationContext aContext,
192 static void CombineDMSD( TPosition &aValue,
193 TLocationContext aContext,
201 void SetUninitialised(TBool aInitialised);
202 void RefreshFromLocale();
203 void ConstructL( TPosition &aValue, TLocationContext aContext );
205 void HandleCenRepChangedL(TUint32 aKey, TInt aValue);
206 void CreateMfneFieldsL(const TPosition &aValue);
208 void LoadStringsL( TInt aResourceId );
211 * Maps logical MFNE field order to correct visual order.
212 * @param aFieldNumber Field position in logical format.
213 * @param aType Used location editor format.
214 * @return Field position in visual format.
216 TInt FieldMapping(const TInt aFieldNumber, const TLocationType aType) const;
219 IMPORT_C virtual void* CAknLocationEditor_ExtensionInterface( TUid aInterface );
221 CLocationStrings* iStrings;
222 TLocationContext iContext;