examples/AppFramework/Apparc/ServerApplication/server_application/serv_app_minimal.cpp

00001 // Copyright (c) 2006-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 
00017 #include "serv_app_minimal.h"
00018 
00019 const TUid KUidServAppMinimal = { 0xE1111556 };
00020 
00021 
00022 // Called by the UI framework to get the application's UID
00023 TUid CExampleApplication::AppDllUid() const
00024         {
00025         return KUidServAppMinimal;
00026         }
00027 
00028 // Called by the UI framework at application start-up to
00029 // create an instance of the document class.
00030 CApaDocument* CExampleApplication::CreateDocumentL()
00031         {
00032         return new (ELeave) CExampleDocument(*this);
00033         }
00034 
00035 // Called by the UI framework to get the name of the resource file.
00036 // This returns an empty filename as there is no resource file.
00037 TFileName CExampleApplication::ResourceFileName() const
00038         {
00039         return TFileName();
00040         }
00041         
00042 // Called by the UI framework to create an instance of the
00043 // CApaAppServer server derived class   
00044 void CExampleApplication::NewAppServerL(CApaAppServer*& aAppServer)
00045         {
00046         aAppServer = new (ELeave) CServAppServer;
00047         }
00048 
00049 CExampleDocument::CExampleDocument(CEikApplication& aApp)
00050                 : CEikDocument(aApp)
00051         {}
00052 
00053 // Called by the UI framework to construct
00054 // the application UI class. Note that the app UI's
00055 // ConstructL() is called by the UI framework.
00056 CEikAppUi* CExampleDocument::CreateAppUiL()
00057         {
00058         return new(ELeave) CExampleAppUi;
00059         }
00060 
00061 // Second phase constructor of the application UI class.
00062 // It creates and owns a single view.
00063 void CExampleAppUi::ConstructL()
00064         {
00065         BaseConstructL(ENoAppResourceFile | ENoScreenFurniture);
00066         iAppView = CExampleAppView::NewL(ClientRect());
00067         }
00068 
00069 // The application UI class owns one view, and is responsible
00070 // for destroying it.
00071 CExampleAppUi::~CExampleAppUi()
00072         {
00073         delete iAppView;
00074         }
00075 
00076 // Called by the UI framework when a command has been issued.
00077 // Minimally needs to handle the exit command.
00078 void CExampleAppUi::HandleCommandL(TInt aCommand)
00079         {
00080         switch (aCommand)
00081                 {
00082                 // Exit the application.
00083                 case EEikCmdExit:
00084                         Exit();
00085                         break;
00086                 }
00087         }
00088 
00089 CExampleAppView::CExampleAppView()
00090         {
00091         }
00092 
00093 // Static function wraps up two-phase construction for the view.
00094 CExampleAppView* CExampleAppView::NewL(const TRect& aRect)
00095         {
00096         CExampleAppView* self = new(ELeave) CExampleAppView();
00097         CleanupStack::PushL(self);
00098         self->ConstructL(aRect);
00099         CleanupStack::Pop();
00100         return self;
00101         }
00102 
00103 CExampleAppView::~CExampleAppView()
00104         {
00105         }
00106 
00107 // Standard initialisation for a window-owning control.
00108 void CExampleAppView::ConstructL(const TRect& aRect)
00109         {
00110         // Create the window owned by the view.
00111         CreateWindowL();
00112         // Set the view's size and position.
00113         SetRect(aRect);
00114         // Activate the view.
00115         ActivateL();
00116         }
00117 
00118 // Draws the view with a simple outline rectangle and then
00119 // draws the welcome text centred.
00120 void CExampleAppView::Draw(const TRect& /*aRect*/) const
00121         {
00122         // Use drawing parameters from the system graphics context.
00123         CWindowGc& gc = SystemGc();
00124         gc.Clear();
00125         }
00126 
00127 
00128 CMinimalSession::CMinimalSession()
00129 {
00130 }
00131 
00132 CMinimalSession::~CMinimalSession()
00133 {
00134 } 
00135 
00136 // Implements the pure virtual function of the base class
00137 // It just evokes a notifier window displaying a message
00138 void CMinimalSession::Display(const TDesC & aMessage)
00139 {
00140         CEikonEnv::Static()->AlertWin(aMessage);
00141 }

Generated by  doxygen 1.6.2