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