00001 // Copyright (c) 2000-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 // HelloWorld_CExampleAppUi.cpp 00015 // Source file for the implementation of the 00016 // application UI class - CExampleAppUi 00017 // 00018 00019 #include "HelloWorld.h" 00020 00021 // The second phase constructor of the application UI class. 00022 // The application UI creates and owns the one and only view. 00023 // 00024 void CExampleAppUi::ConstructL() 00025 { 00026 // BaseConstructL() completes the UI framework's 00027 // construction of the App UI. 00028 BaseConstructL(); 00029 // Create the single application view in which to 00030 // draw the text "Hello World!", passing into it 00031 // the rectangle available to it. 00032 iAppView = CExampleAppView::NewL(ClientRect()); 00033 } 00034 00035 00036 // The app Ui owns the two views and is. 00037 // therefore, responsible for destroying them 00038 // 00039 CExampleAppUi::~CExampleAppUi() 00040 { 00041 delete iAppView; 00042 } 00043 00044 00045 // Called by the UI framework when a command has been issued. 00046 // In this example, a command can originate through a 00047 // hot-key press or by selection of a menu item. 00048 // The command Ids are defined in the .hrh file 00049 // and are 'connected' to the hot-key and menu item in the 00050 // resource file. 00051 // Note that the EEikCmdExit is defined by the UI 00052 // framework and is pulled in by including eikon.hrh 00053 // 00054 void CExampleAppUi::HandleCommandL(TInt aCommand) 00055 { 00056 switch (aCommand) 00057 { 00058 // Just issue simple info messages to show that 00059 // the menu items have been selected 00060 case EExampleItem0: 00061 iEikonEnv->InfoMsg(R_EXAMPLE_TEXT_ITEM0); 00062 break; 00063 00064 00065 case EExampleItem1: 00066 iEikonEnv->InfoMsg(R_EXAMPLE_TEXT_ITEM1); 00067 break; 00068 00069 case EExampleItem2: 00070 iEikonEnv->InfoMsg(R_EXAMPLE_TEXT_ITEM2); 00071 break; 00072 // Exit the application. The call is 00073 // implemented by the UI framework. 00074 00075 case EEikCmdExit: 00076 Exit(); 00077 break; 00078 } 00079 } 00080