uifw/AvKon/tsrc/bc/S60_SDK3.0/bctestlist/src/bctestlistcontainer.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2006 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:  container
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "bctestlistcontainer.h"
       
    20 #include "bctestlistbasecase.h"
       
    21 
       
    22 // ======== MEMBER FUNCTIONS ========
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // C++ default Constructor
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 CBCTestListContainer::CBCTestListContainer()
       
    29     {    
       
    30     }
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // Destructor
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 CBCTestListContainer::~CBCTestListContainer()
       
    37     {
       
    38     delete iControl;
       
    39     iControl = NULL;    
       
    40     }
       
    41     
       
    42 // ---------------------------------------------------------------------------
       
    43 // Symbian 2nd Constructor
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 void CBCTestListContainer::ConstructL( const TRect& aRect )
       
    47     {
       
    48     CreateWindowL();
       
    49     SetRect( aRect );
       
    50     ActivateL();
       
    51     }
       
    52 
       
    53 // ----------------------------------------------------------------------------
       
    54 // CBCTestListContainer::Draw
       
    55 // Fills the window's rectangle.
       
    56 // ----------------------------------------------------------------------------
       
    57 //
       
    58 void CBCTestListContainer::Draw( const TRect& aRect ) const
       
    59     {    
       
    60     CWindowGc& gc = SystemGc();
       
    61     gc.SetPenStyle( CGraphicsContext::ENullPen );
       
    62     gc.SetBrushColor( KRgbGray );
       
    63     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
    64     gc.DrawRect( aRect );      
       
    65     }
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // CBCTestListContainer::CountComponentControls
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 TInt CBCTestListContainer::CountComponentControls() const
       
    72     {
       
    73     if ( iControl )
       
    74         {
       
    75         return 1;
       
    76         }
       
    77     else
       
    78         {
       
    79         return 0;
       
    80         }
       
    81     }
       
    82     
       
    83 // ---------------------------------------------------------------------------
       
    84 // CBCTestListContainer::ComponentControl
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 CCoeControl* CBCTestListContainer::ComponentControl( TInt ) const
       
    88     {
       
    89     return iControl;
       
    90     }
       
    91     
       
    92 // ---------------------------------------------------------------------------
       
    93 // CBCTestListContainer::SetControl
       
    94 // ---------------------------------------------------------------------------
       
    95 //
       
    96 void CBCTestListContainer::SetControl( CCoeControl* aControl )
       
    97     {
       
    98     iControl = aControl;    
       
    99     if ( iControl )
       
   100         {        
       
   101         iControl->SetExtent( Rect().iTl, Rect().Size() );
       
   102         iControl->ActivateL();
       
   103         DrawNow();
       
   104         }    
       
   105     }
       
   106     
       
   107 // ---------------------------------------------------------------------------
       
   108 // CBCTestListContainer::ResetControl
       
   109 // ---------------------------------------------------------------------------
       
   110 //
       
   111 void CBCTestListContainer::ResetControl()
       
   112     {
       
   113     delete iControl;
       
   114     iControl = NULL;            
       
   115     }