idlehomescreen/xmluirendering/renderingplugins/xnvolumecontrolfactory/src/xnvolumecontrol.cpp
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:  Implementation for wrapper for AknVolumeControl
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <coecntrl.h>
       
    21 #include "xncomponent.h"
       
    22 #include "xnvolumecontrol.h"
       
    23 #include "xnvolumecontroladapter.h"
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CXnText::NewL
       
    29 // Symbian static 1st phase constructor
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CXnVolumeControl* CXnVolumeControl::NewL()
       
    33     {
       
    34 	CXnVolumeControl* self = new( ELeave ) CXnVolumeControl;
       
    35 
       
    36     CleanupStack::PushL( self );
       
    37     self->ConstructL();
       
    38     CleanupStack::Pop();
       
    39 
       
    40     return self;	
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // CXnText::ConstructL
       
    45 // Symbian 2nd phase constructor can leave.
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 void CXnVolumeControl::ConstructL()
       
    49     {
       
    50     CXnComponent::ConstructL();
       
    51     }
       
    52     
       
    53 // -----------------------------------------------------------------------------
       
    54 // CXnText::ConstructL
       
    55 // C++ default constructor
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 CXnVolumeControl::CXnVolumeControl()
       
    59     {
       
    60     }
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CXnText::ConstructL
       
    64 // C++ destructor
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 CXnVolumeControl::~CXnVolumeControl()
       
    68     {
       
    69     }
       
    70     
       
    71 // -----------------------------------------------------------------------------
       
    72 // CXnVolumeControl::SetValue
       
    73 // -----------------------------------------------------------------------------
       
    74 //    
       
    75 void CXnVolumeControl::SetValue( TInt aValue )
       
    76 	{
       
    77 	TRAP_IGNORE( (static_cast<CXnVolumeControlAdapter*>( ControlAdapter() ) )->
       
    78 		SetValueL( aValue ) );
       
    79 	}
       
    80 	
       
    81 // -----------------------------------------------------------------------------
       
    82 // CXnVolumeControl::Value
       
    83 // -----------------------------------------------------------------------------
       
    84 //    	
       
    85 TInt CXnVolumeControl::Value()
       
    86 	{
       
    87 	TInt value = 0;
       
    88 	TRAPD( err, value = (static_cast<CXnVolumeControlAdapter*>( ControlAdapter() ) )->ValueL() );
       
    89 	if( !err )
       
    90 		{
       
    91 		return value;
       
    92 		}
       
    93 	else return KErrNotFound;
       
    94 	}
       
    95      
       
    96 // -----------------------------------------------------------------------------
       
    97 // CXnVolumeControl::SetRange
       
    98 // -----------------------------------------------------------------------------
       
    99 //         
       
   100 void CXnVolumeControl::SetRange( TInt aMinimumValue, TInt aMaximumValue )
       
   101 	{
       
   102 	TRAP_IGNORE( (static_cast<CXnVolumeControlAdapter*>( ControlAdapter() ) )->
       
   103 		SetRangeL( aMinimumValue, aMaximumValue ) );
       
   104 	}
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // CXnVolumeControl::GetRange
       
   108 // -----------------------------------------------------------------------------
       
   109 //    
       
   110 void CXnVolumeControl::GetRange( TInt& aMinimumValue, TInt& aMaximumValue )
       
   111 	{
       
   112 	TRAP_IGNORE( (static_cast<CXnVolumeControlAdapter*>( ControlAdapter() ) )->
       
   113 		GetRangeL( aMinimumValue, aMaximumValue ) );
       
   114 	}
       
   115 	
       
   116 // -----------------------------------------------------------------------------
       
   117 // CXnVolumeControl::SetObserver
       
   118 // -----------------------------------------------------------------------------
       
   119 //  	
       
   120 void CXnVolumeControl::SetObserver( MXnVolumeControlObserver* aObserver )
       
   121     {
       
   122     (static_cast<CXnVolumeControlAdapter*>( ControlAdapter() ) )->SetObserver( aObserver );
       
   123     }
       
   124 
       
   125 // ---------------------------------------------------------
       
   126 // CXnVolumeControl::MakeInterfaceL
       
   127 // ---------------------------------------------------------
       
   128 XnComponentInterface::MXnComponentInterface* CXnVolumeControl::MakeInterfaceL(const TDesC8& aType)
       
   129     {
       
   130     if (aType != XnVolumeControlInterface::KType)
       
   131         {
       
   132         return NULL;
       
   133         }
       
   134     XnVolumeControlInterface::MXnVolumeControlInterface* volumeIF = static_cast<XnVolumeControlInterface::MXnVolumeControlInterface*>(this);
       
   135     return volumeIF;
       
   136     }