uifw/AvKon/src/AknSliderSettingPage.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 *     Implementation of setting_slider_pane
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include "aknslidersettingpage.h"
       
    21 #include "aknsettingpage.h"
       
    22 #include <aknlayoutscalable_avkon.cdl.h>
       
    23 #include <aknappui.h>
       
    24 
       
    25 #include <AknTasHook.h>
       
    26 //////////////////////////////////////////////////////////////////////
       
    27 // Construction/Destruction
       
    28 //////////////////////////////////////////////////////////////////////
       
    29 
       
    30 
       
    31 EXPORT_C CAknSliderSettingPage::CAknSliderSettingPage( TInt aResourceId, TInt& aSliderValue ):
       
    32 	 CAknSettingPage(aResourceId),iSliderValue(aSliderValue)
       
    33 	{
       
    34 	iBackupSliderValue = iSliderValue;
       
    35 	AKNTASHOOK_ADD( this, "CAknSliderSettingPage" );
       
    36 	}
       
    37 
       
    38 EXPORT_C CAknSliderSettingPage::CAknSliderSettingPage(	
       
    39 								const TDesC* aSettingText, 
       
    40 								TInt aSettingNumber, 
       
    41 								TInt aControlType,
       
    42 								TInt aEditorResourceId, 
       
    43 								TInt aSettingPageResourceId, 
       
    44 								TInt& aSliderValue)
       
    45 								:	CAknSettingPage( 
       
    46 									aSettingText, 
       
    47 									aSettingNumber, 
       
    48 									aControlType, 
       
    49 									aEditorResourceId, 
       
    50 									aSettingPageResourceId ), 
       
    51 									iSliderValue( aSliderValue )
       
    52 	{
       
    53 	iBackupSliderValue = iSliderValue;
       
    54 	AKNTASHOOK_ADD( this, "CAknSliderSettingPage" );
       
    55 	}
       
    56 
       
    57 /**
       
    58  * Destructor
       
    59  *
       
    60  */
       
    61 EXPORT_C CAknSliderSettingPage::~CAknSliderSettingPage()
       
    62 	{
       
    63 	AKNTASHOOK_REMOVE();
       
    64 	}
       
    65 
       
    66 EXPORT_C void CAknSliderSettingPage::ConstructL()
       
    67 	{
       
    68 	BaseConstructL();
       
    69 	SliderControl()->SetValueL( iSliderValue );
       
    70 
       
    71 	// Construct an appropriate control context for the contained editor areas.
       
    72 	// Context produced is owned by CAknSettingPage. 
       
    73     SetEditedItemFrameIID( KAknsIIDQsnFrSetOpt, KAknsIIDQsnFrSetOptCenter );
       
    74 	}
       
    75 
       
    76 EXPORT_C void CAknSliderSettingPage::UpdateSettingL()
       
    77 	{
       
    78 	iSliderValue = SliderControl()->Value();
       
    79 	if( iSettingPageObserver )
       
    80 		iSettingPageObserver->HandleSettingPageEventL(this, MAknSettingPageObserver::EEventSettingChanged);	
       
    81 
       
    82 	}
       
    83 
       
    84 EXPORT_C void CAknSliderSettingPage::AcceptSettingL()
       
    85 	{
       
    86 	iSliderValue = SliderControl()->Value();
       
    87 	if( iSettingPageObserver )
       
    88 		iSettingPageObserver->HandleSettingPageEventL(this, MAknSettingPageObserver::EEventSettingChanged);	
       
    89 
       
    90 	}
       
    91 
       
    92 EXPORT_C void CAknSliderSettingPage::RestoreOriginalSettingL()
       
    93 	{
       
    94 	iSliderValue = iBackupSliderValue;
       
    95 	}
       
    96 
       
    97 
       
    98 EXPORT_C CAknSlider* CAknSliderSettingPage::SliderControl()
       
    99 	{
       
   100 	return STATIC_CAST( CAknSlider*, EditorControl());
       
   101 	}
       
   102 
       
   103 
       
   104 EXPORT_C void CAknSliderSettingPage::SizeChanged()
       
   105 	{
       
   106 	StandardSettingPageLayout();  // Must be part of any re-implementation
       
   107     AknLayoutUtils::LayoutControl(
       
   108             EditorControl(),
       
   109             CAknSettingPage::SettingItemContentRect( EFalse ),
       
   110             AknLayoutScalable_Avkon::setting_slider_graphic_pane_copy1() );
       
   111     
       
   112     TRect frameOuterRect( EditorControl()->Rect() );
       
   113     TAknLayoutRect innerLayoutRect;
       
   114     innerLayoutRect.LayoutRect(
       
   115         frameOuterRect,
       
   116         AknLayoutScalable_Avkon::set_opt_bg_pane_g1() );
       
   117 
       
   118     SetEditedItemFrameRects( frameOuterRect, innerLayoutRect.Rect() );
       
   119 	}
       
   120 
       
   121 EXPORT_C void CAknSliderSettingPage::Draw(const TRect &aRect) const
       
   122     {
       
   123     BaseDraw(aRect);
       
   124 	// There is no pre-skins legacy drawing to suppress/allow here so there is nothing
       
   125 	// more to do here.
       
   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 CAknSliderSettingPage::WriteInternalStateL(RWriteStream& /*aWriteStream*/) const
       
   135 	{}
       
   136 #else
       
   137 EXPORT_C void CAknSliderSettingPage::WriteInternalStateL(RWriteStream& aWriteStream) const
       
   138 	{
       
   139 	CAknSettingPage::WriteInternalStateL(aWriteStream);
       
   140 	}
       
   141 #endif
       
   142 
       
   143 EXPORT_C void CAknSliderSettingPage::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
       
   144     { 
       
   145     CAknSettingPage::HandlePointerEventL(aPointerEvent); 
       
   146     }
       
   147 
       
   148 EXPORT_C void* CAknSliderSettingPage::ExtensionInterface( TUid /*aInterface*/ ) 
       
   149     { 
       
   150     return NULL;
       
   151     }
       
   152 
       
   153 /**
       
   154  *	Reserved method derived from CCoeControl
       
   155  */
       
   156 EXPORT_C void CAknSliderSettingPage::Reserved_2()
       
   157 	{
       
   158 	}
       
   159 
       
   160 /**
       
   161 * Setting Page reserved methods 
       
   162 */ 
       
   163 EXPORT_C void CAknSliderSettingPage::CAknSettingPage_Reserved_1()
       
   164 	{
       
   165 	}
       
   166 EXPORT_C void CAknSliderSettingPage::CAknSettingPage_Reserved_2()
       
   167 	{
       
   168 	}
       
   169 
       
   170 
       
   171 // End of File