/*
* HwMultiViewContainer2.h
* Autor: Pawe Gala
*/

#ifndef __HWMULTIVIEWCONTAINER2_H__
#define __HWMULTIVIEWCONTAINER2_H__

#include <coecntrl.h>
 

// Deklaracja klasy kontrolki etykiety
class CEikLabel;

class CHwMultiViewContainer2 : public CCoeControl, MCoeControlObserver
    {
    public:    // Konstruktor i destruktor
        void ConstructL(const TRect& aRect);
        ~CHwMultiViewContainer2();

    private:   // Odziedziczone z klasy CCoeControl
        void SizeChanged();
        TInt CountComponentControls() const;
        CCoeControl* ComponentControl( TInt aIndex ) const;
        void Draw( const TRect& aRect ) const;
 
    private:   // Odziedziczone z interfejsu MCoeControlObserver
        void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
        
    private:   // Pola
        CEikLabel* iLabel;
    };

#endif  // __HWMULTIVIEWCONTAINER2_H__


/*
* HwMultiViewContainer2.cpp
* Autor: Pawe Gala
*/

#include <eiklabel.h>
#include "HwMultiViewContainer2.h"


void CHwMultiViewContainer2::ConstructL( const TRect& aRect )
    {
    CreateWindowL();

    iLabel = new (ELeave) CEikLabel;
    iLabel->SetContainerWindowL( *this );
    iLabel->SetTextL( _L("To jest CEikLabel") );

    SetRect(aRect);
    ActivateL();
    }

CHwMultiViewContainer2::~CHwMultiViewContainer2()
    {
    delete iLabel;
    }

void CHwMultiViewContainer2::SizeChanged()
    {
    iLabel->SetExtent( TPoint( 10, 10 ), iLabel->MinimumSize() );
    }

TInt CHwMultiViewContainer2::CountComponentControls() const
    {
    return 1;
    }

CCoeControl* CHwMultiViewContainer2::ComponentControl(TInt aIndex) const
    {
    switch ( aIndex )
        {
        case 0:
            return iLabel;
        default:
            return NULL;
        }
    }

void CHwMultiViewContainer2::Draw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    TRect drawRect( aRect );
    gc.Clear(drawRect);
    }

void CHwMultiViewContainer2::HandleControlEventL( CCoeControl* /*aControl*/, TCoeEvent /*aEventType*/ )
    {
    // Obsuga zmian stanu kontrolek nalecych do kontenera widoku (implementacja
    // pominita)
    }
