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