meetingrequest/mrgui/inc/cmrfieldcontainer.h
branchRCL_3
changeset 64 3533d4323edc
child 80 726fba06891a
equal deleted inserted replaced
63:d189ee25cf9d 64:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Interface for field container
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CMRFIELDCONTAINER_H
       
    19 #define CMRFIELDCONTAINER_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <coecntrl.h>
       
    23 #include "mesmrlistobserver.h"
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class MESMRFieldStorage;
       
    27 class MMRFieldContainerObserver;
       
    28 
       
    29 // CLASS DECLARATIONS
       
    30 NONSHARABLE_CLASS( CMRFieldContainer ) :
       
    31     public CCoeControl,
       
    32     public MESMRListObserver
       
    33     {
       
    34     public: // Creation and destruction
       
    35         /**
       
    36          * Static constructor.
       
    37          *
       
    38          * @return New instance of this class
       
    39          */
       
    40         static CMRFieldContainer* NewL(
       
    41                 MESMRFieldStorage& aFactory,
       
    42                 const CCoeControl& aParent );
       
    43         /**
       
    44          * Destructor
       
    45          */
       
    46         ~CMRFieldContainer();
       
    47 
       
    48     public: // Interface
       
    49 
       
    50         /**
       
    51         * Return focused field.
       
    52         * @return Focused list item or NULL if no focused item
       
    53         */
       
    54         CESMRField* FocusedField() const;
       
    55 
       
    56         /**
       
    57         * Moves focus up one step.
       
    58         *
       
    59         * @param aHiddenFocus, in case of hidden focus use case, ETrue.
       
    60         * @return TKeyResponse, if key response was used or not
       
    61         */
       
    62         TKeyResponse MoveFocusUpL( TBool aHiddenFocus );
       
    63 
       
    64         /**
       
    65         * Moves focus down one step.
       
    66         *
       
    67         * @param aHiddenFocus, in case of hidden focus use case, ETrue.
       
    68         * @return TKeyResponse, if key response was used or not
       
    69         */
       
    70         TKeyResponse MoveFocusDownL( TBool aHiddenFocus );
       
    71 
       
    72         /**
       
    73         * Moves focus visible if it is partly or completely out of
       
    74         * viewable area.
       
    75         */
       
    76         void SetFieldContainerObserver( MMRFieldContainerObserver* aObserver );
       
    77 
       
    78         /**
       
    79          * Scrolls field container. This is called by list pane during
       
    80          * kinetic scrolling.
       
    81          * @param aTl new top left corner of the container
       
    82          */
       
    83         void ScrollContainer( const TPoint& aTl );
       
    84 
       
    85         /**
       
    86          * Synchronizes field container and visible field positions after
       
    87          * kinetic scrolling.
       
    88          */
       
    89         void Synchronize();
       
    90         
       
    91     public: // From MESMRListObserver
       
    92         void ControlSizeChanged( CESMRField* aField );
       
    93         void ShowControl( TESMREntryFieldId aFieldId );
       
    94         void HideControl( TESMREntryFieldId aFieldId );
       
    95         TBool IsControlVisible( TESMREntryFieldId aFieldId );
       
    96         void SetControlFocusedL( TESMREntryFieldId aFieldId );
       
    97         TInt ListHeight();
       
    98         TBool IsFocusedControlsBottomVisible();
       
    99         void ScrollControlVisible( TInt aInd );
       
   100         void RePositionFields( TInt aAmount );
       
   101         TRect ViewableAreaRect();
       
   102 
       
   103     public: // From CCoeControl
       
   104         TSize MinimumSize();
       
   105 
       
   106     private: // From CCoeControl
       
   107         TInt CountComponentControls() const;
       
   108         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   109         void SizeChanged();
       
   110         void Draw( const TRect& aRect ) const;
       
   111         void HandlePointerEventL( const TPointerEvent &aPointerEvent );
       
   112 
       
   113     private: // Implementation
       
   114         CMRFieldContainer( MESMRFieldStorage& aFactory );
       
   115         void ConstructL( const CCoeControl& aParent );
       
   116         void MoveFields( TInt aIndex, TPoint& aTl );
       
   117         void LayoutField( CESMRField& aField, const TPoint& aTl );
       
   118         TInt LastVisibleField( TESMREntryFieldId aFieldId );
       
   119         void DoSetFocusL( TInt aNewFocusIndex );
       
   120         TKeyResponse MoveFocusVisibleL();
       
   121         void SetScrolling( TBool aScrolling );                
       
   122 
       
   123     private: // Data
       
   124         // Own: Informs listapane about needed position changes
       
   125         MMRFieldContainerObserver* iObserver;
       
   126         /// Ref: Storage for list items.
       
   127         MESMRFieldStorage& iFactory;
       
   128         /// Own: Current focus index
       
   129         TInt iFocusedFieldIndex;
       
   130         /// Own: Flag for kinetic scrolling state
       
   131         TBool iScrolling;
       
   132     };
       
   133 
       
   134 #endif // CMRFIELDCONTAINER_H
       
   135 
       
   136 // End of file