00001 /* 00002 * Copyright © 2008 Nokia Corporation. 00003 */ 00004 00005 #include <eikenv.h> 00006 #include <gdi.h> 00007 #include <AknUtils.h> 00008 00009 #include "DBMSAppView.h" 00010 00011 // --------------------------------------------------------------------------- 00012 // CDBMSAppUi::NewL() 00013 // 00014 // Create instance of this view. 00015 // --------------------------------------------------------------------------- 00016 CDBMSAppView* CDBMSAppView::NewL(const TRect& aRect) 00017 { 00018 CDBMSAppView* self = new (ELeave) CDBMSAppView; 00019 CleanupStack::PushL(self); 00020 self->ConstructL(aRect); 00021 CleanupStack::Pop(self); 00022 return self; 00023 } 00024 00025 // --------------------------------------------------------------------------- 00026 // CDBMSAppUi::ConstructL() 00027 // 00028 // Perform the second phase construction. 00029 // --------------------------------------------------------------------------- 00030 void CDBMSAppView::ConstructL(const TRect& aRect) 00031 { 00032 // Create a window for this application view 00033 CreateWindowL(); 00034 00035 // Set the windows size 00036 SetRect(aRect); 00037 00038 ActivateL(); 00039 } 00040 00041 // --------------------------------------------------------------------------- 00042 // CDBMSAppUi::CDBMSAppView() 00043 // 00044 // Constructor 00045 // --------------------------------------------------------------------------- 00046 CDBMSAppView::CDBMSAppView() 00047 { 00048 // No implementation required 00049 } 00050 00051 00052 // --------------------------------------------------------------------------- 00053 // CDBMSAppUi::~CDBMSAppView() 00054 // 00055 // Desctructor 00056 // --------------------------------------------------------------------------- 00057 CDBMSAppView::~CDBMSAppView() 00058 { 00059 } 00060 00061 // --------------------------------------------------------------------------- 00062 // CDBMSAppUi::Draw() 00063 // 00064 // Draw the view. Show simple "DBMS" text in the center of the view. 00065 // This is called by the framework, when necessary. 00066 // --------------------------------------------------------------------------- 00067 void CDBMSAppView::Draw(const TRect& /*aRect*/) const 00068 { 00069 _LIT(KText,"DBMS"); 00070 00071 CWindowGc& gc = SystemGc(); // Window graphics context 00072 TRect drawRect = Rect(); // Area in which we shall draw 00073 const CFont* fontUsed = iEikonEnv->TitleFont(); 00074 gc.Clear(); // Start with a clear screen 00075 00076 // Draw an outline rectangle slightly smaller than the drawing area. 00077 drawRect.Shrink(10,10); 00078 gc.DrawRect(drawRect); 00079 gc.UseFont(fontUsed); 00080 // Draw the text in the middle of the rectangle. 00081 TInt baselineOffset=(drawRect.Height() - fontUsed->HeightInPixels())/2; 00082 gc.DrawText(KText, drawRect, baselineOffset, CGraphicsContext::ECenter, 0); 00083 // Finished using the font 00084 gc.DiscardFont(); 00085 } 00086 00087
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.