uifw/AvKon/src/AknVolumeSettingPage.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002 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: 
       
    15 *     Implements setting_volume_pane
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include "aknvolumesettingpage.h"
       
    21 #include "aknsettingpage.h"
       
    22 
       
    23 #include <aknlayoutscalable_avkon.cdl.h>
       
    24 
       
    25 #include <AknTasHook.h>
       
    26 //////////////////////////////////////////////////////////////////////
       
    27 // Construction/Destruction
       
    28 //////////////////////////////////////////////////////////////////////
       
    29 
       
    30 
       
    31 
       
    32 EXPORT_C CAknVolumeSettingPage::CAknVolumeSettingPage(
       
    33      TInt aResourceId, TInt& aVolume ):
       
    34 	 CAknSettingPage(aResourceId),iVolume(aVolume)
       
    35 	{
       
    36 	iBackupVolume = iVolume;
       
    37 	AKNTASHOOK_ADD( this, "CAknVolumeSettingPage" );
       
    38 	}
       
    39 
       
    40 EXPORT_C CAknVolumeSettingPage::CAknVolumeSettingPage(	
       
    41 								const TDesC* aSettingText, 
       
    42 								TInt aSettingNumber, 
       
    43 								TInt aControlType,
       
    44 								TInt aEditorResourceId, 
       
    45 								TInt aSettingPageResourceId, 
       
    46 								TInt& aVolume)
       
    47 								:	CAknSettingPage( 
       
    48 									aSettingText, 
       
    49 									aSettingNumber, 
       
    50 									aControlType, 
       
    51 									aEditorResourceId, 
       
    52 									aSettingPageResourceId ), 
       
    53 									iVolume( aVolume )
       
    54 	{
       
    55 	iBackupVolume = iVolume;
       
    56 	AKNTASHOOK_ADD( this, "CAknVolumeSettingPage" );
       
    57 	}
       
    58 
       
    59 /**
       
    60  * Destructor
       
    61  *
       
    62  */
       
    63 EXPORT_C CAknVolumeSettingPage::~CAknVolumeSettingPage()
       
    64 	{
       
    65 	AKNTASHOOK_REMOVE();
       
    66 	}
       
    67 
       
    68 EXPORT_C void CAknVolumeSettingPage::ConstructL()
       
    69 	{
       
    70 	BaseConstructL();
       
    71 	VolumeControl()->SetValue( iVolume );
       
    72 
       
    73 	// Construct an appropriate control context for the contained editor areas.
       
    74 	// Context produced is owned by CAknSettingPage. 
       
    75     SetEditedItemFrameIID( KAknsIIDQsnFrSetOpt, KAknsIIDQsnFrSetOptCenter );
       
    76 	}
       
    77 
       
    78 EXPORT_C void CAknVolumeSettingPage::UpdateSettingL()
       
    79 	{
       
    80 	iVolume = VolumeControl()->Value();
       
    81 	if( iSettingPageObserver )
       
    82 	    {
       
    83 		iSettingPageObserver->HandleSettingPageEventL(
       
    84 		        this, MAknSettingPageObserver::EEventSettingChanged);	
       
    85 		}
       
    86 	}
       
    87 
       
    88 EXPORT_C void CAknVolumeSettingPage::AcceptSettingL()
       
    89 	{
       
    90 	iVolume = VolumeControl()->Value();
       
    91 	}
       
    92 
       
    93 EXPORT_C void CAknVolumeSettingPage::RestoreOriginalSettingL()
       
    94 	{
       
    95 	iVolume = iBackupVolume;
       
    96 	}
       
    97 
       
    98 
       
    99 EXPORT_C CAknVolumeControl* CAknVolumeSettingPage::VolumeControl()
       
   100 	{
       
   101 	return STATIC_CAST( CAknVolumeControl*, EditorControl());
       
   102 	}
       
   103 
       
   104 EXPORT_C void CAknVolumeSettingPage::SizeChanged()
       
   105 	{
       
   106 	StandardSettingPageLayout();  // Must be part of any re-implementation
       
   107 
       
   108     TAknLayoutRect layoutRect;
       
   109     layoutRect.LayoutRect( CAknSettingPage::SettingItemContentRect( EFalse ),
       
   110                 AknLayoutScalable_Avkon::setting_volume_pane_copy1() );
       
   111     AknLayoutUtils::LayoutControl( EditorControl(), layoutRect.Rect(),
       
   112             AknLayoutScalable_Avkon::volume_set_pane_copy1() );
       
   113     
       
   114     TRect outerFrameRect( layoutRect.Rect() );
       
   115 	layoutRect.LayoutRect( outerFrameRect,
       
   116                            AknLayoutScalable_Avkon::set_opt_bg_pane_g1() );
       
   117 	SetEditedItemFrameRects( outerFrameRect, layoutRect.Rect() );
       
   118 	}
       
   119 
       
   120 EXPORT_C void CAknVolumeSettingPage::Draw(const TRect &aRect) const
       
   121     {
       
   122     BaseDraw(aRect);
       
   123 	// There is no pre-skins legacy drawing to suppress/allow here
       
   124 	// so there is nothing more to do here.
       
   125     }
       
   126 
       
   127 
       
   128 /**
       
   129  * Writes the internal state of the control and its components to aStream.
       
   130  * Does nothing in release mode.
       
   131  * Designed to be overidden and base called by subclasses.
       
   132  */
       
   133 #ifndef _DEBUG
       
   134 EXPORT_C void CAknVolumeSettingPage::WriteInternalStateL(
       
   135             RWriteStream& /*aWriteStream*/) const
       
   136 	{}
       
   137 #else
       
   138 EXPORT_C void CAknVolumeSettingPage::WriteInternalStateL(
       
   139             RWriteStream& aWriteStream) const
       
   140 	{
       
   141 	CAknSettingPage::WriteInternalStateL(aWriteStream);
       
   142 	}
       
   143 #endif
       
   144 
       
   145 EXPORT_C void CAknVolumeSettingPage::HandlePointerEventL(
       
   146                 const TPointerEvent& aPointerEvent) 
       
   147     { 
       
   148     CAknSettingPage::HandlePointerEventL(aPointerEvent); 
       
   149     }
       
   150 
       
   151 EXPORT_C void* CAknVolumeSettingPage::ExtensionInterface( TUid /*aInterface*/ ) 
       
   152     { 
       
   153     return NULL;
       
   154     }
       
   155 
       
   156 /**
       
   157  *	Reserved method derived from CCoeControl
       
   158  */
       
   159 EXPORT_C void CAknVolumeSettingPage::Reserved_2()
       
   160 	{
       
   161 	}
       
   162 
       
   163 /**
       
   164 * Setting Page reserved methods 
       
   165 */ 
       
   166 EXPORT_C void CAknVolumeSettingPage::CAknSettingPage_Reserved_1()
       
   167 	{
       
   168 	}
       
   169 EXPORT_C void CAknVolumeSettingPage::CAknSettingPage_Reserved_2()
       
   170 	{
       
   171 	}
       
   172 
       
   173 // End of File