classicui_pub/labels_api/tsrc/src/testsdklabelscontainer.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 01:00:49 +0200
changeset 0 2f259fa3e83a
permissions -rw-r--r--
Revision: 201003 Kit: 201005

/*
* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Test grids_api
*
*/

/*
 * Include files
 */
#include <w32std.h>

#include "testsdklabelscontainer.h"

#define KAKNATLISTGRAY TRgb( 0xaaaaaa )


// ---------------------------------------------------------------------------
// C++ default Constructor
// ---------------------------------------------------------------------------
//
CTestSDKLabelsContainer::CTestSDKLabelsContainer()
    {    
    }

// ---------------------------------------------------------------------------
// Destructor
// ---------------------------------------------------------------------------
//
CTestSDKLabelsContainer::~CTestSDKLabelsContainer()
    {
    ResetControl();   
    }
    
// ---------------------------------------------------------------------------
// Symbian 2nd Constructor
// ---------------------------------------------------------------------------
//
void CTestSDKLabelsContainer::ConstructL( const TRect& aRect )
    {
    CreateWindowL();
    SetRect( aRect );
    ActivateL();
    }

// ---------------------------------------------------------------------------
// CTestSDKLabelsContainer::Draw
// Fills the window's rectangle.
// ---------------------------------------------------------------------------
//
void CTestSDKLabelsContainer::Draw( const TRect& aRect ) const
    {    
    CWindowGc& gc = SystemGc();
    gc.SetPenStyle( CGraphicsContext::ENullPen );
    gc.SetBrushColor( KAKNATLISTGRAY );
    gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
    gc.DrawRect( aRect );
    }

// ---------------------------------------------------------------------------
// CTestSDKLabelsContainer::CountComponentControls
// ---------------------------------------------------------------------------
//
TInt CTestSDKLabelsContainer::CountComponentControls() const
    {
    if ( iControl )
        {
        return 1;
        }
    else
        {
        return 0;
        }
    }
    
// ---------------------------------------------------------------------------
// CTestSDKLabelsContainer::ComponentControl
// ---------------------------------------------------------------------------
//
CCoeControl* CTestSDKLabelsContainer::ComponentControl( TInt ) const
    {
    return iControl;
    }
    
// ---------------------------------------------------------------------------
// CTestSDKLabelsContainer::SetControl
// ---------------------------------------------------------------------------
//
void CTestSDKLabelsContainer::SetControlL( CCoeControl* aControl )
    {
    iControl = aControl;    
    if ( iControl )
        {  
        // You can change the position and size
        iControl->SetExtent( Rect().iTl, Rect().Size() );
        iControl->ActivateL();
        DrawNow();
        }    
    }
    
// ---------------------------------------------------------------------------
// CTestSDKLabelsContainer::ResetControl
// ---------------------------------------------------------------------------
//
void CTestSDKLabelsContainer::ResetControl()
    {
    delete iControl;
    iControl = NULL;        
    }

// ---------------------------------------------------------------------------
// CTestSDKLabelsContainer::ActivateGc
// ---------------------------------------------------------------------------
//
void CTestSDKLabelsContainer::ActivateGc() const
    {
    CCoeControl::ActivateGc();
    }

// ---------------------------------------------------------------------------
// CTestSDKLabelsContainer::DeactivateGc
// ---------------------------------------------------------------------------
//
void CTestSDKLabelsContainer::DeactivateGc() const
    {
    CCoeControl::DeactivateGc();
    }
//end of file