00001 /* 00002 Copyright (c) 2002-2011 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 00003 00004 Redistribution and use in source and binary forms, with or without 00005 modification, are permitted provided that the following conditions are met: 00006 00007 * Redistributions of source code must retain the above copyright notice, this 00008 list of conditions and the following disclaimer. 00009 * Redistributions in binary form must reproduce the above copyright notice, 00010 this list of conditions and the following disclaimer in the documentation 00011 and/or other materials provided with the distribution. 00012 * Neither the name of Nokia Corporation nor the names of its contributors 00013 may be used to endorse or promote products derived from this software 00014 without specific prior written permission. 00015 00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00017 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00018 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00020 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00021 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00022 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00023 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00024 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00025 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 00027 Description: 00028 */ 00029 00030 // INCLUDE FILES 00031 #include <avkon.hrh> 00032 #include <rps_0xA00054BC.rsg> 00033 00034 #include "common.hrh" 00035 #include "rps.hrh" 00036 #include "rpsApplication.h" 00037 #include "rpsAppUi.h" 00038 #include "rpsAppView.h" 00039 00040 TInt gScreenWidth; 00041 TInt gScreenHeight; 00042 00043 // ----------------------------------------------------------------------------- 00044 // CRpsAppUi::ConstructL() 00045 // Symbian 2nd phase constructor can leave. 00046 // ----------------------------------------------------------------------------- 00047 // 00048 void CRpsAppUi::ConstructL() 00049 { 00050 // Initialise app UI with standard value. 00051 BaseConstructL(CAknAppUi::EAknEnableSkin); 00052 00053 // Remove key blocking. 00054 SetKeyBlockMode(ENoKeyBlock); 00055 00056 gScreenWidth = ClientRect().Width(); 00057 gScreenHeight = ClientRect().Height(); 00058 00059 iGameEngine = CRpsGameEngine::NewL(*this); 00060 00061 // Create view object 00062 iAppView = CRpsAppView::NewL(*iGameEngine, ClientRect()); 00063 AddToStackL(iAppView); 00064 00065 } 00066 // ----------------------------------------------------------------------------- 00067 // CRpsAppUi::CRpsAppUi() 00068 // C++ default constructor can NOT contain any code, that might leave. 00069 // ----------------------------------------------------------------------------- 00070 // 00071 CRpsAppUi::CRpsAppUi() 00072 { 00073 // No implementation required 00074 } 00075 00076 // ----------------------------------------------------------------------------- 00077 // CRpsAppUi::~CRpsAppUi() 00078 // Destructor. 00079 // ----------------------------------------------------------------------------- 00080 // 00081 CRpsAppUi::~CRpsAppUi() 00082 { 00083 delete iGameEngine; 00084 if (iAppView) 00085 { 00086 RemoveFromStack(iAppView); 00087 delete iAppView; 00088 } 00089 } 00090 00091 // ----------------------------------------------------------------------------- 00092 // CRpsAppUi::HandleCommandL() 00093 // Takes care of command handling. 00094 // ----------------------------------------------------------------------------- 00095 // 00096 void CRpsAppUi::HandleCommandL( TInt aCommand ) 00097 { 00098 switch( aCommand ) 00099 { 00100 case EEikCmdExit: 00101 case EAknSoftkeyExit: 00102 case EAknSoftkeyBack: 00103 Exit(); 00104 break; 00105 default: 00106 ASSERT(EFalse); // Should not get here 00107 break; 00108 } 00109 } 00110 // ----------------------------------------------------------------------------- 00111 // Called by the framework when the application status pane 00112 // size is changed. Passes the new client rectangle to the 00113 // AppView 00114 // ----------------------------------------------------------------------------- 00115 // 00116 void CRpsAppUi::HandleStatusPaneSizeChange() 00117 { 00118 iAppView->SetRect( ClientRect() ); 00119 } 00120 00121 void CRpsAppUi::UpdateScreen() 00122 { 00123 iAppView->DrawNow(); 00124 } 00125 00126 // End of File