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