idlehomescreen/xmluirendering/uiengine/src/xnbgcontrol.cpp
changeset 2 08c6ee43b396
parent 0 f72a12da539e
child 5 c743ef5928ba
equal deleted inserted replaced
1:5315654608de 2:08c6ee43b396
    67 // C++ default destructor.
    67 // C++ default destructor.
    68 // -----------------------------------------------------------------------------
    68 // -----------------------------------------------------------------------------
    69 //
    69 //
    70 CXnBgControl::~CXnBgControl()
    70 CXnBgControl::~CXnBgControl()
    71     {  
    71     {  
    72     delete iBgContext;
       
    73     }
    72     }
    74 
    73 
    75 // -----------------------------------------------------------------------------
    74 // -----------------------------------------------------------------------------
    76 // CXnBgControl::CXnBgControl()
    75 // CXnBgControl::CXnBgControl()
    77 // C++ default constructor.
    76 // C++ default constructor.
    87 // -----------------------------------------------------------------------------
    86 // -----------------------------------------------------------------------------
    88 //
    87 //
    89 void CXnBgControl::ConstructL()
    88 void CXnBgControl::ConstructL()
    90     {   
    89     {   
    91     CreateWindowL();
    90     CreateWindowL();
       
    91 
       
    92     TRgb backgroundColour = KRgbWhite;
       
    93     if( KErrNone == Window().SetTransparencyAlphaChannel() )      
       
    94         {       
       
    95         backgroundColour.SetAlpha( 0 );       
       
    96         }   
       
    97     Window().SetBackgroundColor( backgroundColour );
    92     
    98     
    93     EnableDragEvents();
    99     EnableDragEvents();
    94     
   100     
    95     Window().SetPointerGrab( ETrue );
   101     Window().SetPointerGrab( ETrue );
    96       
   102     
    97     iBgContext = CAknsLayeredBackgroundControlContext::NewL(
       
    98         KAknsIIDWallpaper, TRect(), ETrue, 1 );
       
    99     
   103     
   100     ActivateL();
   104     ActivateL();
   101 
   105 
   102     MakeVisible( ETrue );
   106     MakeVisible( ETrue );
   103     
   107     
   139 // 
   143 // 
   140 // -----------------------------------------------------------------------------
   144 // -----------------------------------------------------------------------------
   141 //
   145 //
   142 void CXnBgControl::SizeChanged()
   146 void CXnBgControl::SizeChanged()
   143     {
   147     {
   144     TRect rect;
       
   145     
       
   146 #ifdef RD_FULLSCREEN_WALLPAPER    
       
   147     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, rect );
       
   148 #else
       
   149     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
       
   150 #endif
       
   151        
       
   152     iBgContext->SetRect( rect );    
       
   153     }
   148     }
   154 
   149 
   155 // -----------------------------------------------------------------------------
   150 // -----------------------------------------------------------------------------
   156 // CXnBgControl::Draw()
   151 // CXnBgControl::Draw()
   157 // 
   152 // 
   169     if ( state == CXnEditMode::EShootContent )
   164     if ( state == CXnEditMode::EShootContent )
   170         {
   165         {
   171         // No background needed for dragging widget screenshot        
   166         // No background needed for dragging widget screenshot        
   172         }
   167         }
   173     else
   168     else
   174         {
   169         {        
   175         MAknsSkinInstance* skin( AknsUtils::SkinInstance() );
   170         gc.Clear( aRect );        
   176                
       
   177         AknsDrawUtils::Background( skin, iBgContext, this, gc, aRect );        
       
   178         }          
   171         }          
   179     }
   172     }
   180 
   173 
   181 // -----------------------------------------------------------------------------
   174 // -----------------------------------------------------------------------------
   182 // CXnBgControl::SetCompoundControl()
   175 // CXnBgControl::SetCompoundControl()