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