00001
00002
00003
00004
00005
00006
00007
00008 #include <coemain.h>
00009 #include <eikenv.h>
00010 #include <eikappui.h>
00011 #include <eikapp.h>
00012
00013 #include "handlerAppView.h"
00014 #include "handlerDocument.h"
00015
00016 const TInt KCharsToShowFromEnd = 10;
00017
00018 CHandlerAppView* CHandlerAppView::NewL(const TRect& aRect)
00019 {
00020 CHandlerAppView* self = CHandlerAppView::NewLC(aRect);
00021 CleanupStack::Pop(self);
00022 return self;
00023 }
00024
00025 CHandlerAppView* CHandlerAppView::NewLC(const TRect& aRect)
00026 {
00027 CHandlerAppView* self = new (ELeave) CHandlerAppView;
00028 CleanupStack::PushL(self);
00029 self->ConstructL(aRect);
00030 return self;
00031 }
00032
00033 CHandlerAppView::CHandlerAppView()
00034 {
00035
00036 }
00037
00038 CHandlerAppView::~CHandlerAppView()
00039 {
00040
00041 }
00042
00043 void CHandlerAppView::ConstructL(const TRect& aRect)
00044 {
00045
00046 CreateWindowL();
00047
00048
00049 SetRect(aRect);
00050
00051
00052 ActivateL();
00053 }
00054
00055
00056 void CHandlerAppView::Draw(const TRect& ) const
00057 {
00058
00059 CWindowGc& gc = SystemGc();
00060
00061
00062 TRect rect = Rect();
00063
00064
00065 gc.Clear(rect);
00066
00067 const CFont* normalFont = CEikonEnv::Static()->NormalFont();
00068 gc.UseFont( normalFont );
00069
00070
00071 TBuf<KCharsToShowFromEnd> endText = KNullDesC();
00072 endText.Zero();
00073 if( iName.Length() > KCharsToShowFromEnd-2 )
00074 {
00075 endText = iName.Right(KCharsToShowFromEnd-1);
00076 }
00077
00078 const TPoint KPoint1 = TPoint(1,41);
00079 const TPoint KPoint2 = TPoint(1,21);
00080 const TPoint KPoint3 = TPoint(1,61);
00081
00082 gc.DrawText(iName, KPoint1 );
00083 gc.DrawText(endText, KPoint2 );
00084 gc.DrawText(iData, KPoint3 );
00085 }
00086
00087 void CHandlerAppView::SizeChanged()
00088 {
00089 DrawDeferred();
00090 }
00091
00092 void CHandlerAppView::SetFileData(TFileName& aFileName, TDes8& aData)
00093 {
00094 iName = aFileName;
00095 iData.Copy( aData );
00096 DrawDeferred();
00097 }