diff -r f345bda72bc4 -r 43e37759235e Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/embedded_8cpp_source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/embedded_8cpp_source.html Tue Mar 30 16:16:55 2010 +0100 @@ -0,0 +1,138 @@ + + + + +TB9.2 Example Applications: examples/AppFramework/Apparc/EmbApp/embedded.cpp Source File + + + + + +

examples/AppFramework/Apparc/EmbApp/embedded.cpp

00001 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+00002 // All rights reserved.
+00003 // This component and the accompanying materials are made available
+00004 // under the terms of "Eclipse Public License v1.0"
+00005 // which accompanies this distribution, and is available
+00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
+00007 //
+00008 // Initial Contributors:
+00009 // Nokia Corporation - initial contribution.
+00010 //
+00011 // Contributors:
+00012 //
+00013 // Description:
+00014 //
+00015 
+00016 #include "embedded.h"
+00017 
+00018 const TUid KAppEmbeddable       = { 0xE800008F };
+00019 
+00020 CExampleAppView::CExampleAppView()
+00021         {}
+00022 
+00023 // Static function wraps up two-phase construction for the view.
+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 // Standard initialisation for a window-owning control.
+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 // Draws the view with a simple outline rectangle and then
+00049 // draws the welcome text centred.
+00050 void CExampleAppView::Draw(const TRect& /*aRect*/) 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 // Second phase constructor of the application UI class.
+00065 // It creates and owns a single view.
+00066 void CExampleAppUi::ConstructL()
+00067     {
+00068     BaseConstructL(ENoAppResourceFile | ENoScreenFurniture);
+00069         iAppView = CExampleAppView::NewL(ClientRect());
+00070         }
+00071 
+00072 // The application UI class owns one view, and is responsible
+00073 // for destroying it.
+00074 CExampleAppUi::~CExampleAppUi()
+00075         {
+00076         delete iAppView;
+00077         }
+00078 
+00079 // Called by the UI framework when a command has been issued.
+00080 // Minimally needs to handle the exit command.
+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 // Called by the UI framework to construct
+00096 // the application UI class. Note that the app UI's
+00097 // ConstructL() is called by the UI framework.
+00098 CEikAppUi* CExampleDocument::CreateAppUiL()
+00099         {
+00100     return new(ELeave) CExampleAppUi;
+00101         }
+00102 
+00103 // Called by the UI framework at application start-up to
+00104 // create an instance of the document class.
+00105 CApaDocument* CExampleApplication::CreateDocumentL()
+00106         {
+00107         return new (ELeave) CExampleDocument(*this);
+00108         }
+00109 
+00110 // Called by the UI framework to get the application's UID
+00111 TUid CExampleApplication::AppDllUid() const
+00112         {
+00113         return KAppEmbeddable;
+00114         }
+00115 
+00116 // Called by the UI framework to get the name of the resource file.
+00117 // This returns an empty filename as there is no resource file.
+00118 TFileName CExampleApplication::ResourceFileName() const
+00119 {
+00120         return TFileName();
+00121 }
+00122 
+
+
Generated by  + +doxygen 1.6.2
+ +