examples/SFExamples/PIM/ContactAsynchSort/src/s60_3rd/ContactAsynchSortMainView.cpp

00001 // 
00002 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
00003 // All rights reserved.
00004 // This component and the accompanying materials are made available
00005 // under the terms of the License "Eclipse Public License v1.0"
00006 // which accompanies this distribution, and is available
00007 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00008 // 
00009 // Initial Contributors:
00010 // Nokia Corporation - initial contribution.
00011 // 
00012 // Contributors:
00013 // 
00014 // Description:
00015 // 
00016 
00017 #include <eikedwin.h>
00018 #include <eikenv.h>
00019 #include <aknutils.h>
00020 #include <ContactAsynchSort.rsg>
00021 
00022 #include "ContactAsynchSortMainView.h"
00023 
00024 CContactAsynchSortMainView* CContactAsynchSortMainView::NewL(const TRect& aRect)
00025         {
00026         CContactAsynchSortMainView* self = CContactAsynchSortMainView::NewLC(aRect);
00027         CleanupStack::Pop(self);
00028         return self;
00029         }
00030 
00031 CContactAsynchSortMainView* CContactAsynchSortMainView::NewLC(const TRect& aRect)
00032         {
00033         CContactAsynchSortMainView* self = new (ELeave) CContactAsynchSortMainView;
00034         CleanupStack::PushL(self);
00035         self->ConstructL(aRect);
00036         return self;
00037         }
00038 
00039 CContactAsynchSortMainView::~CContactAsynchSortMainView()
00040         {
00041         delete iEikEdwin;
00042         }
00043         
00044 void CContactAsynchSortMainView::ConstructL(const TRect& aRect)
00045         {
00046         CreateWindowL();
00047         
00048         // Create an edwin on this control.
00049         iEikEdwin = new (ELeave) CEikEdwin();
00050         iEikEdwin->ConstructL(CEikEdwin::EReadOnly | CEikEdwin::ENoAutoSelection);
00051     iEikEdwin->SetContainerWindowL(*this);
00052         HBufC* message = ControlEnv()->AllocReadResourceLC(
00053                 R_CONTACTASYNCHSORT);   
00054     iEikEdwin->SetTextL(message);
00055         CleanupStack::PopAndDestroy(message);
00056         
00057         SetRect(aRect);
00058         ActivateL();
00059         }
00060 
00061 void CContactAsynchSortMainView::SetTextL(const TDesC& aText)
00062         {
00063         if (iEikEdwin)
00064                 {
00065                 iEikEdwin->SetTextL(&aText);
00066                 DrawNow();
00067                 }
00068         }
00069 
00070 TInt CContactAsynchSortMainView::CountComponentControls() const
00071         {
00072         if (iEikEdwin)
00073                 {
00074                 return 1;
00075                 }
00076         return 0;
00077         }
00078 
00079 CCoeControl* CContactAsynchSortMainView::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 CContactAsynchSortMainView::Draw(const TRect& /*aRect*/) const
00092         {
00093         CWindowGc& gc = SystemGc();
00094         gc.Clear();
00095         }
00096 
00097 void CContactAsynchSortMainView::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 // End of File

Generated by  doxygen 1.6.2