wlanutilities/wlansniffer/aihelper/src/wsfaihelpercontainer.cpp
changeset 0 56b72877c1cb
equal deleted inserted replaced
-1:000000000000 0:56b72877c1cb
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  Implementation of CWsfAiHelperContainer
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 //  EXTERNAL INCLUDES
       
    21 #include <AknsDrawUtils.h>
       
    22 #include <AknsBasicBackgroundControlContext.h> 
       
    23 #include <AknUtils.h>
       
    24 
       
    25 //  CLASS HEADER
       
    26 #include "wsfaihelpercontainer.h"
       
    27 
       
    28 //  INTERNAL INCLUDES
       
    29 #include "wsfaihelperappui.h"
       
    30 #include "wsfaihelperdocument.h"
       
    31 #include "wsfmodelobserver.h"
       
    32 #include "wsfaihelper.hrh"
       
    33 #include "wsfmodel.h"
       
    34 #include "wsflogger.h"
       
    35 
       
    36 
       
    37 //  CONSTRUCTION AND DESTRUCTION
       
    38 
       
    39 
       
    40 // ---------------------------------------------------------------------------
       
    41 // CWsfAiHelperContainer::~CWsfAiHelperContainer
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 CWsfAiHelperContainer::~CWsfAiHelperContainer()
       
    45     {
       
    46     delete iBackGround;
       
    47     }
       
    48 
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // CWsfAiHelperContainer::ConstructL
       
    52 // ---------------------------------------------------------------------------
       
    53 //
       
    54 void CWsfAiHelperContainer::ConstructL( TRect aRect, 
       
    55                                         CWsfAiHelperAppUi* aAppUi )
       
    56     {
       
    57     iAppUi = aAppUi;
       
    58     iBackGround = CAknsBasicBackgroundControlContext::NewL( 
       
    59                                      KAknsIIDQsnBgAreaMain, Rect(), EFalse );
       
    60     
       
    61     CreateWindowL();
       
    62     SetRect( aRect );
       
    63     ActivateL();
       
    64     }
       
    65 
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // CWsfAiHelperContainer::SizeChanged
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 void CWsfAiHelperContainer::SizeChanged()
       
    72     {
       
    73     LOG_ENTERFN( "CWsfAiHelperContainer::SizeChanged" );
       
    74     
       
    75     if ( iBackGround )
       
    76         {
       
    77         delete iBackGround;
       
    78         iBackGround = NULL;
       
    79         // Throw away the error
       
    80         TRAP_IGNORE( iBackGround = CAknsBasicBackgroundControlContext::NewL( 
       
    81                                     KAknsIIDQsnBgAreaMain, Rect(), EFalse ) );
       
    82         }
       
    83     }
       
    84 
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // CWsfAiHelperContainer::Draw
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 void CWsfAiHelperContainer::Draw( const TRect& aRect ) const 
       
    91     { 
       
    92     CWindowGc& gc = SystemGc(); 
       
    93     MAknsSkinInstance* skin = AknsUtils::SkinInstance(); 
       
    94     MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); 
       
    95     AknsDrawUtils::Background( skin, cc, this, gc, aRect ); 
       
    96     } 
       
    97 
       
    98 
       
    99 // ---------------------------------------------------------------------------
       
   100 // CWsfAiHelperContainer::HandleResourceChange
       
   101 // ---------------------------------------------------------------------------
       
   102 //
       
   103 void CWsfAiHelperContainer::HandleResourceChange( TInt aType )
       
   104     {
       
   105     LOG_ENTERFN( "CWsfAiHelperContainer::HandleResourceChange" );
       
   106     CCoeControl::HandleResourceChange( aType );
       
   107 
       
   108     if ( aType == KEikDynamicLayoutVariantSwitch )
       
   109         {
       
   110         TRect mainPaneRect;
       
   111         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, 
       
   112                                            mainPaneRect );
       
   113         SetRect( mainPaneRect );
       
   114         DrawDeferred();
       
   115         }
       
   116     }
       
   117 
       
   118 
       
   119 // ---------------------------------------------------------------------------
       
   120 // CWsfAiHelperContainer::MopSupplyObject
       
   121 // ---------------------------------------------------------------------------
       
   122 //
       
   123 TTypeUid::Ptr CWsfAiHelperContainer::MopSupplyObject( TTypeUid aId )
       
   124     {
       
   125     LOG_ENTERFN( "CWsfAiHelperContainer::MopSupplyObject" );
       
   126     if ( aId.iUid == MAknsControlContext::ETypeId && iBackGround )
       
   127         {
       
   128         return MAknsControlContext::SupplyMopObject( aId, iBackGround );
       
   129         }
       
   130 
       
   131     return CCoeControl::MopSupplyObject( aId );
       
   132     }
       
   133     
       
   134 
       
   135 // End of file