00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include <eikedwin.h>
00018 #include <eikenv.h>
00019 #include <aknutils.h>
00020 #include <ContactWriteNewField.rsg>
00021
00022 #include "ContactWriteNewFieldMainView.h"
00023
00024 CContactWriteNewFieldMainView* CContactWriteNewFieldMainView::NewL(const TRect& aRect)
00025 {
00026 CContactWriteNewFieldMainView* self = CContactWriteNewFieldMainView::NewLC(aRect);
00027 CleanupStack::Pop(self);
00028 return self;
00029 }
00030
00031 CContactWriteNewFieldMainView* CContactWriteNewFieldMainView::NewLC(const TRect& aRect)
00032 {
00033 CContactWriteNewFieldMainView* self = new (ELeave) CContactWriteNewFieldMainView;
00034 CleanupStack::PushL(self);
00035 self->ConstructL(aRect);
00036 return self;
00037 }
00038
00039 CContactWriteNewFieldMainView::~CContactWriteNewFieldMainView()
00040 {
00041 delete iEikEdwin;
00042 }
00043
00044 void CContactWriteNewFieldMainView::ConstructL(const TRect& aRect)
00045 {
00046 CreateWindowL();
00047
00048
00049 iEikEdwin = new (ELeave) CEikEdwin();
00050 iEikEdwin->ConstructL(CEikEdwin::EReadOnly | CEikEdwin::ENoAutoSelection);
00051 iEikEdwin->SetContainerWindowL(*this);
00052 HBufC* message = ControlEnv()->AllocReadResourceLC(
00053 R_CONTACTWRITENEWFIELD);
00054 iEikEdwin->SetTextL(message);
00055 CleanupStack::PopAndDestroy(message);
00056
00057 SetRect(aRect);
00058 ActivateL();
00059 }
00060
00061 void CContactWriteNewFieldMainView::SetTextL(const TDesC& aText)
00062 {
00063 if (iEikEdwin)
00064 {
00065 iEikEdwin->SetTextL(&aText);
00066 DrawNow();
00067 }
00068 }
00069
00070 TInt CContactWriteNewFieldMainView::CountComponentControls() const
00071 {
00072 if (iEikEdwin)
00073 {
00074 return 1;
00075 }
00076 return 0;
00077 }
00078
00079 CCoeControl* CContactWriteNewFieldMainView::ComponentControl(TInt aIndex) const
00080 {
00081 switch (aIndex)
00082 {
00083 case 0:
00084 return iEikEdwin;
00085 default:
00086 break;
00087 }
00088 return NULL;
00089 }
00090
00091 void CContactWriteNewFieldMainView::Draw(const TRect& ) const
00092 {
00093 CWindowGc& gc = SystemGc();
00094 gc.Clear();
00095 }
00096
00097 void CContactWriteNewFieldMainView::SizeChanged()
00098 {
00099 if (iEikEdwin)
00100 {
00101 TRect rect(Rect());
00102 iEikEdwin->SetExtent(
00103 TPoint(0, 0),
00104 TSize(rect.Width(), rect.Height()));
00105 }
00106 }
00107
00108