00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "embedded.h"
00017
00018 const TUid KAppEmbeddable = { 0xE800008F };
00019
00020 CExampleAppView::CExampleAppView()
00021 {}
00022
00023
00024 CExampleAppView* CExampleAppView::NewL(const TRect& aRect)
00025 {
00026 CExampleAppView* self = new(ELeave) CExampleAppView();
00027 CleanupStack::PushL(self);
00028 self->ConstructL(aRect);
00029 CleanupStack::Pop();
00030 return self;
00031 }
00032
00033 CExampleAppView::~CExampleAppView()
00034 {
00035 delete iExampleText;
00036 }
00037
00038
00039 void CExampleAppView::ConstructL(const TRect& aRect)
00040 {
00041 TPtrC ptr(KExampleText);
00042 iExampleText = ptr.AllocL();
00043 CreateWindowL();
00044 SetRect(aRect);
00045 ActivateL();
00046 }
00047
00048
00049
00050 void CExampleAppView::Draw(const TRect& ) const
00051 {
00052 CWindowGc& gc = SystemGc();
00053 TRect drawRect = Rect();
00054 const CFont* fontUsed;
00055
00056 gc.Clear();
00057 fontUsed = iEikonEnv->TitleFont();
00058 gc.UseFont(fontUsed);
00059 TInt baselineOffset=(drawRect.Height() - fontUsed->HeightInPixels())/2;
00060 gc.DrawText(*iExampleText,drawRect,baselineOffset,CGraphicsContext::ECenter, 0);
00061 gc.DiscardFont();
00062 }
00063
00064
00065
00066 void CExampleAppUi::ConstructL()
00067 {
00068 BaseConstructL(ENoAppResourceFile | ENoScreenFurniture);
00069 iAppView = CExampleAppView::NewL(ClientRect());
00070 }
00071
00072
00073
00074 CExampleAppUi::~CExampleAppUi()
00075 {
00076 delete iAppView;
00077 }
00078
00079
00080
00081 void CExampleAppUi::HandleCommandL(TInt aCommand)
00082 {
00083 switch (aCommand)
00084 {
00085 case EEikCmdExit:
00086 Exit();
00087 break;
00088 }
00089 }
00090
00091 CExampleDocument::CExampleDocument(CEikApplication& aApp)
00092 : CEikDocument(aApp)
00093 {}
00094
00095
00096
00097
00098 CEikAppUi* CExampleDocument::CreateAppUiL()
00099 {
00100 return new(ELeave) CExampleAppUi;
00101 }
00102
00103
00104
00105 CApaDocument* CExampleApplication::CreateDocumentL()
00106 {
00107 return new (ELeave) CExampleDocument(*this);
00108 }
00109
00110
00111 TUid CExampleApplication::AppDllUid() const
00112 {
00113 return KAppEmbeddable;
00114 }
00115
00116
00117
00118 TFileName CExampleApplication::ResourceFileName() const
00119 {
00120 return TFileName();
00121 }
00122