uifw/AvKon/src/AknTransparentCameraSettingPage.cpp
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
equal deleted inserted replaced
55:aecbbf00d063 56:d48ab3b357f1
     1 /*
     1 /*
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    14 * Description: 
    14 * Description: 
    15 *  Support for transparent camera setting pages
    15 *  Support for transparent camera setting pages
    16 *
    16 *
    17 *
    17 *
    18 */
    18 */
    19 
       
    20 
    19 
    21 #include "AknTransparentCameraSettingPage.h"
    20 #include "AknTransparentCameraSettingPage.h"
    22 
    21 
    23 // For icon support
    22 // For icon support
    24 #include <barsread.h>
    23 #include <barsread.h>
   171 EXPORT_C void CAknTransparentCameraSettingPage::ConstructL()
   170 EXPORT_C void CAknTransparentCameraSettingPage::ConstructL()
   172     {
   171     {
   173     BaseConstructL( KAknSettingPageNoEmbeddedSoftKeys );
   172     BaseConstructL( KAknSettingPageNoEmbeddedSoftKeys );
   174     
   173     
   175     SetDrawBackground(EFalse);  // Enable transparent drawing
   174     SetDrawBackground(EFalse);  // Enable transparent drawing
       
   175     if( CAknEnv::Static()->TransparencyEnabled() )
       
   176         {
       
   177         // try to enable window transparency
       
   178         if ( Window().SetTransparencyAlphaChannel() == KErrNone )
       
   179             {
       
   180             Window().SetRequiredDisplayMode( EColor16MA );
       
   181             Window().SetBackgroundColor( ~0 );
       
   182             }
       
   183         }
   176     
   184     
   177     GenerateInternalArrayAndGiveToListBoxL();
   185     GenerateInternalArrayAndGiveToListBoxL();
   178     
   186     
   179     iExtension = CAknTransparentCameraSettingPageExtension::NewL( *this );
   187     iExtension = CAknTransparentCameraSettingPageExtension::NewL( *this );
   180 
   188 
   215 
   223 
   216     listBox->SetListBoxObserver(this);
   224     listBox->SetListBoxObserver(this);
   217 
   225 
   218     // Set the current "pushed in" indication
   226     // Set the current "pushed in" indication
   219     if ( iCurrentSelectionIndex != -1 )
   227     if ( iCurrentSelectionIndex != -1 )
   220         listBox->View()->SelectItemL( iCurrentSelectionIndex );
   228     	{
       
   229     	//
       
   230     	// SelectItemL make the view item drawn by default, SetDisableRedraw can remove flick
       
   231     	//
       
   232     	TBool bRedrawDisabled = listBox->View()->RedrawDisabled();
       
   233     	listBox->View()->SetDisableRedraw( ETrue );
       
   234 
       
   235     	listBox->View()->SelectItemL( iCurrentSelectionIndex );
       
   236     	listBox->View()->SetDisableRedraw( bRedrawDisabled );
       
   237     	}
   221 
   238 
   222     // Set the scroller indication off
   239     // Set the scroller indication off
   223     listBox->CreateScrollBarFrameL(ETrue);
   240     listBox->CreateScrollBarFrameL(ETrue);
   224     listBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EOff);
   241     listBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EOff);
   225 
   242 
   226     // Need to do this to set up the scroll bar model
   243     // Need to do this to set up the scroll bar model
   227     listBox->UpdateScrollBarsL();
   244     listBox->UpdateScrollBarsL();
   228     
   245     
   229     if(!IsBackgroundDrawingEnabled())
   246     if(!IsBackgroundDrawingEnabled())
   230             listBox->ScrollBarFrame()->DrawBackground(EFalse, EFalse);
   247     	{
       
   248     	listBox->ScrollBarFrame()->DrawBackground(EFalse, EFalse);	
       
   249     	}
   231     
   250     
   232 
   251 
   233     // Force a size changed
   252     // Force a size changed
   234     SizeChanged();
   253     SizeChanged();
   235 
   254 
   337     HideMenu();
   356     HideMenu();
   338 
   357 
   339     // Respond to softkey events
   358     // Respond to softkey events
   340     switch (aCommandId)
   359     switch (aCommandId)
   341         {
   360         {
       
   361         case EAknSoftkeySelect:
       
   362             {
       
   363             if ( EnableSingleClickHighlight( aCommandId ) )
       
   364                 {
       
   365                 break;                           
       
   366                 } 
       
   367             // no single click mode was enabled, fall through
       
   368             }
   342         case EAknSoftkeyOk:
   369         case EAknSoftkeyOk:
   343         case EAknSoftkeySelect:  
   370         case EAknSoftkeyDone:                    
   344         case EAknSoftkeyDone:
       
   345             SelectCurrentItemL(); // has non-trivial implemenations in listbox type 
   371             SelectCurrentItemL(); // has non-trivial implemenations in listbox type 
   346                                         // controls to put the selection on the current item
   372                                         // controls to put the selection on the current item
   347             AttemptExitL(ETrue);
   373             AttemptExitL(ETrue);
   348             break;
   374             break;
   349         case EAknSoftkeyBack:
   375         case EAknSoftkeyBack:
   381             // it must be reverted back to represent the same item as
   407             // it must be reverted back to represent the same item as
   382             // the current selection in the setting page.
   408             // the current selection in the setting page.
   383             // Only in single click enabled applications.
   409             // Only in single click enabled applications.
   384             if ( iExtension &&
   410             if ( iExtension &&
   385                  iExtension->iFlags.IsSet(
   411                  iExtension->iFlags.IsSet(
   386                          CAknTransparentCameraSettingPageExtension::ESingleClickEnabled ) )
   412                      CAknTransparentCameraSettingPageExtension::ESingleClickEnabled ) &&
       
   413                  iCurrentSelectionIndex >= 0 &&
       
   414                  iCurrentSelectionIndex < ListBoxControl()->Model()->NumberOfItems() )
   387                 {
   415                 {
   388                 ListBoxControl()->View()->SetCurrentItemIndex(
   416                 ListBoxControl()->View()->SetCurrentItemIndex(
   389                     iCurrentSelectionIndex );
   417                     iCurrentSelectionIndex );
   390                 }
   418                 }
   391             break;
   419             break;
   541                                            NULL, 
   569                                            NULL, 
   542                                            gc,
   570                                            gc,
   543                                            parentRect.iTl,
   571                                            parentRect.iTl,
   544                                            parentRect,                                       
   572                                            parentRect,                                       
   545                                            KAknsDrawParamDefault);
   573                                            KAknsDrawParamDefault);
   546             }
       
   547         else
       
   548             {
       
   549             gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
   550             gc.SetPenStyle(CGraphicsContext::ENullPen);
       
   551             gc.SetBrushColor(KRgbWhite);
       
   552             gc.DrawRect (bgRect);
       
   553             }
   574             }
   554         }
   575         }
   555         
   576         
   556     // draw viewfinder if available
   577     // draw viewfinder if available
   557 	if(iExtension->iBackground)
   578 	if(iExtension->iBackground)