phonebookui/Phonebook2/USIMExtension/inc/CPsu2NameListViewBase.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  A base class for sim name list views
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CPSU2NAMELISTVIEWBASE_H
       
    21 #define CPSU2NAMELISTVIEWBASE_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <MPbk2UIExtensionView.h>
       
    26 #include <MPbk2ControlObserver.h>
       
    27 #include "TPsu2SimIconId.h"
       
    28 #include "Pbk2USimUI.hrh"
       
    29 #include <MPbk2MenuCommandObserver.h>
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 
       
    33 class CEikImage;
       
    34 class CPsu2ViewManager;
       
    35 class CPbk2UIExtensionView;
       
    36 template<class Control> class CPbk2ControlContainer;
       
    37 class CPbk2NamesListControl;
       
    38 class MPbk2ContactUiControl;
       
    39 class MPbk2ContactNameFormatter;
       
    40 class CPbk2SortOrderManager;
       
    41 class MPbk2PointerEventInspector;
       
    42 
       
    43 // CLASS DECLARATION
       
    44 
       
    45 /**
       
    46  *  A base class for SIM name list views
       
    47  */
       
    48 class CPsu2NameListViewBase : 
       
    49         public CBase,
       
    50         public MPbk2UIExtensionView,
       
    51         public MPbk2ControlObserver,
       
    52         public MPbk2MenuCommandObserver
       
    53     {
       
    54     public:  // Constructors and destructor
       
    55         /**
       
    56         * Destructor.
       
    57         */
       
    58         ~CPsu2NameListViewBase();
       
    59 
       
    60     public: // From MPbk2UIExtensionView
       
    61         void HandleStatusPaneSizeChange();
       
    62         CPbk2ViewState* ViewStateLC() const;
       
    63         TBool HandleCommandKeyL(const TKeyEvent& aKeyEvent,
       
    64             TEventCode aType);
       
    65         void HandlePointerEventL(
       
    66                 const TPointerEvent& aPointerEvent );
       
    67         TInt GetViewSpecificMenuFilteringFlagsL() const;
       
    68         void DoActivateL(const TVwsViewId& aPrevViewId,
       
    69             TUid aCustomMessageId, const TDesC8& aCustomMessage);
       
    70         void DoDeactivate();
       
    71         void HandleCommandL(TInt aCommand);
       
    72         void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);
       
    73         void HandleLongTapEventL(
       
    74                 const TPoint& aPenEventLocation,
       
    75                 const TPoint& aPenEventScreenLocation);
       
    76 
       
    77     public: // From MPbk2ControlObserver
       
    78         void HandleControlEventL(MPbk2ContactUiControl& aControl,
       
    79             const TPbk2ControlEvent& aEvent);
       
    80 
       
    81     public: // From MPbk2MenuCommandObserver
       
    82         void PreCommandExecutionL(
       
    83                 const MPbk2Command& aCommand );
       
    84         void PostCommandExecutionL(
       
    85                 const MPbk2Command& aCommand );
       
    86 
       
    87     protected:  // New functions
       
    88         virtual void UpdateCbasL() { };
       
    89 
       
    90     protected: // Construction
       
    91         CPsu2NameListViewBase(
       
    92                 CPbk2UIExtensionView& aExtensionView,
       
    93                 CPsu2ViewManager& aViewManager );
       
    94         virtual void UpdateListEmptyTextL(
       
    95                 TInt aListState );
       
    96 
       
    97     private:  // Implementation
       
    98         /// Sub class offers the resource id for the name list control
       
    99         virtual TInt NameListControlResourceId() const = 0;
       
   100         void CreateControlsL();
       
   101         void StoreStateL();
       
   102         void RestoreStateL();
       
   103 
       
   104     protected:  // Data
       
   105         /// Ref: The extension view instance
       
   106         CPbk2UIExtensionView& iExtensionView;
       
   107         /// Ref: The view manager of the extension
       
   108         CPsu2ViewManager& iViewManager;
       
   109         /// This view's control container type
       
   110         typedef CPbk2ControlContainer<CPbk2NamesListControl> CContainer;
       
   111         /// Own: this view's control container
       
   112         CContainer* iContainer;
       
   113         /// Ref: This view's control
       
   114         CPbk2NamesListControl* iControl;
       
   115         /// Ref: Pointer event inspector
       
   116         MPbk2PointerEventInspector* iPointerEventInspector;
       
   117         class TContextPaneIcon;
       
   118         /// Own: ETrue, if any selection modifier key is depressed
       
   119         TBool iSelectionModifierUsed;
       
   120         /// Own: ETrue after PreCommandExecutionL() was called, and EFalse
       
   121         /// after PostCommandExecutionL().
       
   122         TBool iCommandBetweenPreAndPostExecution;
       
   123 
       
   124     private:    // Data
       
   125         /// Own: stored control state
       
   126         CPbk2ViewState* iControlState;
       
   127         /// Own: Own sort order manager for fdn
       
   128         CPbk2SortOrderManager* iSortOrderManager;
       
   129         /// Own: own formatter is needed for fdn
       
   130         MPbk2ContactNameFormatter* iNameFormatter;
       
   131         /// Own: Focus index
       
   132         TInt iFocusIndex;
       
   133     };
       
   134 
       
   135 /**
       
   136  * Phonebook 2 USIM extension context pane icon.
       
   137  * Responsible for loading  the application icon for the context pane.
       
   138  */
       
   139 class CPsu2NameListViewBase::TContextPaneIcon
       
   140     {
       
   141     public: // Construction
       
   142      
       
   143         /**
       
   144          * Constructor.
       
   145          *
       
   146          * @param aIconId       Icon id.
       
   147          */
       
   148         TContextPaneIcon(
       
   149                 TPsu2SimIconId aIconId );
       
   150 
       
   151     public: // Interface
       
   152 
       
   153         /**
       
   154          * Creates a context pane icon.
       
   155          *
       
   156          * @return  Image for the context pane.
       
   157          */
       
   158         CEikImage* CreateLC();
       
   159 
       
   160     private: // Implementation
       
   161         void SetSize(
       
   162                 CFbsBitmap& aBitmap,
       
   163                 CFbsBitmap& aMask );
       
   164 
       
   165     private: // Data
       
   166         /// Own: Icon id
       
   167         TPsu2SimIconId iIconId;
       
   168     };
       
   169 
       
   170 #endif      // CPSU2NAMELISTVIEWBASE_H
       
   171 
       
   172 // End of File