00001
00002
00003
00004 #include "S60ResourceLabContainer.h"
00005 #include <S60ResourceLab.rsg>
00006
00007 #include <eiklabel.h>
00008 #include <coemain.h>
00009
00010
00011
00012 _LIT(KTextHello, "Hello");
00013 _LIT(KTextWorld, "World!");
00014
00015
00016
00017
00018
00019 void CS60ResourceLabContainer::ConstructL(const TRect& aRect)
00020 {
00021 CreateWindowL();
00022
00023 iLabel = new (ELeave) CEikLabel;
00024 iLabel->SetContainerWindowL( *this );
00025 iLabel->SetTextL(KTextHello);
00026
00027 iToDoLabel = new (ELeave) CEikLabel;
00028 iToDoLabel->SetContainerWindowL( *this );
00029 iToDoLabel->SetTextL(KTextWorld);
00030
00031 SetRect(aRect);
00032 ActivateL();
00033 }
00034
00035
00036 CS60ResourceLabContainer::~CS60ResourceLabContainer()
00037 {
00038 delete iLabel;
00039 delete iToDoLabel;
00040 }
00041
00042 void CS60ResourceLabContainer::GoodbyeL()
00043 {
00044 HBufC* goodbye = iCoeEnv->AllocReadResourceLC(R_S60RESOURCELAB_TEXT_GOODBYE);
00045 iLabel->SetTextL(*goodbye);
00046 HBufC* everyone = iCoeEnv->AllocReadResourceLC(R_S60RESOURCELAB_TEXT_EVERYONE);
00047 iToDoLabel->SetTextL(*everyone);
00048 CleanupStack::PopAndDestroy(2);
00049 }
00050
00051
00052
00053
00054
00055
00056 void CS60ResourceLabContainer::SizeChanged()
00057 {
00058
00059
00060
00061
00062 iLabel->SetExtent( TPoint(0,0), TSize(Rect().Width(), Rect().Height()/2));
00063 iToDoLabel->SetExtent( TPoint(0,Rect().Height()/2), TSize(Rect().Width(),Rect().Height()/2));
00064 }
00065
00066
00067
00068
00069
00070 TInt CS60ResourceLabContainer::CountComponentControls() const
00071 {
00072 return 2;
00073 }
00074
00075
00076
00077
00078
00079 CCoeControl* CS60ResourceLabContainer::ComponentControl(TInt aIndex) const
00080 {
00081 switch ( aIndex )
00082 {
00083 case 0:
00084 return iLabel;
00085 case 1:
00086 return iToDoLabel;
00087 default:
00088 return NULL;
00089 }
00090 }
00091
00092
00093
00094
00095
00096 void CS60ResourceLabContainer::Draw(const TRect& aRect) const
00097 {
00098 CWindowGc& gc = SystemGc();
00099
00100 gc.SetPenStyle(CGraphicsContext::ENullPen);
00101 gc.SetBrushColor(KRgbGray);
00102 gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
00103 gc.DrawRect(aRect);
00104 }
00105
00106
00107
00108
00109
00110
00111 void CS60ResourceLabContainer::HandleControlEventL(
00112 CCoeControl* ,TCoeEvent )
00113 {
00114 }
00115
00116