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