phoneapp/phoneuiview/inc/cphonetoolbarcontroller.h
branchRCL_3
changeset 62 5266b1f337bd
child 81 c26cc2a7c548
equal deleted inserted replaced
61:41a7f70b3818 62:5266b1f337bd
       
     1 /*
       
     2 * Copyright (c) 2007-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:  Handles the updating dialer, toolbar buttons.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPHONETOOLBARCONTROLLER_H
       
    20 #define CPHONETOOLBARCONTROLLER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <akntoolbarobserver.h>
       
    24 
       
    25 class CAknToolbar;
       
    26 class CCoeEnv;
       
    27 class TPhoneCommandParam;
       
    28 class CAknButton;
       
    29 class TAknsItemID;
       
    30 class TPhoneCommandParam;
       
    31 
       
    32 
       
    33 /**
       
    34  *  Toolbar controller, updates toolbar buttons
       
    35  *
       
    36  *  @lib PhoneUIView.lib
       
    37  *  @since S60 v5.0
       
    38  */
       
    39 NONSHARABLE_CLASS( CPhoneToolbarController ): 
       
    40     public CBase, public MAknToolbarObserver 
       
    41     {
       
    42 public:
       
    43     /**
       
    44      * Two-phased constructor.
       
    45      * @param aCoeEnv 
       
    46      * @param aMenuController 
       
    47      */
       
    48     static CPhoneToolbarController* NewL( CCoeEnv& aCoeEnv);
       
    49     /**
       
    50      * Destructor.
       
    51      */
       
    52     virtual ~CPhoneToolbarController();
       
    53     
       
    54      /**
       
    55      * Updates toolbar buttons.
       
    56      */
       
    57     void UpdateToolbar();
       
    58   
       
    59 
       
    60     
       
    61 	/**
       
    62     * Enables toolbar
       
    63     */ 
       
    64 	void ShowToolbar();
       
    65 
       
    66     /**
       
    67     * Disables toolbar
       
    68     */ 
       
    69     void HideToolbar();	
       
    70 
       
    71     /**
       
    72     * Sets mute flag.
       
    73     * @param aCommandParam command parameter
       
    74     */        
       
    75     void SetMuteFlag( TPhoneCommandParam* aCommandParam );
       
    76 
       
    77     /**
       
    78     * Sets integrated handsfree in use -flag.
       
    79     * @param aCommandParam command parameter
       
    80     */        
       
    81     void SetIhfFlag( TPhoneCommandParam* aCommandParam );
       
    82 
       
    83     /**
       
    84     * Sets wired accessory in use -flag.
       
    85     * @param aCommandParam command parameter
       
    86     */        
       
    87     void SetWiredAccFlag( TPhoneCommandParam* aCommandParam );
       
    88 
       
    89     /**
       
    90     * Sets Bluetooth accessory in use -flag.
       
    91     * @param aCommandParam command parameter
       
    92     */    
       
    93     void SetBTAccFlag( TPhoneCommandParam* aCommandParam );
       
    94 
       
    95     /**
       
    96     * Sets Bluetooth accessory is available -flag.
       
    97     * @param aCommandParam command parameter
       
    98     */        
       
    99     void SetBTAccAvailableFlag( TPhoneCommandParam* aCommandParam );
       
   100 
       
   101     /**
       
   102     * Sets call is in progress state -flag.
       
   103     * @param aCommandParam command parameter
       
   104     */        
       
   105     void SetCallInProgressFlag( TPhoneCommandParam* aCommandParam ); 
       
   106     
       
   107     /**
       
   108      * Dims (greys out) or undims all toolbar items.
       
   109      *
       
   110      * @param aDimmed Use ETrue to dim this toolbar item or EFalse to
       
   111      *      un-dim this toolbar item.
       
   112      */
       
   113     void DimToolbar( const TBool aDimmed );
       
   114     
       
   115     /**
       
   116      * Dims (greys out) or undims a toolbar item.
       
   117      *
       
   118      * @param aCommandId The command (as defined in an .hrh file)
       
   119      *      associated with this toolbar item. This identifies the toolbar
       
   120      *      item, whose text is to be dimmed or un-dimmed.
       
   121      * @param aDimmed Use ETrue to dim this toolbar item or EFalse to
       
   122      *      un-dim this toolbar item.
       
   123      */
       
   124     void SetToolbarButtonDimmed( const TInt aCommandId,
       
   125                                  const TBool aDimmed );
       
   126 
       
   127 public:     // from MAknToolbarObserver
       
   128     /**
       
   129      * From base class MAknToolbarObserver
       
   130      * Handles toolbar events for a certain toolbar item.
       
   131      *
       
   132      * @param aCommand The command ID of some toolbar item.
       
   133      */ 
       
   134     void OfferToolbarEventL( TInt aCommand );
       
   135     
       
   136     /**
       
   137      * From base class MAknToolbarObserver
       
   138      * Should be used to set the properties of some toolbar components 
       
   139      * before it is drawn.
       
   140      *   
       
   141      * @param aResourceId The resource ID for particular toolbar
       
   142      * @param aToolbar The toolbar object pointer
       
   143      */
       
   144     void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolbar );
       
   145 
       
   146 protected:
       
   147     /**
       
   148      * Constructor.
       
   149      * 
       
   150      * @param aCoeEnv 
       
   151      */
       
   152     CPhoneToolbarController( CCoeEnv& aCoeEnv );    
       
   153     
       
   154 private:
       
   155 
       
   156     /**
       
   157      * Creates CAknButton with given parameters and leaves it to 
       
   158      * CleanupStack.
       
   159      * 
       
   160      * @param aNormalIconId
       
   161      * @param aNormalMaskId
       
   162      * @param aTooltipText
       
   163      * @param aSkinIconId
       
   164      * @param aCommand 
       
   165      */  
       
   166     CAknButton* CreateButtonLC( TInt aNormalIconId,
       
   167                                 TInt aNormalMaskId,
       
   168                                 const TDesC& aTooltipText, 
       
   169                                 const TAknsItemID& aSkinIconId,
       
   170                                 TInt aCommand );
       
   171     
       
   172     
       
   173     /**
       
   174      * Symbian 2nd phase constructor.
       
   175      * 
       
   176      */
       
   177     void ConstructL();
       
   178     
       
   179     /**
       
   180      * Searches the tooltip text for the button using the 
       
   181      * the given command id.
       
   182      * 
       
   183      * @param aCommandId the command id
       
   184      * @param aText     the searched tooltip text
       
   185      */
       
   186     void  GetTooltipTextL( TInt aCommandId, HBufC*& aText ); 
       
   187     
       
   188     TAknsItemID GetSkinIdL( TInt aCommandId );
       
   189 
       
   190         
       
   191 private: // data
       
   192     /**
       
   193      * AknToolbar. 
       
   194      * Not own.  
       
   195      */
       
   196     CAknToolbar* iToolbar;
       
   197 
       
   198     /**
       
   199      * CoeEnv 
       
   200      */
       
   201     CCoeEnv& iCoeEnv;    
       
   202     
       
   203     // Muted or not
       
   204     TBool iMuteFlag;
       
   205     
       
   206     // Integrated handsfree in use or not
       
   207     TBool iIhfFlag;
       
   208     
       
   209     // Wired accessory in use or not
       
   210     TBool iWiredAccFlag;
       
   211     
       
   212     // Bluetooth accessory in use or not
       
   213     TBool iBTAccFlag;
       
   214     
       
   215     // Bluetooth accessory is available or not
       
   216     TBool iBTAccAvailableFlag;
       
   217     
       
   218     // A call is progressing or not
       
   219     TBool iCallInProgress;
       
   220 
       
   221     // Dim activate IHF button
       
   222     TBool iDimActivateIhf;
       
   223     
       
   224     };
       
   225 
       
   226 #endif // CPHONETOOLBARCONTROLLER_H