vtuis/videotelui/src/features/prefs/cvtuitransparentsettingpage.cpp
branchRCL_3
changeset 24 f15ac8e65a02
parent 23 890b5dd735f8
child 25 779871d1e4f4
equal deleted inserted replaced
23:890b5dd735f8 24:f15ac8e65a02
     1 /*
       
     2 * Copyright (c) 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:  Transparent camera setting page.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "cvtuitransparentsettingpage.h"
       
    21 #include "mvtuisettingpageobserver.h"
       
    22 #include "VtUiLayout.h"
       
    23 #include <cvtlogger.h>
       
    24 #include <aknsettingpage.h>
       
    25 #include <aknlayoutscalable_apps.cdl.h>
       
    26 #include <layoutmetadata.cdl.h>
       
    27 
       
    28 
       
    29 /**
       
    30 *  CVtUiTransparentSettingPage
       
    31 *
       
    32 *  Transparent camera setting page. Extends class CAknTransparentCameraSettingPage
       
    33 *  with position related functionality.
       
    34 *
       
    35 *  @since S60 v3.2
       
    36 */
       
    37 void CVtUiTransparentSettingPage::HandleLayoutChangeL()
       
    38     {
       
    39     GetTheLayoutData();
       
    40     }
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // CVtUiTransparentSettingPage::CVtUiTransparentSettingPage
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 CVtUiTransparentSettingPage::CVtUiTransparentSettingPage( TInt aResourceID, 
       
    47      TInt& aCurrentSelectionIndex, const MDesCArray* aItemArray) :
       
    48      CAknTransparentCameraSettingPage( aResourceID,
       
    49      aCurrentSelectionIndex, aItemArray )
       
    50      {
       
    51      }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CVtUiTransparentSettingPage::ConstructL
       
    55 // -----------------------------------------------------------------------------
       
    56 //            
       
    57 void CVtUiTransparentSettingPage::ConstructL()
       
    58     {
       
    59     CAknTransparentCameraSettingPage::ConstructL();
       
    60     }
       
    61     
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CVtUiTransparentSettingPage::~CVtUiTransparentSettingPage
       
    65 // -----------------------------------------------------------------------------
       
    66 //            
       
    67 CVtUiTransparentSettingPage::~CVtUiTransparentSettingPage()
       
    68     {
       
    69     }
       
    70 
       
    71 // -----------------------------------------------------------------------------
       
    72 // CVtUiNumberEntryControl::SetNumberEntryControlObserver
       
    73 // -----------------------------------------------------------------------------
       
    74 //
       
    75 void CVtUiTransparentSettingPage::SetSettingPageEventStateObserver( 
       
    76     MVtUiSettingPageObserver* aObserver )
       
    77     {
       
    78     iSettingPageObserver = aObserver;
       
    79     }
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CVtUiTransparentSettingPage::GetTheLayoutData
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 void CVtUiTransparentSettingPage::GetTheLayoutData()
       
    86     {
       
    87     // Varieties
       
    88     TInt labelVariety = 6;
       
    89     TInt listboxVariety = 6;
       
    90 
       
    91     if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
    92         {
       
    93         labelVariety = 5;
       
    94         listboxVariety = 5;
       
    95         }
       
    96        
       
    97     // Rect for label and shadow text   
       
    98     TRect labelRect = RectFromLayout( AknLayoutScalable_Apps::
       
    99        aid_placing_vt_set_title( labelVariety ) );
       
   100     
       
   101     // Rect for listbox control
       
   102     TRect listBoxRect = RectFromLayout( AknLayoutScalable_Apps::
       
   103         aid_placing_vt_set_content( listboxVariety ) );
       
   104    
       
   105      // Get text label from parent class
       
   106     CEikLabel* textLabel = TextLabel();
       
   107    
       
   108     // Set label's new positions
       
   109     if ( textLabel )
       
   110     	{
       
   111     	textLabel->SetPosition( labelRect.iTl );	
       
   112     	}
       
   113     
       
   114     // Get shadow text from parent class
       
   115     CEikLabel* shadowText = ShadowText();
       
   116    
       
   117     // Set shadow text's new positions if shadow text exists
       
   118     if( shadowText )
       
   119         {
       
   120         // This information should come from layout, but
       
   121         // also AknSettingPage does the positioning in this way.
       
   122         labelRect.Move( 1, 1 );
       
   123         shadowText->SetPosition( labelRect.iTl );
       
   124         }
       
   125     
       
   126     // Set new rect for listbox control
       
   127     ListBoxControl()->SetRect( listBoxRect );
       
   128     }
       
   129     
       
   130 // -----------------------------------------------------------------------------
       
   131 // CVtUiTransparentSettingPage::DynamicInitL
       
   132 // -----------------------------------------------------------------------------
       
   133 //
       
   134 void CVtUiTransparentSettingPage::DynamicInitL()
       
   135   {
       
   136   	GetTheLayoutData();
       
   137   }
       
   138 
       
   139 // -----------------------------------------------------------------------------
       
   140 // CVtUiTransparentSettingPage::HandleControlEventL
       
   141 // -----------------------------------------------------------------------------
       
   142 //
       
   143 void CVtUiTransparentSettingPage::HandleControlEventL( CCoeControl* /*aControl*/,
       
   144     TCoeEvent aEventType )
       
   145     {
       
   146     __VTPRINTENTER( "CVtUiTransparentSettingPage.HandleControlEventL" )
       
   147      if ( aEventType == EEventStateChanged )
       
   148         {
       
   149         if ( iSettingPageObserver )
       
   150             {
       
   151             iSettingPageObserver->ListStateChangedL();
       
   152             }
       
   153         __VTPRINT( DEBUG_GEN, " CVtUiTransparentSettingPage.EEventStateChanged" )
       
   154         }
       
   155     
       
   156     __VTPRINTEXIT( "CVtUiTransparentSettingPage.HandleControlEventL" )
       
   157     }
       
   158 
       
   159 // -----------------------------------------------------------------------------
       
   160 // CVtUiTransparentSettingPage::HandleResourceChange
       
   161 // -----------------------------------------------------------------------------
       
   162 //
       
   163 void CVtUiTransparentSettingPage::HandleResourceChange(TInt aType)
       
   164     {
       
   165     CAknTransparentCameraSettingPage::HandleResourceChange(aType);
       
   166     GetTheLayoutData();
       
   167     }
       
   168 
       
   169 // -----------------------------------------------------------------------------
       
   170 // CVtUiTransparentSettingPage::RectFromLayout
       
   171 // -----------------------------------------------------------------------------
       
   172 // 
       
   173 TRect CVtUiTransparentSettingPage::RectFromLayout(
       
   174     const TAknWindowComponentLayout& aComponentLayout ) const
       
   175     {
       
   176     __VTPRINTENTER( "CVtUiTransparentSettingPage.RectFromLayout" )
       
   177       
       
   178     TInt main_pane_variety( 0 );
       
   179     if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
   180             {
       
   181             main_pane_variety = 4;
       
   182             }
       
   183 
       
   184     TAknWindowComponentLayout layout1 =
       
   185         AknLayoutScalable_Apps::main_pane( main_pane_variety );
       
   186     TAknWindowComponentLayout layout2 =
       
   187         AknLayoutScalable_Apps::main_video_tele_pane();
       
   188 
       
   189     TAknWindowLineLayout layout =
       
   190         TAknWindowComponentLayout::Compose(
       
   191          TAknWindowComponentLayout::Compose( layout1, layout2 ), aComponentLayout ).
       
   192             LayoutLine();
       
   193     
       
   194     TRect screen;
       
   195     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen );
       
   196     TAknLayoutRect layoutRect;
       
   197     layoutRect.LayoutRect( screen, layout );
       
   198     
       
   199     // setting page is window owning control and its position is relative to mainpane
       
   200     // layotdata is instead relative to screen
       
   201     TRect rect( layoutRect.Rect() ); 
       
   202     rect.Move( -PositionRelativeToScreen() );
       
   203     
       
   204     __VTPRINTEXIT( "CVtUiTransparentSettingPage.RectFromLayout" ) 
       
   205     return rect;
       
   206    }