uiservicetab/vimpstui/inc/cvimpstuiblockviewcontrol.h
branchRCL_3
changeset 29 9a48e301e94b
parent 0 5e5d6b214f4f
equal deleted inserted replaced
28:3104fc151679 29:9a48e301e94b
       
     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 : block view control.
       
    15  *
       
    16 */
       
    17 
       
    18 #ifndef     __CVIMPSTUIBLOCKVIEWCONTROL_H
       
    19 #define     __CVIMPSTUIBLOCKVIEWCONTROL_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <eiklbo.h>
       
    23 #include <eikbtgpc.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CAknSingleGraphicStyleListBox;
       
    27 class MVIMPSTEngine;
       
    28 class MPbk2KeyEventHandler;
       
    29 class MVIMPSTCmdHandler;
       
    30 class CVIMPSTUiBlockView;
       
    31 // CLASS DECLARATION
       
    32 /**
       
    33  * Search view control. Shows search results
       
    34  *  @lib vimpstui.lib
       
    35  *  @since S60 v5.0 
       
    36  */
       
    37 class CVIMPSTUiBlockViewControl :  public CCoeControl,
       
    38                                 	public MEikListBoxObserver,
       
    39 									public MCoeControlObserver
       
    40     {
       
    41            
       
    42     public: // Constructor and destructor
       
    43         /**
       
    44          * Creates a new CVIMPSTUiBlockViewControl.
       
    45          * @param aBlockedView, reference to blocked view.
       
    46          * @param aKeyEventHandler, reference to keyeventhandler.
       
    47          * @param aEngine reference to engine.
       
    48          * @param aBlockedList pointer to block list.
       
    49          */
       
    50         static CVIMPSTUiBlockViewControl* NewL( CVIMPSTUiBlockView& aBlockedView,
       
    51                                                 MPbk2KeyEventHandler& aKeyEventHandler,
       
    52         										MVIMPSTEngine& aEngine,
       
    53         										RPointerArray<HBufC>* aBlockedList );
       
    54         
       
    55         /**
       
    56          * Creates a new CVIMPSTUiBlockViewControl and leaves it to
       
    57          * cleanup stack.
       
    58          * @see NewL
       
    59          */
       
    60         static CVIMPSTUiBlockViewControl* NewLC( CVIMPSTUiBlockView& aBlockedView,
       
    61                                                  MPbk2KeyEventHandler& aKeyEventHandler,
       
    62         										 MVIMPSTEngine& aEngine,
       
    63         										 RPointerArray<HBufC>* aBlockedList );
       
    64         
       
    65         /**
       
    66          * Destructor.
       
    67          */
       
    68         ~CVIMPSTUiBlockViewControl();
       
    69 
       
    70 	
       
    71     private: 
       
    72     
       
    73         /**
       
    74          * Standard C++ constructor
       
    75          * see NewL.
       
    76          */    
       
    77         CVIMPSTUiBlockViewControl( CVIMPSTUiBlockView& aBlockedView,
       
    78                                     MPbk2KeyEventHandler& aKeyEventHandler,
       
    79         							MVIMPSTEngine& aEngine,
       
    80         							RPointerArray<HBufC>* aBlockedList);
       
    81         
       
    82         /**
       
    83          * Performs the 2nd phase of construction.
       
    84          *
       
    85          */        
       
    86         void ConstructL();
       
    87 
       
    88     public: // New functions
       
    89     
       
    90 	   /**
       
    91         * sets the primary and secondary text of this view
       
    92         */
       
    93        void SetEmptyTextsToListboxL();
       
    94        
       
    95       /**
       
    96        * Updates the list box with blocked contact data
       
    97        */
       
    98        void UpdateBlockedListL();
       
    99       
       
   100       
       
   101        /**
       
   102         * returns the list box
       
   103         */
       
   104 		CEikListBox* ListBox() const;
       
   105 
       
   106        /**
       
   107         * extracts the contactId ,allocates memory for contactId and returns
       
   108         * Owership of the contactId is transfered to caller 
       
   109         * 
       
   110         * @return contactId  : Owenership to caller
       
   111         */    
       
   112         HBufC* GetFocusedContactLC() const;
       
   113 
       
   114 	    /**
       
   115          * Updates Softkeys according to current focus
       
   116          * Default value is false.
       
   117          */                     
       
   118         void UpdateCbaL();
       
   119         
       
   120 	    /**
       
   121          * @return,return current list box item index.
       
   122          */                     
       
   123         TInt GetCurrentIndex() const;
       
   124 
       
   125 		/**
       
   126 		* set focus on aIndex item.
       
   127 		* @param aIndex, Index of item.on which focus will set.
       
   128 		*/
       
   129 		void SetCurrentIndex(TInt aIndex);
       
   130 		
       
   131 		/**
       
   132 		* set the background text to indicate that retriving list from server..
       
   133 		*/
       
   134 		void SetUpdatingTextsToListboxL();
       
   135 
       
   136     private: // Functions MCoeControlObserver
       
   137     
       
   138     	/**
       
   139 	    * Handles events from findpane and forwards them to listbox filter.
       
   140 	    * @see MCoeControlObserver
       
   141 	    */
       
   142 	    void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType );  
       
   143 
       
   144         /**
       
   145         * From MEikListBoxObserver, Handles event's generated by listbox
       
   146         * @param aListBox Pointer to listbox from where this event originated
       
   147         * @param aEventType Type of event received.
       
   148         */
       
   149 		void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
       
   150 
       
   151         
       
   152         /**
       
   153         * From CoeControl, Returns the number of control contained by this class.
       
   154         * @return Number of controls contained
       
   155         */
       
   156         TInt CountComponentControls() const;
       
   157 
       
   158         /**
       
   159         * From CCoeControl, Returns handle to control pointed by aIndex
       
   160         * @param aIndex Wanted control's index [0..n]
       
   161         * @return Handle to wanted control
       
   162         */
       
   163         CCoeControl* ComponentControl( TInt aIndex ) const;
       
   164 
       
   165 		/**
       
   166         * From CCoeControl,respond to size chnaged
       
   167         */
       
   168 		void SizeChanged();
       
   169 		
       
   170         /**
       
   171         * From CCoeControl, Handles key-events
       
   172         * @param aEvent Event that occured
       
   173 		* @param aType Type of key-event (EEventKey, EEventKeyUp or EEventKeyDown)
       
   174         * @return Containers response to event (EKeyWasNotConsumed/ EKeyWasConsumed)
       
   175         */
       
   176 		TKeyResponse OfferKeyEventL( const TKeyEvent& aEvent, TEventCode aType );
       
   177 	   	
       
   178     private:    // Data
       
   179         
       
   180         //Not owned: reference to blocked view.
       
   181         CVIMPSTUiBlockView& iBlockedView;
       
   182         
       
   183     	// Not owned: key event handler
       
   184     	MPbk2KeyEventHandler& iKeyEventHandler;
       
   185     	
       
   186 	    //Owns
       
   187 		CAknSingleGraphicStyleListBox* iListBox;
       
   188 
       
   189       	//Owns
       
   190 		CDesCArray* iItemArray;
       
   191      	
       
   192         //Doesnt own - reference to engine for this service
       
   193         MVIMPSTEngine& iEngine;
       
   194         
       
   195         // CBA. not owned
       
   196         CEikButtonGroupContainer* iCba;     
       
   197 
       
   198 		//pointer to blocked list
       
   199 		RPointerArray<HBufC>* iBlockedList;//does not own..
       
   200         
       
   201         //store the focused list box item index.
       
   202         TInt iCurrentItemIndex;
       
   203 	};
       
   204 
       
   205 #endif      // __CVIMPSTUIBLOCKVIEWCONTROL_H
       
   206 
       
   207 // End of File