bluetoothengine/btui/Ecom/inc/BTUIDeviceContainer.h
branchRCL_3
changeset 56 9386f31cc85b
parent 0 f63038272f30
equal deleted inserted replaced
55:613943a21004 56:9386f31cc85b
       
     1 /*
       
     2 * Copyright (c) 2006-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:  The view that handles paired devices.
       
    15 *
       
    16 */
       
    17 #ifndef BTUIDEVICECONTAINER_H
       
    18 #define BTUIDEVICECONTAINER_H
       
    19 
       
    20 #include <aknview.h>                // AVKON components
       
    21 #include <aknlists.h>
       
    22 #include <aknPopup.h>               // Commands popup window
       
    23 #include <eikclbd.h>                // For column listbox access
       
    24 #include <AknIconArray.h>
       
    25 
       
    26 #include "btdevmodel.h"
       
    27 #include "btui.hrh"
       
    28 
       
    29 class CBTEngConnMan;
       
    30 class CAknView;
       
    31 class CBTDevModel;
       
    32 class CBTUIListedDevicesView;
       
    33 
       
    34 /**
       
    35 * This class displays lists of bluetooth devices.
       
    36 *
       
    37 * This class is used by blocked devices view and paired devices view to show
       
    38 * lists of blocked or paired devices.
       
    39 *
       
    40 *@lib BTUIPlugin.dll
       
    41 *@since S60 v3.2
       
    42 */
       
    43 NONSHARABLE_CLASS(CBTUiDeviceContainer) : public CCoeControl, 
       
    44 			public MCoeControlObserver,
       
    45 			public MEikListBoxObserver  
       
    46     {
       
    47     public: // Constructors and destructor
       
    48 
       
    49         /** Create new instance
       
    50 	     * @param aView PairedDevicesView or BlockedDevicesView.
       
    51 	     * @param aStorage The handler of 
       
    52 	     * @param aContainerMode are we serving as blocked or paired device list		
       
    53 	     * @param aParent used by SetMopParent
       
    54 		 */	
       
    55 		static CBTUiDeviceContainer* NewL(const TRect& aRect, 
       
    56 			CBTUIListedDevicesView* aView, TBTDeviceGroup aGroup, MObjectProvider* aParent);
       
    57 
       
    58 		/**
       
    59         * Destructor.
       
    60         */
       
    61         virtual ~CBTUiDeviceContainer();
       
    62 
       
    63     public: // Methods ralated devicelist upkeep.
       
    64 
       
    65 	     /** Refreshes this container to show these devices.
       
    66 	     * Note: This container will not refresh screen if the listed
       
    67 	     * devices have not changed.
       
    68 	     *@param aDeviceArray The items to be displayed
       
    69 	     *@param aSelectedItem which one of the items is selected after the refresh. 
       
    70 	     *Must be between 0 and aDeviceArray.Count()-1 or -1 if the list is empty.
       
    71 	     */
       
    72 	    void RefreshDeviceListL(const RDeviceArray* aDeviceArray,TInt aSelectedItem);
       
    73 
       
    74 	    /** Counts how many devices this container displays.     
       
    75 	     * @return the amount of items in this container
       
    76 	     */
       
    77 	    TInt CountItems();
       
    78 
       
    79 		/** 
       
    80 		 * Return the currently selected item index. KErrNotFound found if
       
    81 		 * this container has no items and therefore no selected item.
       
    82 		 *
       
    83 		 * @return index of currently selected item, or KErrNotFund if none.
       
    84 		 */
       
    85 		TInt CurrentItemIndex() ;   
       
    86 
       
    87    	private: 
       
    88 		/** 2nd phase constructor 
       
    89 	     * @param aView PairedDevicesView or BlockedDevicesView.
       
    90 	     * @param aStorage The handler of 
       
    91 	     * @param aContainerMode are we serving as blocked or paired device list		
       
    92 	     * @param aParent used by SetMopParent		
       
    93 		*/
       
    94 		void ConstructL(const TRect& aRect, CBTUIListedDevicesView* aView, TBTDeviceGroup aGroup);
       
    95 
       
    96         /**
       
    97         * From CoeControl Responds to size changes. 
       
    98         * Sets the size and position of the contents of this control.
       
    99         * @param None.
       
   100         * @return None.
       
   101         */
       
   102         void SizeChanged();
       
   103 
       
   104         /**
       
   105         * From CoeControl Gets the number of controls contained 
       
   106         * in a compound control.        
       
   107         * @param None.
       
   108         * @return The number of component controls contained by this control.
       
   109         */
       
   110         TInt CountComponentControls() const;
       
   111 
       
   112         /**
       
   113         * From CoeControl Gets the specified component of a compound control.
       
   114         * @param aIndex The index of the control to get.
       
   115         * @return Reference to the component control.
       
   116         */
       
   117         CCoeControl* ComponentControl(TInt aIndex) const;
       
   118 
       
   119         /**
       
   120         * From CoeControl Draws the control.
       
   121         * @param aRect The region of the control to be redrawn.
       
   122         * @return None.
       
   123         */
       
   124         void Draw(const TRect& aRect) const;
       
   125 
       
   126         /**
       
   127         * From CoeControl Handles key events.
       
   128         * @param aKeyEvent The key event that occurred.
       
   129         * @param aType The event type.
       
   130         * @return Response to the key event.
       
   131         */
       
   132         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);        
       
   133         
       
   134         /**
       
   135         * From MCoeControlObserver Handles an event from an observed control.
       
   136         * @param aControl The control that sent the event.
       
   137         * @param aEventType The event type.
       
   138         * @return None.
       
   139         */
       
   140         void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
       
   141 
       
   142 		/** returns help context or empty context, if help is not supported 
       
   143 		 */
       
   144 		void GetHelpContext(TCoeHelpContext& aContext) const;
       
   145         
       
   146         /**
       
   147 		* From CCoeControl
       
   148 		*
       
   149 		* Handles a change to the control's resources.
       
   150 		*/
       
   151 		void HandleResourceChange( TInt aType );
       
   152 
       
   153 		/**
       
   154         * From CCoeControl 
       
   155         *
       
   156         * Responds to a change in focus.
       
   157         */
       
   158 		void FocusChanged(TDrawNow aDrawNow);
       
   159 		
       
   160 		/**
       
   161         * From MEikListBoxObserver Handles list box events.
       
   162         * 
       
   163         * This is used to handle touch screen double click.
       
   164         *
       
   165         * @param aListBox The originating list box.
       
   166         * @param aEventType The event type.
       
   167         * @return None.
       
   168         */
       
   169         void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
       
   170 		
       
   171 
       
   172 		/** Create descriptor representation of given device
       
   173 		 * @param aDevice The device to be represented
       
   174 		 * @param aListItem where the representation will be written.
       
   175 		 */   
       
   176 		void CreateListItemL(const TBTDevice& aDevice, TBTDeviceName& alistItem);
       
   177 
       
   178 		/**
       
   179 	    * Creates and adds local bitmap to icon array.
       
   180 	    * @param aID Item ID of the masked bitmap to be created.
       
   181 	    * @param aFilename Filename to be used to construct the item.
       
   182 	    * @param aBitmapId The ID if bitmap 
       
   183 	    * @param aMaskId The ID of bitmap's mask
       
   184 		* @param aIconList The icon list for BT devices listbox.
       
   185 	    */
       
   186 	    void CreateAndAppendIconL( const TAknsItemID& aID,
       
   187 			     				   const TDesC& aFileName,
       
   188 								   const TInt aBitmapId,
       
   189 								   const TInt aMaskId,
       
   190 								   CAknIconArray* aIconList);
       
   191 	    /**
       
   192 	     * Internal leave function called by HandleResourceChange()
       
   193 	     * @param aType Type of resource change
       
   194 	     */
       
   195 	    void HandleResourceChangeL( TInt aType );
       
   196 	    
       
   197     private: 
       
   198         CAknSingleGraphicStyleListBox*  	iDeviceList;      // Other paired BT-devices list
       
   199 		CBTUIListedDevicesView*				iView;			// The reference to PairedDevicesView or BlockedDevicesView
       
   200 		TBTDeviceGroup						iGroup; 		// are we operating blocked or paired devices container
       
   201 
       
   202 	};
       
   203 
       
   204 #endif
       
   205 
       
   206