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