|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
00001 /* 00002 * ============================================================================== 00003 * Name : SIPExLogView.cpp 00004 * Part of : SIPEx 00005 * Interface : 00006 * Description : 00007 * Version : 00008 * 00009 * Copyright (c) 2004-2006 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. 00013 * ============================================================================== 00014 */ 00015 00016 // INCLUDE FILES 00017 #include <aknviewappui.h> 00018 #include <eikmenup.h> // CEikMenupane 00019 #include <avkon.hrh> 00020 #include <SIPEx.rsg> 00021 #include "SIPExLogView.h" 00022 #include "SIPExLogContainer.h" 00023 #include "SIPExAppUi.h" 00024 #include "SIPExGameEngine.h" 00025 00026 00027 00028 // ============================ MEMBER FUNCTIONS =============================== 00029 00030 // ----------------------------------------------------------------------------- 00031 // CSIPExLogView::NewL 00032 // EPOC two-phase construction 00033 // ----------------------------------------------------------------------------- 00034 // 00035 CSIPExLogView* CSIPExLogView::NewLC( CSIPExEngine& aEngine ) 00036 { 00037 CSIPExLogView* self = new ( ELeave ) CSIPExLogView( aEngine ); 00038 CleanupStack::PushL( self ); 00039 self->ConstructL(); 00040 return self; 00041 } 00042 00043 // ----------------------------------------------------------------------------- 00044 // CSIPExLogView::CSIPExLogView 00045 // C++ default constructor 00046 // ----------------------------------------------------------------------------- 00047 // 00048 CSIPExLogView::CSIPExLogView( CSIPExEngine& aEngine ) 00049 : iEngine( aEngine ) 00050 { 00051 // no implementation required 00052 } 00053 00054 // ----------------------------------------------------------------------------- 00055 // CSIPExLogView::ConstructL 00056 // EPOC second-phased constructor 00057 // ----------------------------------------------------------------------------- 00058 // 00059 void CSIPExLogView::ConstructL() 00060 { 00061 BaseConstructL( R_SIP_EX_VIEW2 ); 00062 } 00063 00064 // ----------------------------------------------------------------------------- 00065 // CSIPExLogView::~CSIPExLogView 00066 // Default destructor 00067 // ----------------------------------------------------------------------------- 00068 // 00069 CSIPExLogView::~CSIPExLogView() 00070 { 00071 if ( iContainer ) 00072 { 00073 AppUi()->RemoveFromViewStack( *this, iContainer ); 00074 } 00075 00076 delete iContainer; 00077 } 00078 00079 // ----------------------------------------------------------------------------- 00080 // TUid CSIPExLogView::Id 00081 // This returns the view ID 00082 // ----------------------------------------------------------------------------- 00083 // 00084 TUid CSIPExLogView::Id() const 00085 { 00086 return KLogViewId; 00087 } 00088 00089 // ----------------------------------------------------------------------------- 00090 // CSIPExLogView::HandleCommandL 00091 // Here we handle commands for this view. 00092 // Each view has their own HandleCommandL() 00093 // ----------------------------------------------------------------------------- 00094 // 00095 void CSIPExLogView::HandleCommandL( TInt aCommand ) 00096 { 00097 switch ( aCommand ) 00098 { 00099 case EAknSoftkeyBack: 00100 { 00101 AppUi()->HandleCommandL( EEikCmdExit ); 00102 break; 00103 } 00104 default: 00105 { 00106 AppUi()->HandleCommandL( aCommand ); 00107 break; 00108 } 00109 } 00110 } 00111 00112 // ----------------------------------------------------------------------------- 00113 // CSIPExLogView::HandleViewRectChange 00114 // ----------------------------------------------------------------------------- 00115 // 00116 void CSIPExLogView::HandleViewRectChange() 00117 { 00118 if ( iContainer ) 00119 { 00120 iContainer->SetRect( ClientRect() ); 00121 } 00122 } 00123 00124 // ----------------------------------------------------------------------------- 00125 // CSIPExLogView::DynInitMenuPaneL 00126 // Handles menu initialization event. 00127 // ----------------------------------------------------------------------------- 00128 // 00129 void CSIPExLogView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) 00130 { 00131 if ( aResourceId != R_SIP_EX_MENU ) 00132 { 00133 // Not this view's menu, ignore 00134 return; 00135 } 00136 00137 switch( static_cast< CSIPExAppUi* >( AppUi() )->EngineState() ) 00138 { 00139 case CSIPExEngine::EIdle: 00140 aMenuPane->SetItemDimmed( ECmdInviteForGame, ETrue ); 00141 aMenuPane->SetItemDimmed( ECmdEnableProfile, EFalse ); 00142 aMenuPane->SetItemDimmed( ECmdDisableProfile, ETrue ); 00143 aMenuPane->SetItemDimmed( ECmdSendIM, ETrue ); 00144 aMenuPane->SetItemDimmed( ECmdEndGame, ETrue ); 00145 break; 00146 case CSIPExEngine::EEnabled: 00147 aMenuPane->SetItemDimmed( ECmdInviteForGame, EFalse ); 00148 aMenuPane->SetItemDimmed( ECmdEnableProfile, ETrue ); 00149 aMenuPane->SetItemDimmed( ECmdDisableProfile, EFalse ); 00150 aMenuPane->SetItemDimmed( ECmdSendIM, EFalse ); 00151 aMenuPane->SetItemDimmed( ECmdEndGame, ETrue ); 00152 break; 00153 case CSIPExEngine::EActivating: 00154 aMenuPane->SetItemDimmed( ECmdInviteForGame, ETrue ); 00155 aMenuPane->SetItemDimmed( ECmdEnableProfile, ETrue ); 00156 aMenuPane->SetItemDimmed( ECmdDisableProfile, ETrue ); 00157 aMenuPane->SetItemDimmed( ECmdSendIM, EFalse ); 00158 aMenuPane->SetItemDimmed( ECmdEndGame, ETrue ); 00159 break; 00160 case CSIPExEngine::EActive: 00161 aMenuPane->SetItemDimmed( ECmdInviteForGame, ETrue ); 00162 aMenuPane->SetItemDimmed( ECmdEnableProfile, ETrue ); 00163 aMenuPane->SetItemDimmed( ECmdDisableProfile, ETrue ); 00164 aMenuPane->SetItemDimmed( ECmdSendIM, EFalse ); 00165 aMenuPane->SetItemDimmed( ECmdEndGame, EFalse ); 00166 break; 00167 default: 00168 break; 00169 } 00170 } 00171 00172 // ----------------------------------------------------------------------------- 00173 // CSIPExLogView::DoActivateL 00174 // This is called when a view needs to be activated. 00175 // This creates container with its controls. 00176 // ----------------------------------------------------------------------------- 00177 // 00178 void CSIPExLogView::DoActivateL( 00179 const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/, 00180 const TDesC8& /*aCustomMessage*/ ) 00181 { 00182 00183 // Create Container 00184 if (!iContainer) 00185 { 00186 iContainer = new (ELeave) CSIPExLogContainer( iEngine ); 00187 iContainer->SetMopParent( this ); 00188 iContainer->ConstructL( ClientRect() ); 00189 AppUi()->AddToStackL( *this, iContainer ); 00190 } 00191 } 00192 00193 // ----------------------------------------------------------------------------- 00194 // CSIPExLogView::HandleCommandL 00195 // This is called when a view needs to be deactivated. 00196 // This destroys container with its controls. 00197 // ----------------------------------------------------------------------------- 00198 // 00199 void CSIPExLogView::DoDeactivate() 00200 { 00201 if ( iContainer ) 00202 { 00203 AppUi()->RemoveFromViewStack( *this, iContainer ); 00204 } 00205 00206 delete iContainer; 00207 iContainer = NULL; 00208 } 00209 00210 // ----------------------------------------------------------------------------- 00211 // CSIPExLogView::Container 00212 // ----------------------------------------------------------------------------- 00213 // 00214 CSIPExLogContainer* CSIPExLogView::Container() 00215 { 00216 return iContainer; 00217 } 00218 00219 // End of File 00220
|
© Nokia 2006 |