CEikMfne Class Reference

API published in: S60 1st Ed

Link against: avkon.lib eikctl.lib eikcoctl.lib uiklaf.lib form.lib

Capability Information

Required Capabilities

None


#include <eikmfne.h>

Inherits CEikBorderedControl, and MAknMfneCommandObserver.

Inherited by CAknIpFieldEditor, CAknLocationEditor, CAknUnitEditor, CEikDurationEditor, CEikNumberEditor, CEikRangeEditor, CEikTimeOffsetEditor, and CEikTTimeEditor.


Detailed Description

Multi-field numeric editor abstract base class.

This is a set of fields, where a field can be a number, a symbol or a separator. Field classes are derived from CEikMfneField.

Concrete multi-field numeric editors are derived from this class and should provide the following:

* A virtual destructor if the class introduces new data members which are allocated on the heap.

* A ConstructL() function; this is used to initialise a multi-field numeric editor.

* A ConstructFromResourceL() function; this is used to initialise a multi-field numeric editor from a resource.

* A data member to store the editor's value.

* Functions to set and get the editor's value.

* Functions to set the minimum and maximum allowable values.


Public Types

enum   TFeatureId { EClipGcToRect }
  Settable features for MFNE. More...

Public Member Functions

IMPORT_C  CEikMfne ()
  Default constructor.
virtual IMPORT_C  ~CEikMfne ()
  Destructor.
IMPORT_C void  CreateFieldArrayL (TInt aNumFields)
  Allocates a field array containing aNumFields elements.
IMPORT_C void  AddField (CEikMfneField *aField)
  Adds a field.
IMPORT_C void  ResetFieldArray ()
  Deletes the editor's field and the field array.
IMPORT_C TMargins  BorderMargins () const
  Gets the control's border margins.
IMPORT_C void  DrawNowAndLeaveWithTimeDateFormatInfoMsgL (TInt aResourceId, const TTime &aTimeDate) const
  Draws immediately, and then leaves with an info message containing a formatted time/date string.
IMPORT_C CEikMfneField Field (TInt aField) const
  Gets the CEikMfneField at the specified index.
TInt  CurrentField () const
  Gets the index into the field array of the current field.
TInt  NumFields () const
  Gets the number of fields.
IMPORT_C void  SetMfneAlignment (TInt aAlignment)
  Sets the alignment of the editor.
IMPORT_C void  SetUpAndDownKeysConsumed (TBool aConsume)
  Sets whether the editor consumes up and down key events.
IMPORT_C void  SetSuppressBackgroundDrawing (TBool aSuppress)
  Used for suppressing all editor's background drawing.
IMPORT_C TInt  SetFeature (TInt aFeatureId, TInt aFeatureParam)
  Used for setting various flag-like features to the editor.
IMPORT_C TInt  GetFeature (TInt aFeatureId, TInt &aFeatureParam) const
  Used to getting feature statuses.
IMPORT_C TBool  SupportsFeature (TInt aFeatureId) const
  Used for checking if the editor supports a feature.
void  HighlightField (TInt aFieldPosition)
IMPORT_C const CFont *  Font () const
  Gets a pointer to the CFont object that is used to draw the fields in this editor.
IMPORT_C void  SetFont (const CFont *aFont)
  Sets the font that is used to draw the fields in this editor.
IMPORT_C void  SetSkinBackgroundControlContextL (MAknsControlContext *aControlContext)
  Sets within in the editor an externally owned Skins background control context.
IMPORT_C void  HandleMfneCommandL (TInt aCommand)
  From MAknMfneCommandObserver.
IMPORT_C void  SetUseOverrideColors (TBool aUseOverrideColors)
  Sets the MFNE to use the CCoeControl::OverrideColorL() defined color in drawing.
virtual IMPORT_C TKeyResponse  OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType)
  Handles key events.
virtual IMPORT_C void  PrepareForFocusLossL ()
  Prepares for focus loss.
virtual IMPORT_C TSize  MinimumSize ()
  Gets the minimum size of the control.
virtual IMPORT_C void  GetColorUseListL (CArrayFix< TCoeColorUse > &aColorUseList) const
  Gets the list of logical colours used to draw the control.
virtual IMPORT_C void  HandleResourceChange (TInt aType)
  Handles a change to the control's resources.
virtual IMPORT_C TCoeInputCapabilities  InputCapabilities () const
  Gets the total of the input capabilities of all the editor's fields.
virtual IMPORT_C void  HandlePointerEventL (const TPointerEvent &aPointerEvent)
  From CCoeControl.
virtual IMPORT_C TTypeUid::Ptr  MopSupplyObject (TTypeUid aId)
  Retrieves an object of the same type as that encapsulated in aId.
IMPORT_C void  SetSkinTextColorL (TInt aAknSkinIDForTextColor, TInt aAknSkinIDForBgColor=KErrNotFound)
  Sets the colors for text and background as skin IDs.

Static Public Member Functions

static IMPORT_C TTime  ReadTime (TResourceReader &aResourceReader)
  A utility function which reads seconds, minutes and hours from a resource and returns the corresponding TTime value.
static IMPORT_C TTime  ReadDate (TResourceReader &aResourceReader)
  A utility function which reads days, months and years from a resource and returns the corresponding TTime value.
static IMPORT_C TTime  ReadTimeAndDate (TResourceReader &aResourceReader)
  A utility function which reads seconds, minutes, hours, days, months and years from a resource and returns the corresponding TTime value.
static IMPORT_C TTimeIntervalSeconds  ReadDuration (TResourceReader &aResourceReader)
  Reads a duration value from a resource.
static IMPORT_C TTimeIntervalSeconds  ReadTimeOffset (TResourceReader &aResourceReader)
  Reads a time offset from a resource.
static IMPORT_C TTimeIntervalSeconds  Convert (const TTime &aTime)
  Converts a time duration to seconds.
static IMPORT_C TTime  Convert (const TTimeIntervalSeconds &aTimeIntervalSeconds)
  Converts a time duration in seconds to hours, minutes and seconds.
static void  InvalidFieldAlert ()
static void  LeaveWithAlert (TInt aResourceId)

Protected Member Functions

virtual IMPORT_C void  FocusChanged (TDrawNow aDrawNow)
  Redraws the current field, so removing or displaying the cursor.
IMPORT_C void  WriteInternalStateL (RWriteStream &aWriteStream) const
  Writes the internal state of the control and its components to aStream.
IMPORT_C void  HandleInteraction (TBool aHandleDeHighlight, TInt aNewCurrentField, TInt aOldWidthInPixelsOfOldCurrentField, CEikMfneField::THighlightType aOldHighlightTypeOfOldCurrentField, TBool &aDataAltered, TBool &aError)
  Handles the redrawing associated with a change to the current field.
virtual IMPORT_C void  FieldIsAboutToBeDeHighlighted (CEikMfneField *aField, TBool &aDrawAllFields)
  Empty virtual function.
IMPORT_C TSize  MfneSize () const
  Gets the size of the multi-field numeric editor.
IMPORT_C TSize  MfneSize (TBool aShrinkToMinimumSize)
  Gets the size of the multi-field numeric editor.

Member Enumeration Documentation

enum CEikMfne::TFeatureId
 

Settable features for MFNE.

See SetFeature().

Enumerator:
EClipGcToRect  Tries to prevent MFNE drawing outside its rect, event if it smaller than MinimumSize().

0 (or EFalse) parameter disables this, non-zero (or ETrue) enables the feature.


Constructor & Destructor Documentation

IMPORT_C CEikMfne::CEikMfne  ) 
 

Default constructor.

virtual IMPORT_C CEikMfne::~CEikMfne  )  [virtual]
 

Destructor.

This function is virtual which ensures that if delete is explicitly called on a CEikMfne pointer which points to a derived class instance, the derived class destructor is called.


Member Function Documentation

IMPORT_C void CEikMfne::AddField CEikMfneField aField  ) 
 

Adds a field.

The field is added as the first empty element in the field array or, if there is no current field, aField becomes the current field.

This should be called by the container only if a derived control is not constructed from a resource.

Ownership of aField is transferred to this multi-field numeric editor.

Parameters:
aField  A field.
Panic:
22 If the field array has not been allocated.
IMPORT_C TMargins CEikMfne::BorderMargins  )  const
 

Gets the control's border margins.

Returns:
The control's margins.
static IMPORT_C TTime CEikMfne::Convert const TTimeIntervalSeconds &  aTimeIntervalSeconds  )  [static]
 

Converts a time duration in seconds to hours, minutes and seconds.

Parameters:
aTimeIntervalSeconds  The number of seconds to be converted.
Returns:
The date/time duration.
static IMPORT_C TTimeIntervalSeconds CEikMfne::Convert const TTime &  aTime  )  [static]
 

Converts a time duration to seconds.

Parameters:
aTime  The date and time to be converted.
Returns:
The time duration in seconds.
IMPORT_C void CEikMfne::CreateFieldArrayL TInt  aNumFields  ) 
 

Allocates a field array containing aNumFields elements.

This should be called by the container only if a derived control is not constructed from a resource.

Parameters:
aNumFields  The number of fields.
Panic:
20 In debug builds, if there is already a field in the editor.
TInt CEikMfne::CurrentField  )  const [inline]
 

Gets the index into the field array of the current field.

Returns:
The current field's index.
IMPORT_C void CEikMfne::DrawNowAndLeaveWithTimeDateFormatInfoMsgL TInt  aResourceId,
const TTime &  aTimeDate
const
 

Draws immediately, and then leaves with an info message containing a formatted time/date string.

The time/date is passed to the function, as is the resource which contains the format string which defines how it is to be formatted.

Parameters:
aResourceId  The resource containing the time/date format. See TTime::FormatL().
aTimeDate  The object containing the time/date to be displayed.
IMPORT_C CEikMfneField* CEikMfne::Field TInt  aField  )  const
 

Gets the CEikMfneField at the specified index.

Parameters:
aField  The field index.
Returns:
The requested field, or NULL if the index is less than zero or greater than the number of fields.
virtual IMPORT_C void CEikMfne::FieldIsAboutToBeDeHighlighted CEikMfneField aField,
TBool &  aDrawAllFields
[protected, virtual]
 

Empty virtual function.

Called by HandleInteraction() when switching from the current field. Can be implemented by derived classes to maintain consistency between fields, e.g. in a range editor.

Parameters:
aField  The current field.
aDrawAllFields  On return, whether all fields have changed and need to be redrawn.
virtual IMPORT_C void CEikMfne::FocusChanged TDrawNow  aDrawNow  )  [protected, virtual]
 

Redraws the current field, so removing or displaying the cursor.

If the editor has lost focus, the current field is reset to the first editable field.

Parameters:
aDrawNow  Whether to draw the control immediately.

Reimplemented in CAknUnitEditor.

IMPORT_C const CFont* CEikMfne::Font  )  const
 

Gets a pointer to the CFont object that is used to draw the fields in this editor.

Returns:
A pointer to the CFont object used to draw the fields in this editor.
virtual IMPORT_C void CEikMfne::GetColorUseListL CArrayFix< TCoeColorUse > &  aColorUseList  )  const [virtual]
 

Gets the list of logical colours used to draw the control.

The colours are appended to aColorUseList.

Overrides CCoeControl::GetColorUseListL().

Parameters:
aColorUseList  On return, the colour list.

Reimplemented from CEikBorderedControl.

IMPORT_C TInt CEikMfne::GetFeature TInt  aFeatureId,
TInt &  aFeatureParam
const
 

Used to getting feature statuses.

Parameters:
aFeatureId  The feature id, see TFeatureId
aFeatureParam  On return, the parameter for the feature (usually non-zero for an enabled feature and zero for disabled)
Returns:
KErrNone if the feature is supported and fetching its value succeeded
IMPORT_C void CEikMfne::HandleInteraction TBool  aHandleDeHighlight,
TInt  aNewCurrentField,
TInt  aOldWidthInPixelsOfOldCurrentField,
CEikMfneField::THighlightType  aOldHighlightTypeOfOldCurrentField,
TBool &  aDataAltered,
TBool &  aError
[protected]
 

Handles the redrawing associated with a change to the current field.

Called by OfferKeyEventL(), HandlePointerEventL() and PrepareForFocusLossL().

Parameters:
aHandleDeHighlight  ETrue if the current field has changed so requires de-highlighting.
aNewCurrentField  The index of the field to which the user has moved.
aOldWidthInPixelsOfOldCurrentField  The width in pixels of the previous current field.
aOldHighlightTypeOfOldCurrentField  The highlight type of the previously current field.
aDataAltered  ETrue if the data has been changed.
aError  On return, ETrue if successful, EFalse if not successful.
IMPORT_C void CEikMfne::HandleMfneCommandL TInt  aCommand  )  [virtual]
 

From MAknMfneCommandObserver.

Allows owning controls to give commands to MFNE editors. This is interface was added to enable modifying the current field value with touch buttons.

Parameters:
aCommand  Command ID defined in MAknMfneCommandObserver::TMfneCommand

Implements MAknMfneCommandObserver.

virtual IMPORT_C void CEikMfne::HandlePointerEventL const TPointerEvent &  aPointerEvent  )  [virtual]
 

From CCoeControl.

Handles pointer events.

Parameters:
aPointerEvent  The pointer event.

Reimplemented from CEikBorderedControl.

Reimplemented in CAknIpFieldEditor, CEikNumberEditor, CEikRangeEditor, CEikTimeEditor, CEikDateEditor, CEikTimeAndDateEditor, CEikDurationEditor, and CEikTimeOffsetEditor.

virtual IMPORT_C void CEikMfne::HandleResourceChange TInt  aType  )  [virtual]
 

Handles a change to the control's resources.

The types of resources handled are those which are shared across the environment, e.g. colours or fonts.

Overrides CCoeControl::HandleResourceChange().

Parameters:
aType  A message UID value.

Reimplemented from CEikBorderedControl.

void CEikMfne::HighlightField TInt  aFieldPosition  ) 
 
virtual IMPORT_C TCoeInputCapabilities CEikMfne::InputCapabilities  )  const [virtual]
 

Gets the total of the input capabilities of all the editor's fields.

Overrides CCoeControl::InputCapabilities().

If this function is overrided in a subclass, the subclass should obtain this class' InputCapabilities' object provider through TCoeInputCapabilities::ObjectProvider() and set that as a part of the subclass' InputCapabilities object provider chain to ensure maximum functionality.

Returns:
The control's input capabilities.
static void CEikMfne::InvalidFieldAlert  )  [static]
 
static void CEikMfne::LeaveWithAlert TInt  aResourceId  )  [static]
 
IMPORT_C TSize CEikMfne::MfneSize TBool  aShrinkToMinimumSize  )  [protected]
 

Gets the size of the multi-field numeric editor.

The width is the sum of the maximum widths of every field.

Parameters:
aShrinkToMinimumSize  ETrue to shrink the width to the minimum required for each field.
Returns:
The size of the multi-field numeric editor.
IMPORT_C TSize CEikMfne::MfneSize  )  const [protected]
 

Gets the size of the multi-field numeric editor.

The width is the sum of the maximum widths of every field.

Returns:
The size of the multi-field numeric editor.
virtual IMPORT_C TSize CEikMfne::MinimumSize  )  [virtual]
 

Gets the minimum size of the control.

Overrides CCoeControl::MinimumSize().

Returns:
The minimum control size.
virtual IMPORT_C TTypeUid::Ptr CEikMfne::MopSupplyObject TTypeUid  aId  )  [virtual]
 

Retrieves an object of the same type as that encapsulated in aId.

Overrides CCoeControl::MopSupplyObject().

Parameters:
aId  An encapsulated object type ID.
Returns:
Encapsulates the pointer to the object provided. Note that the encapsulated pointer may be NULL.
TInt CEikMfne::NumFields  )  const [inline]
 

Gets the number of fields.

Returns:
The number of fields in the editor.
virtual IMPORT_C TKeyResponse CEikMfne::OfferKeyEventL const TKeyEvent &  aKeyEvent,
TEventCode  aType
[virtual]
 

Handles key events.

Overrides CCoeControl::OfferKeyEventL(). The key event is passed onto the current field to handle.

Parameters:
aKeyEvent  The key event.
aType  The type of key event.
Returns:
Indicates whether or not the key event was used by this control.

Reimplemented in CAknIpFieldEditor, CAknLocationEditor, CEikDateEditor, and CEikTimeAndDateEditor.

virtual IMPORT_C void CEikMfne::PrepareForFocusLossL  )  [virtual]
 

Prepares for focus loss.

Overrides CCoeControl::PrepareForFocusLossL().

This function should be called when an attempt is made to remove focus from a multi-field numeric editor. It redraws the control, removing highlighting from the current field.

It may be overridden in derived classes to test the validity of information entered into the editor. Derived class versions should include a base function call.

Reimplemented in CAknLocationEditor, CAknUnitEditor, CEikTimeEditor, CEikDateEditor, CEikTimeAndDateEditor, CEikDurationEditor, and CEikTimeOffsetEditor.

static IMPORT_C TTime CEikMfne::ReadDate TResourceReader &  aResourceReader  )  [static]
 

A utility function which reads days, months and years from a resource and returns the corresponding TTime value.

Parameters:
aResourceReader  A resource reader.
Returns:
The date value read from the resource. The hours, minutes, seconds values are set to zero.
static IMPORT_C TTimeIntervalSeconds CEikMfne::ReadDuration TResourceReader &  aResourceReader  )  [static]
 

Reads a duration value from a resource.

Parameters:
aResourceReader  A resource reader.
Returns:
The duration, in seconds.
static IMPORT_C TTime CEikMfne::ReadTime TResourceReader &  aResourceReader  )  [static]
 

A utility function which reads seconds, minutes and hours from a resource and returns the corresponding TTime value.

Parameters:
aResourceReader  A resource reader.
Returns:
The time value read from the resource.
static IMPORT_C TTime CEikMfne::ReadTimeAndDate TResourceReader &  aResourceReader  )  [static]
 

A utility function which reads seconds, minutes, hours, days, months and years from a resource and returns the corresponding TTime value.

Parameters:
aResourceReader  A resource reader.
Returns:
The time/date value read from the resource.
static IMPORT_C TTimeIntervalSeconds CEikMfne::ReadTimeOffset TResourceReader &  aResourceReader  )  [static]
 

Reads a time offset from a resource.

This is identical to ReadDuration(), except that negative offsets are allowed.

Parameters:
aResourceReader  A resource reader.
Returns:
The duration, in seconds.
IMPORT_C void CEikMfne::ResetFieldArray  ) 
 

Deletes the editor's field and the field array.

After a call to this, CreateFieldArrayL() can be called again.

IMPORT_C TInt CEikMfne::SetFeature TInt  aFeatureId,
TInt  aFeatureParam
 

Used for setting various flag-like features to the editor.

Parameters:
aFeatureId  The feature id, see TFeatureId
aFeatureParam  The feature parameter. This is usually enabled or disabled. For more info, see the feature documentation in TFeatureId.
Returns:
KErrNone if the feature modification succeeded
IMPORT_C void CEikMfne::SetFont const CFont *  aFont  ) 
 

Sets the font that is used to draw the fields in this editor.

Parameters:
aFont  A pointer to a CFont object that is used to draw the fields in this editor.
IMPORT_C void CEikMfne::SetMfneAlignment TInt  aAlignment  ) 
 

Sets the alignment of the editor.

The editor alignments, defined in avkon.hrh, are EAknEditorAlignNone, EAknEditorAlignCenter, EAknEditorAlignLeft, EAknEditorAlignRight or EAknEditorAlignBidi.

Parameters:
aAlignment  The editor's alignment
IMPORT_C void CEikMfne::SetSkinBackgroundControlContextL MAknsControlContext aControlContext  ) 
 

Sets within in the editor an externally owned Skins background control context.

This background control context will then be used by the editor to draw background.

If this API is not called, then the editor IS skin enabled, (that is CEikMfnes are skin enabled by default) but it will try to find a control context with which to perform background drawing from the Control Environment, via the Object Provider.

Setting this control context to NULL will have the effect of turning off background skinning.

Parameters:
aBackgroundControlContext  Control context to store. Not owned. Can be NULL
IMPORT_C void CEikMfne::SetSkinTextColorL TInt  aAknSkinIDForTextColor,
TInt  aAknSkinIDForBgColor = KErrNotFound
 

Sets the colors for text and background as skin IDs.

Please note that bgcolor overrides skinned draw if set

Parameters:
aAknSkinIDForTextColor  ID for text color.
aAknSkinIDForBgColor  ID for background color.
IMPORT_C void CEikMfne::SetSuppressBackgroundDrawing TBool  aSuppress  ) 
 

Used for suppressing all editor's background drawing.

This is intended for internal use.

Note that when this is set, the background is not drawn with skin nor cleared, so the background MUST be drawn by the parent control every time the editor changes.

Parameters:
aSuppress  If ETrue, suppress background drawing
IMPORT_C void CEikMfne::SetUpAndDownKeysConsumed TBool  aConsume  ) 
 

Sets whether the editor consumes up and down key events.

If this is set to EFalse, the editor returns EKeyWasNotConsumed upon receiving EKeyDownArrow or EKeyUpArrow key event and doesn't send the key event to the current field.

Parameters:
aConsume  If EFalse, OfferKeyEventL() returns EKeyWasNotConsumed when up and down key events are received.
IMPORT_C void CEikMfne::SetUseOverrideColors TBool  aUseOverrideColors  ) 
 

Sets the MFNE to use the CCoeControl::OverrideColorL() defined color in drawing.

If this is set, no skinning will be used in drawing.

Parameters:
aUseOverrideColors  ETrue to make the MFNE use overridden colors.
IMPORT_C TBool CEikMfne::SupportsFeature TInt  aFeatureId  )  const
 

Used for checking if the editor supports a feature.

For features, see TFeatureId.

Parameters:
aFeatureId 
Returns:
ETrue if the feature is supported
IMPORT_C void CEikMfne::WriteInternalStateL RWriteStream &  aWriteStream  )  const [protected]
 

Writes the internal state of the control and its components to aStream.

This function is empty in release builds.

Reimplemented from CEikBorderedControl.


The documentation for this class was generated from the following file:

Copyright © Nokia Corporation 2001-2008
Back to top