phoneapp/phoneuiview/inc/cphonetoolbarcontroller.h
branchRCL_3
changeset 62 5266b1f337bd
child 81 c26cc2a7c548
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phoneapp/phoneuiview/inc/cphonetoolbarcontroller.h	Wed Sep 01 12:30:10 2010 +0100
@@ -0,0 +1,226 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles the updating dialer, toolbar buttons.
+*
+*/
+
+
+#ifndef CPHONETOOLBARCONTROLLER_H
+#define CPHONETOOLBARCONTROLLER_H
+
+#include <e32base.h>
+#include <akntoolbarobserver.h>
+
+class CAknToolbar;
+class CCoeEnv;
+class TPhoneCommandParam;
+class CAknButton;
+class TAknsItemID;
+class TPhoneCommandParam;
+
+
+/**
+ *  Toolbar controller, updates toolbar buttons
+ *
+ *  @lib PhoneUIView.lib
+ *  @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CPhoneToolbarController ): 
+    public CBase, public MAknToolbarObserver 
+    {
+public:
+    /**
+     * Two-phased constructor.
+     * @param aCoeEnv 
+     * @param aMenuController 
+     */
+    static CPhoneToolbarController* NewL( CCoeEnv& aCoeEnv);
+    /**
+     * Destructor.
+     */
+    virtual ~CPhoneToolbarController();
+    
+     /**
+     * Updates toolbar buttons.
+     */
+    void UpdateToolbar();
+  
+
+    
+	/**
+    * Enables toolbar
+    */ 
+	void ShowToolbar();
+
+    /**
+    * Disables toolbar
+    */ 
+    void HideToolbar();	
+
+    /**
+    * Sets mute flag.
+    * @param aCommandParam command parameter
+    */        
+    void SetMuteFlag( TPhoneCommandParam* aCommandParam );
+
+    /**
+    * Sets integrated handsfree in use -flag.
+    * @param aCommandParam command parameter
+    */        
+    void SetIhfFlag( TPhoneCommandParam* aCommandParam );
+
+    /**
+    * Sets wired accessory in use -flag.
+    * @param aCommandParam command parameter
+    */        
+    void SetWiredAccFlag( TPhoneCommandParam* aCommandParam );
+
+    /**
+    * Sets Bluetooth accessory in use -flag.
+    * @param aCommandParam command parameter
+    */    
+    void SetBTAccFlag( TPhoneCommandParam* aCommandParam );
+
+    /**
+    * Sets Bluetooth accessory is available -flag.
+    * @param aCommandParam command parameter
+    */        
+    void SetBTAccAvailableFlag( TPhoneCommandParam* aCommandParam );
+
+    /**
+    * Sets call is in progress state -flag.
+    * @param aCommandParam command parameter
+    */        
+    void SetCallInProgressFlag( TPhoneCommandParam* aCommandParam ); 
+    
+    /**
+     * Dims (greys out) or undims all toolbar items.
+     *
+     * @param aDimmed Use ETrue to dim this toolbar item or EFalse to
+     *      un-dim this toolbar item.
+     */
+    void DimToolbar( const TBool aDimmed );
+    
+    /**
+     * Dims (greys out) or undims a toolbar item.
+     *
+     * @param aCommandId The command (as defined in an .hrh file)
+     *      associated with this toolbar item. This identifies the toolbar
+     *      item, whose text is to be dimmed or un-dimmed.
+     * @param aDimmed Use ETrue to dim this toolbar item or EFalse to
+     *      un-dim this toolbar item.
+     */
+    void SetToolbarButtonDimmed( const TInt aCommandId,
+                                 const TBool aDimmed );
+
+public:     // from MAknToolbarObserver
+    /**
+     * From base class MAknToolbarObserver
+     * Handles toolbar events for a certain toolbar item.
+     *
+     * @param aCommand The command ID of some toolbar item.
+     */ 
+    void OfferToolbarEventL( TInt aCommand );
+    
+    /**
+     * From base class MAknToolbarObserver
+     * Should be used to set the properties of some toolbar components 
+     * before it is drawn.
+     *   
+     * @param aResourceId The resource ID for particular toolbar
+     * @param aToolbar The toolbar object pointer
+     */
+    void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolbar );
+
+protected:
+    /**
+     * Constructor.
+     * 
+     * @param aCoeEnv 
+     */
+    CPhoneToolbarController( CCoeEnv& aCoeEnv );    
+    
+private:
+
+    /**
+     * Creates CAknButton with given parameters and leaves it to 
+     * CleanupStack.
+     * 
+     * @param aNormalIconId
+     * @param aNormalMaskId
+     * @param aTooltipText
+     * @param aSkinIconId
+     * @param aCommand 
+     */  
+    CAknButton* CreateButtonLC( TInt aNormalIconId,
+                                TInt aNormalMaskId,
+                                const TDesC& aTooltipText, 
+                                const TAknsItemID& aSkinIconId,
+                                TInt aCommand );
+    
+    
+    /**
+     * Symbian 2nd phase constructor.
+     * 
+     */
+    void ConstructL();
+    
+    /**
+     * Searches the tooltip text for the button using the 
+     * the given command id.
+     * 
+     * @param aCommandId the command id
+     * @param aText     the searched tooltip text
+     */
+    void  GetTooltipTextL( TInt aCommandId, HBufC*& aText ); 
+    
+    TAknsItemID GetSkinIdL( TInt aCommandId );
+
+        
+private: // data
+    /**
+     * AknToolbar. 
+     * Not own.  
+     */
+    CAknToolbar* iToolbar;
+
+    /**
+     * CoeEnv 
+     */
+    CCoeEnv& iCoeEnv;    
+    
+    // Muted or not
+    TBool iMuteFlag;
+    
+    // Integrated handsfree in use or not
+    TBool iIhfFlag;
+    
+    // Wired accessory in use or not
+    TBool iWiredAccFlag;
+    
+    // Bluetooth accessory in use or not
+    TBool iBTAccFlag;
+    
+    // Bluetooth accessory is available or not
+    TBool iBTAccAvailableFlag;
+    
+    // A call is progressing or not
+    TBool iCallInProgress;
+
+    // Dim activate IHF button
+    TBool iDimActivateIhf;
+    
+    };
+
+#endif // CPHONETOOLBARCONTROLLER_H