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
00026 HBufC* hello = iCoeEnv->AllocReadResourceLC(R_S60RESOURCELAB_TEXT_HELLO);
00027 iLabel->SetTextL(*hello);
00028
00029 iToDoLabel = new (ELeave) CEikLabel;
00030 iToDoLabel->SetContainerWindowL( *this );
00031
00032 HBufC* world = iCoeEnv->AllocReadResourceLC(R_S60RESOURCELAB_TEXT_WORLD);
00033 iToDoLabel->SetTextL(*world);
00034
00035 CleanupStack::PopAndDestroy(2);
00036
00037 SetRect(aRect);
00038 ActivateL();
00039 }
00040
00041
00042 CS60ResourceLabContainer::~CS60ResourceLabContainer()
00043 {
00044 delete iLabel;
00045 delete iToDoLabel;
00046 }
00047
00048 void CS60ResourceLabContainer::GoodbyeL()
00049 {
00050 HBufC* goodbye = iCoeEnv->AllocReadResourceLC(R_S60RESOURCELAB_TEXT_GOODBYE);
00051 iLabel->SetTextL(*goodbye);
00052 HBufC* everyone = iCoeEnv->AllocReadResourceLC(R_S60RESOURCELAB_TEXT_EVERYONE);
00053 iToDoLabel->SetTextL(*everyone);
00054 CleanupStack::PopAndDestroy(2);
00055 }
00056
00057
00058
00059
00060
00061
00062 void CS60ResourceLabContainer::SizeChanged()
00063 {
00064
00065
00066
00067
00068 iLabel->SetExtent( TPoint(0,0), TSize(Rect().Width(), Rect().Height()/2));
00069 iToDoLabel->SetExtent( TPoint(0,Rect().Height()/2), TSize(Rect().Width(),Rect().Height()/2));
00070 }
00071
00072
00073
00074
00075
00076 TInt CS60ResourceLabContainer::CountComponentControls() const
00077 {
00078 return 2;
00079 }
00080
00081
00082
00083
00084
00085 CCoeControl* CS60ResourceLabContainer::ComponentControl(TInt aIndex) const
00086 {
00087 switch ( aIndex )
00088 {
00089 case 0:
00090 return iLabel;
00091 case 1:
00092 return iToDoLabel;
00093 default:
00094 return NULL;
00095 }
00096 }
00097
00098
00099
00100
00101
00102 void CS60ResourceLabContainer::Draw(const TRect& aRect) const
00103 {
00104 CWindowGc& gc = SystemGc();
00105
00106 gc.SetPenStyle(CGraphicsContext::ENullPen);
00107 gc.SetBrushColor(KRgbGray);
00108 gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
00109 gc.DrawRect(aRect);
00110 }
00111
00112
00113
00114
00115
00116
00117 void CS60ResourceLabContainer::HandleControlEventL(
00118 CCoeControl* ,TCoeEvent )
00119 {
00120 }
00121
00122