javauis/lcdui_akn/lcdui/inc/CMIDDateFieldItem.h
branchRCL_3
changeset 14 04becd199f91
child 23 e5618cc85d74
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMIDDATEFIELDITEM_H
       
    20 #define CMIDDATEFIELDITEM_H
       
    21 
       
    22 // using CEikTTimeEditor as memeber iEditor
       
    23 #include <eikmfne.h>
       
    24 #include <lcdui.h>
       
    25 
       
    26 // MTickerObserver interface in class declaration
       
    27 #include "CMIDTicker.h"
       
    28 // CMIDControlItem inheritance in class declaration
       
    29 #include "CMIDControlItem.h"
       
    30 #include "CMIDCommand.h"
       
    31 
       
    32 NONSHARABLE_CLASS(CMIDDateFieldItem) : public CMIDControlItem,
       
    33         public MMIDDateField, public MMIDTickerObserver
       
    34 {
       
    35 public:
       
    36     /**
       
    37      * Double ctor
       
    38      * @param aLabel Label
       
    39      * @param aInputMode Input mode
       
    40      * @param aUIManager UI manager
       
    41      * @return CMIDDateFieldItem instance
       
    42      *
       
    43      * @since s60
       
    44      */
       
    45     static CMIDDateFieldItem* NewL(
       
    46         const TDesC& aLabel, MMIDDateField::TInputMode aInputMode, CMIDUIManager* aUIManager);
       
    47 
       
    48     virtual ~CMIDDateFieldItem();
       
    49     //
       
    50     // From MMIDDateField
       
    51     //
       
    52     TTime Date() const;
       
    53     void SetDate(const TTime& aTime);
       
    54     void SetUninitialized();
       
    55     void SetInputModeL(MMIDDateField::TInputMode aInputMode);
       
    56     //
       
    57     // From MMIDItem
       
    58     //
       
    59     void SetLabelL(const TDesC& aLabel);
       
    60     void SetLayoutL(TLayout aLayout);
       
    61     void SetPreferredSizeL(const TSize& aSize);
       
    62     TSize PreferredSize() const;
       
    63     TSize MinimumSize() const;
       
    64     void AddCommandL(MMIDCommand* aCommand);
       
    65     void RemoveCommand(MMIDCommand* aCommand);
       
    66     void SetDefaultCommand(MMIDCommand* aCommand);
       
    67     TBool IsSelectable() const;
       
    68     TBool ProcessCommandL(CMIDCommand* aCommand);
       
    69     TSize ResetPreferredSize() const;
       
    70     //
       
    71     // From MMIDComponent
       
    72     //
       
    73     void Dispose();
       
    74     //
       
    75     // From CCoeControl
       
    76     //
       
    77     TSize MinimumSize();
       
    78     TInt CountComponentControls() const;
       
    79     CCoeControl* ComponentControl(TInt aIndex) const;
       
    80     void Draw(const TRect& aRect) const;
       
    81     void SizeChanged();
       
    82     TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
       
    83     void SetContainerWindowL(const CCoeControl& aContainer);
       
    84     virtual void FocusChanged(TDrawNow /*aDrawNow*/);
       
    85     TCoeInputCapabilities InputCapabilities() const;
       
    86 #ifdef RD_SCALABLE_UI_V2
       
    87     void HandlePointerEventL(const TPointerEvent &aPointerEvent);
       
    88 #endif // RD_SCALABLE_UI_V2
       
    89     //
       
    90     // From CMIDItem
       
    91     //
       
    92     TInt ItemPreferredHeightWithoutLabel();
       
    93     //
       
    94     // From CMIDControlItem
       
    95     //
       
    96     void ResolutionChange(TInt aType); // this is called when resolution is changed
       
    97     void AdjustToSizeL(const TSize& aSize);
       
    98     void CursorUpdate();
       
    99 private: // methods
       
   100     /**
       
   101      * Ctor
       
   102      * @param aUIManager UI manager
       
   103      *
       
   104      * @since s60
       
   105      */
       
   106     CMIDDateFieldItem(CMIDUIManager* aUIManager);
       
   107     void ConstructL(const TDesC& aLabel,MMIDDateField::TInputMode aInputMode);
       
   108     void SetInitialized(TInt aSetCurrentTime = ETrue);
       
   109     void  DoSafeDraw();
       
   110     TBool IsDateTimeNonEmpty() const;
       
   111 
       
   112     /**
       
   113      * Resets the commands of this form item to expose the functions that
       
   114      * are currently available. Should be called whenever the focus inside
       
   115      * the editor changes.
       
   116      **/
       
   117     void  UpdateCommands();
       
   118 
       
   119     /**
       
   120      * Returns ETrue if the current field in the time editor is am/pm field.
       
   121      **/
       
   122     TBool IsCurrentFieldAmPmField();
       
   123 
       
   124     /**
       
   125      * Returns ETrue if the field indicated by the fieldIndex in the
       
   126      * time editor is the am/pm field. (Assumes that there is only one)
       
   127      **/
       
   128     TBool IsFieldAmPmField(TInt fieldIndex);
       
   129 
       
   130     /**
       
   131      * Toggles the value of the am/pm field in this editor from the current
       
   132      * value to the other value (am -> pm, pm -> am). If am/pm field is not
       
   133      * found, nothing is done.
       
   134      **/
       
   135     void  ToggleAmPmFieldValue();
       
   136 
       
   137     /**
       
   138      * Updates the LAF related member variables
       
   139      **/
       
   140     void UpdateMemberVariables();
       
   141 
       
   142 private: // data
       
   143 
       
   144     CEikTTimeEditor* iEditor;
       
   145     TBool iInitialised;
       
   146     TBool prevInitialised;
       
   147 
       
   148     MMIDDateField::TInputMode iInputMode;
       
   149     CMIDCommand* iAmPmToggleCommand; // command to be shown in MSK to toggle am/pm value
       
   150 
       
   151     TMargins iMargins;
       
   152     TInt iEditorHeight;
       
   153     const TKeyEvent* usedKeyEvent;
       
   154 
       
   155 #if defined( RD_SCALABLE_UI_V2)
       
   156     // The pointer grabbing component control that received the pointer down event. May be NULL.
       
   157     // Need to keep track of the grabbing control inside datefield because in long tap or canceled long tap
       
   158     // cases datefield does not forward the up event to the component controls. Therefore the grabbing state
       
   159     // of the component controls may be wrong inside CCoeControl implementation.
       
   160     CCoeControl* iGrabbingControl;
       
   161 #endif //if defined( RD_SCALABLE_UI_V2)
       
   162 };
       
   163 
       
   164 
       
   165 #endif // CMIDDATEFIELDITEM_H