idlehomescreen/xmluirendering/renderingplugins/xnvolumecontrolfactory/inc/xnvolumecontroladapter.h
changeset 0 f72a12da539e
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2005-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:  Wrapper class for AknVolumeControl
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef _XNVOLUMECONTROLADAPTER_H
       
    20 #define _XNVOLUMECONTROLADAPTER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include "xncontroladapter.h"
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CXnNodePluginIf;
       
    28 class MXnVolumeControlObserver;
       
    29 class CAknVolumeControl;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 /**
       
    33 *  @ingroup group_xnvolumecontrolfactory
       
    34 *  @lib xnvolumecontrol.lib
       
    35 *  @since Series 60 3.2
       
    36 */
       
    37 class CXnVolumeControlAdapter : public CXnControlAdapter, public MCoeControlBackground
       
    38    {
       
    39 public:
       
    40 	/**
       
    41 	 * 2 phase construction.
       
    42 	 */
       
    43 	static CXnVolumeControlAdapter* NewL(CXnControlAdapter* aParent, CXnNodePluginIf& aNode);
       
    44 
       
    45 	/**
       
    46 	 * Destructor.
       
    47 	 */
       
    48 	virtual ~CXnVolumeControlAdapter();
       
    49 
       
    50 public: // New functions
       
    51     /**
       
    52     * Sets the value of the volume control
       
    53     * @param aValue new value
       
    54     */
       
    55 	void SetValueL( TInt aValue );
       
    56 	
       
    57     /**
       
    58     * Returns the value of the volume control
       
    59     */	
       
    60 	TInt ValueL();
       
    61 	
       
    62     /**
       
    63     * Sets the range for the volume control
       
    64     * @param aMinimumValue Minimum value
       
    65     * @param aMaximumValue Maximum value
       
    66     */	
       
    67 	void SetRangeL( TInt aMimimumValue, TInt aMaximumValue );
       
    68 	
       
    69     /**
       
    70     * Returns the minimum and maximum value of the volume control range
       
    71     * @param aMinimumValue minimum value reference
       
    72     * @param aMaximumValue maximum value reference
       
    73     */	
       
    74 	void GetRangeL( TInt& aMinimumValue, TInt& aMaximumValue );
       
    75 	
       
    76 	/**
       
    77 	* Sets the observer for the volume control
       
    78 	* @param pointer to the observer
       
    79 	*/ 
       
    80 	void SetObserver( MXnVolumeControlObserver* aObserver );
       
    81 	
       
    82 public: // from base classes
       
    83 
       
    84     /**
       
    85     * From CXnControlAdapter Handles the property changes.
       
    86     * @since Series 60 3.1
       
    87     * @return void.
       
    88     */  
       
    89     void DoHandlePropertyChangeL( CXnProperty* aProperty = NULL ); 
       
    90     
       
    91     /**
       
    92     * From CCoeControl Handles the resource change.
       
    93     * @since Series 60 3.1
       
    94     * @param aType A type of the resource change
       
    95     * @return void.
       
    96     */
       
    97     void HandleScreenDeviceChangedL();
       
    98 
       
    99     /**
       
   100     * See CCoeControl documentation
       
   101     */    	
       
   102     void HandlePointerEventL( const TPointerEvent& aPointerEvent );
       
   103     
       
   104     /**
       
   105     * See CCoeControl documentation
       
   106     */    
       
   107     void SizeChanged();
       
   108     
       
   109     /**
       
   110     * See CCoeControl documentation
       
   111     */    
       
   112     TInt CountComponentControls() const;
       
   113     
       
   114     /**
       
   115     * See CCoeControl documentation
       
   116     */    
       
   117     CCoeControl* ComponentControl( TInt aIndex ) const;
       
   118 
       
   119   	/**
       
   120     * From MCoeControlBackground. Draws the background for a given control.
       
   121     * @param aGc Graphics context used for drawing.
       
   122     * @param aControl The control being drawn.
       
   123     * @param aRect The area to be redrawn.
       
   124   	*/
       
   125   	void Draw( CWindowGc& aGc, const CCoeControl& aControl,
       
   126   	           const TRect& aRect ) const;
       
   127 
       
   128 private:
       
   129 	CXnVolumeControlAdapter(CXnControlAdapter* aParent, CXnNodePluginIf& aNode);
       
   130 	
       
   131 	void ConstructL();
       
   132 	
       
   133     virtual void Draw(const TRect& aRect) const;
       
   134     
       
   135     /**
       
   136     * Returns the current volume value from property
       
   137     */
       
   138     TInt GetCurrentValueL();
       
   139     
       
   140     /**
       
   141     * Notifies the observer with new volume value
       
   142     */
       
   143     void NotifyObserverL();
       
   144 
       
   145 	/**
       
   146 	 * Sets volume control CSS properties
       
   147      * @param aNode UI Node
       
   148      * @return void
       
   149 	 */
       
   150 	void SetVolumeControlPropertiesL();
       
   151 	
       
   152 	/**
       
   153 	* Constructs the volume control component from resource
       
   154 	*/
       
   155 	void ConstructVolumeControlL();
       
   156 	
       
   157 private:
       
   158     CXnControlAdapter*  		iParent;        // Parent control, not owned
       
   159     CXnNodePluginIf&    		iNode;          // UI node, not owned
       
   160     CAknVolumeControl*			iVolumeControl; // Avkon Volume control. Owned.
       
   161     MXnVolumeControlObserver*   iObserver;      // Observer. Not owned.
       
   162     TRect                       iHitRect;       // Rect where pointer event previously hit
       
   163     TInt                        iSteps;         // number of steps
       
   164     TInt                        iMutedValue;    // previous value when muted
       
   165     TBool                       iMuted;         // is muted?    
       
   166     TBool                       iButton1Down;   // Button 1 is pressed down
       
   167     
       
   168    };
       
   169 
       
   170 #endif      // _XNVOLUMECONTROLADAPTER_H
       
   171             
       
   172 // End of File