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