uiservicetab/vimpstui/inc/cvimpstuisinglelistboxtabviewcontrol.h
branchRCL_3
changeset 28 3104fc151679
parent 27 2b7283837edb
child 29 9a48e301e94b
equal deleted inserted replaced
27:2b7283837edb 28:3104fc151679
     1 /*
       
     2 * Copyright (c) 2008 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:  tabbed view control implementation class with doublestyle listbox 
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef     __CVIMPSTUISINGLELISTBOXTABVIEWCONTROL_H
       
    19 #define     __CVIMPSTUISINGLELISTBOXTABVIEWCONTROL_H
       
    20 
       
    21 #include "mvimpstuitabbedviewcontrol.h"
       
    22 #include "cvimpstuisinglestylelistbox.h"
       
    23 
       
    24 class CVIMPSTUiSingleStyleListBox;
       
    25 // CLASS DECLARATION
       
    26 /**
       
    27  * Tabbed view control. Shows list of contacts.
       
    28  *  @lib vimpstui.lib
       
    29  *  @since S60 v5.0 
       
    30  */
       
    31 class CVIMPSTUiSingleListBoxTabViewControl : public CCoeControl,
       
    32 									            public MVIMPSTProcessArrayObserver,
       
    33 									            public MEikListBoxObserver,
       
    34             									public MCoeControlObserver,
       
    35             								    public MVIMPSTUiTabbedViewControl
       
    36     {
       
    37     public: // Constructor and destructor
       
    38         void  HandleAvatarChangeL( const TDesC& aUserId );
       
    39         /**
       
    40          * Creates a new CImContactsTabbedViewControl.
       
    41          *
       
    42          * @param aTabbedView reference to view.
       
    43          * @param aKeyEventHandler Key event handler to be used
       
    44          * @param aCommandHandler reference to commandhandler
       
    45          * @param aServiceId Id of the service
       
    46          * @param aBrandHandler reference to brandhandler
       
    47          * @param aEngine reference to engine
       
    48          */
       
    49         static CVIMPSTUiSingleListBoxTabViewControl* NewL( CVIMPSTUiTabbedView& aTabbedView, MPbk2KeyEventHandler* aKeyEventHandler, 
       
    50         										MVIMPSTCmdHandler& aCommandHandler,
       
    51         										TUint32 aServiceId,
       
    52         										CVIMPSTUiBrandData& aBrandHandler,
       
    53         										MVIMPSTEngine& aEngine,
       
    54         										CEikButtonGroupContainer* aCba);
       
    55         
       
    56         /**
       
    57          * Creates a new CImContactsTabbedViewControl and leaves it to
       
    58          * cleanup stack.
       
    59          * @see NewL
       
    60          *
       
    61          * @param aTabbedView reference to view.
       
    62          * @param aKeyEventHandler Key event handler to be used
       
    63          * @param aCommandHandler reference to commandhandler
       
    64          * @param aServiceId Id of the service
       
    65          * @param aBrandHandler reference to brandhandler
       
    66          * @param aEngine reference to engine
       
    67          */
       
    68         static CVIMPSTUiSingleListBoxTabViewControl* NewLC( CVIMPSTUiTabbedView& aTabbedView,MPbk2KeyEventHandler* aKeyEventHandler,
       
    69         											MVIMPSTCmdHandler& aCommandHandler,
       
    70         											TUint32 aServiceId,
       
    71         											CVIMPSTUiBrandData& aBrandHandler,
       
    72         											MVIMPSTEngine& aEngine,
       
    73         											CEikButtonGroupContainer* aCba);
       
    74         
       
    75         /**
       
    76          * Destructor.
       
    77          */
       
    78         ~CVIMPSTUiSingleListBoxTabViewControl();
       
    79     
       
    80     public : // from MIMArrayProcessObserver
       
    81         /**
       
    82          * @see MIMArrayProcessObserver.
       
    83          */
       
    84         void HandleAdditionL(TVIMPSTEnums::TItem type, TInt aIndex);
       
    85         
       
    86        
       
    87      	 /**
       
    88           * @see MIMArrayProcessObserver.
       
    89           */
       
    90      	void HandleDeletionL(TVIMPSTEnums::TItem type, TInt aIndex);
       
    91         
       
    92     public://from MEikListBoxObserver
       
    93     
       
    94 		/**
       
    95          * From MEikListBoxObserver, Handles event's generated by listbox
       
    96 		 * @see MEikListBoxObserver
       
    97          */
       
    98 		void HandleListBoxEventL( CEikListBox* aListBox,
       
    99 			TListBoxEvent aEventType );
       
   100     
       
   101     public: //from MCoeControlObserver
       
   102     	/**
       
   103 	     * Handles events from findpane and forwards them to listbox filter.
       
   104 	     * @see MCoeControlObserver
       
   105 	     */
       
   106 	    void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType );
       
   107 	    
       
   108             /**
       
   109 
       
   110         /**
       
   111          * Get access to listbox model's filter
       
   112          * @return model's filter
       
   113          */                     
       
   114         CAknListBoxFilterItems* ListFilter();
       
   115         
       
   116    
       
   117     public: // New functions
       
   118         
       
   119         /**
       
   120          * Returns the currently focused item's index.
       
   121          * @return TInt, current item index.
       
   122          */
       
   123         TInt CurrentItemIndex() const;
       
   124         
       
   125         /**
       
   126          * Sets the currently focused item's index.
       
   127          *
       
   128          * @param aIndex new currently focused index
       
   129          */
       
   130         void SetCurrentItemIndex( TInt aIndex );
       
   131         
       
   132 		/**
       
   133          * Sets the currently focused item's index and updates the control
       
   134          * on the display.
       
   135          *
       
   136          * @param aIndex new currently focused index
       
   137          */
       
   138         void SetCurrentItemIndexAndDraw( TInt aIndex );
       
   139         
       
   140         /**
       
   141          * Handles item addition for this control.
       
   142          */
       
   143         void HandleItemAdditionL();
       
   144         /**
       
   145          * Handles item removal for this control.
       
   146          */
       
   147         void HandleItemRemovalL();
       
   148 
       
   149         /**
       
   150          * Sets list box empty text.
       
   151          *
       
   152          * @param aResourceId resource id of a empty text
       
   153          */
       
   154         void SetListEmptyTextL( TInt aResourceId );
       
   155         
       
   156         /**
       
   157          * send the message using selected item
       
   158          * this will launch the conversation view if im is enabled.
       
   159          */
       
   160         void SendMessageL();
       
   161         
       
   162         /**
       
   163          * Updates view after edit.
       
   164          * @param aIndex is the index of item that has changed.
       
   165          * @param aType is list item type. 
       
   166          */
       
   167         void UpdateViewL( TInt aIndex, TVIMPSTEnums::TItem aType);
       
   168         
       
   169 		/**
       
   170 		* @see MVIMPSTUiTabbedViewControl.
       
   171 		*/
       
   172 		void HandleAvatarRefreshL( const TDesC& aUserId,TBool aBlock );
       
   173 		
       
   174         
       
   175         /**
       
   176 	     * LoadsBitmap array.
       
   177 	     */	
       
   178         void LoadBitmapsL();
       
   179         
       
   180      
       
   181         
       
   182         /**
       
   183         * Activates find-pane
       
   184 		*/
       
   185 		void ActivateFindPaneL();
       
   186 
       
   187         /**
       
   188         * De-activates find-pane
       
   189 		*/
       
   190 		void DeactivateFindPaneL();
       
   191 		
       
   192 		/**
       
   193          * Sets the lock status of softkeys
       
   194          * @param aLock new status of lock (ETrue: locked, EFalse: Unlocked)
       
   195          */                     
       
   196         void SetCbaLockL( TBool aLock );
       
   197 
       
   198 
       
   199         /**
       
   200          * Updates Softkeys according to current focus
       
   201          * @param aUseDefaultCba Flag to force the default sofkeys for view.
       
   202          * Default value is false.
       
   203          */                     
       
   204         void UpdateCbaL( TBool aUseDefaultCba = EFalse );
       
   205         
       
   206 		/**
       
   207 		*Handle the avatar deletion in UI
       
   208 		*/
       
   209 		void SetFocussedId(const TDesC& aContact)  ;
       
   210 
       
   211 		/**
       
   212 		* the avatar deletion in UI
       
   213 		*/
       
   214 		TPtrC GetFocussedId() ;
       
   215 
       
   216     private: // From CCoeControl, standard control functionality
       
   217         
       
   218         /**
       
   219          * @see CCoeControl
       
   220          */
       
   221         TKeyResponse OfferKeyEventL
       
   222             ( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   223         
       
   224         /**
       
   225          * @see CCoeControl
       
   226          */
       
   227         void SizeChanged();
       
   228         
       
   229         /**
       
   230          * @see CCoeControl
       
   231          */
       
   232         TInt CountComponentControls() const;
       
   233         
       
   234         /**
       
   235          * @see CCoeControl
       
   236          */
       
   237         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   238         
       
   239         /**
       
   240          * @see CCoeControl
       
   241          */
       
   242         void FocusChanged( TDrawNow aDrawNow );
       
   243 
       
   244     private: // Implementation
       
   245         /**
       
   246          * Standard C++ constructor
       
   247          *
       
   248          * @param aTabbedView reference to view.
       
   249          * @param aKeyEventHandler Key event handler to be used
       
   250          * @param aCommandHandler reference to commandhandler
       
   251          * @param aServiceId Id of the service
       
   252          * @param aBrandHandler reference to brandhandler
       
   253          * @param aEngine reference to engine
       
   254          */    
       
   255         CVIMPSTUiSingleListBoxTabViewControl(   CVIMPSTUiTabbedView& aTabbedView,MPbk2KeyEventHandler* aKeyEventHandler,
       
   256                     							MVIMPSTCmdHandler& aCommandHandler,
       
   257                     							TUint32 aServiceId,
       
   258                     							CVIMPSTUiBrandData& aBrandHandler,
       
   259                     							MVIMPSTEngine& aEngine,
       
   260                     							CEikButtonGroupContainer* aCba);
       
   261         
       
   262         /**
       
   263          * Performs the 2nd phase of construction.
       
   264          * 
       
   265          */        
       
   266         void ConstructL();
       
   267 		
       
   268 		/**
       
   269          * Layouts current components according to AVKON LAF
       
   270 		 */
       
   271 		void SetLayout();
       
   272 		
       
   273 		
       
   274 		void SetFocusAndMakeItemVisible();
       
   275 		
       
   276     public:
       
   277         
       
   278         /**
       
   279         * Sets the iClrFindPaneFlag
       
   280         */
       
   281         void SetClrFindPaneFlag(TBool aFlag);
       
   282         
       
   283         /**
       
   284         * Checks if the last contact is focused and Sets the iLastItemFlag
       
   285         */            
       
   286         void CheckAndSetLastItemFlag(); 
       
   287        
       
   288         /**
       
   289          * returns the CCoeControl* pointer 
       
   290          */
       
   291         CCoeControl* CoeControl();
       
   292 
       
   293 		
       
   294 		
       
   295     private: // Data
       
   296     
       
   297     	// not owned
       
   298     	 CVIMPSTUiTabbedView& iTabbedView;
       
   299     	 
       
   300     	// Not owned: key event handler
       
   301     	MPbk2KeyEventHandler* iKeyEventHandler;
       
   302     	
       
   303     	//Holds the Ref to CMd Handler - Doesnt Own
       
   304     	MVIMPSTCmdHandler& iCommandHandler;
       
   305     	
       
   306     	//Doesnt Own
       
   307         MVIMPSTProcessArray& iArrayProcess;         
       
   308          
       
   309         //Service Id 
       
   310 		TUint32 iServiceId ;
       
   311 		
       
   312 		//doesnt own - Brand Handler
       
   313 		CVIMPSTUiBrandData& iBrandHandler;
       
   314 		
       
   315 		//doesnt own - Engine Handler
       
   316 		MVIMPSTEngine& iEngine;
       
   317 		   	
       
   318 
       
   319         // Owns. Listbox to view friends-list data
       
   320         CVIMPSTUiSingleStyleListBox* iListBox;
       
   321          
       
   322         // Owns. Search field.
       
   323 		CAknSearchField* iFindbox;
       
   324 		
       
   325 		// is find pane visible.
       
   326         TBool iFindPaneIsVisible;
       
   327         
       
   328         //current state
       
   329         TBool iCurrentState;
       
   330         
       
   331         // Owns: Flag to check whether the last contact was selected
       
   332         TBool iLastItemFlag;
       
   333  
       
   334         // CBA. not owned
       
   335         CEikButtonGroupContainer* iCba;     
       
   336 
       
   337         // Lock status foc softkeys
       
   338         TBool iCbaLock;
       
   339         
       
   340         // Storage for previous focus
       
   341         TVIMPSTEnums::TItem iLastFocusedItemType;
       
   342         
       
   343         //flag to check to clear find pane
       
   344         TBool iClrFindPaneFlag;
       
   345 
       
   346         //indicate command to be executed on enter key event
       
   347         TInt iCurrentCmdToExe;
       
   348     };
       
   349 
       
   350 #endif // __CVIMPSTUISINGLELISTBOXTABVIEWCONTROL_H
       
   351 
       
   352 // End of file