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