|
S60 3rd Edition SDK for Symbian OS Example Applications Guide |
00001 /* 00002 * ============================================================================ 00003 * Name : IsvTelCallAppContainer.cpp 00004 * Part of : IsvTelCallApp 00005 * Interface : 00006 * Description : 00007 * Version : 00008 * 00009 * Copyright (c) 2005-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 <aknutils.h> // for AKN_LAF_COLOR 00018 #include <eikenv.h> 00019 #include <eiklabel.h> // for label 00020 #include <aknform.h> // for form control 00021 #include <eikseced.h> // for secret editor 00022 #include <eikedwin.h> // for edwins 00023 #include <IsvTelCallApp.rsg> 00024 #include "IsvTelCallApp.hrh" 00025 #include "IsvTelCallAppView.h" 00026 #include "IsvTelCallAppContainer.h" 00027 #include "IsvTelCallAppDlg.h" 00028 00029 // MACROS 00030 #define ISVTELCALLAPP_BACKGROUND_COLOR AKN_LAF_COLOR( 219 ) 00031 00032 // CONSTANTS 00033 const TInt KIsvTelCallAppCountComponent = 1; 00034 const TInt KIsvTelCallAppMessageBufLength = 256; 00035 00036 // ================= MEMBER FUNCTIONS ========================================= 00037 00038 // ---------------------------------------------------------------------------- 00039 // CIsvTelCallAppContainer::CIsvTelCallAppContainer( CIsvTelCallAppView* ) 00040 // Overload constructor. 00041 // ---------------------------------------------------------------------------- 00042 // 00043 CIsvTelCallAppContainer::CIsvTelCallAppContainer( 00044 CIsvTelCallAppView* aView ) 00045 : iView( aView ), 00046 iLabel( NULL ) 00047 { 00048 } 00049 00050 // ---------------------------------------------------------------------------- 00051 // void CIsvTelCallAppContainer::ConstructL( const TRect& ) 00052 // EPOC constructor. 00053 // ---------------------------------------------------------------------------- 00054 // 00055 void CIsvTelCallAppContainer::ConstructL( const TRect& aRect ) 00056 { 00057 // Creates window. 00058 CreateWindowL(); 00059 00060 // Creates label object. 00061 CreateLabelL(); 00062 00063 SetRect( aRect ); // Sets rectangle of frame. 00064 ActivateL(); // Activates the window. (Ready to draw) 00065 } 00066 00067 // ---------------------------------------------------------------------------- 00068 // CIsvTelCallAppContainer::~CIsvTelCallAppContainer() 00069 // Destructor. 00070 // ---------------------------------------------------------------------------- 00071 // 00072 CIsvTelCallAppContainer::~CIsvTelCallAppContainer() 00073 { 00074 delete iLabel; 00075 } 00076 00077 // ---------------------------------------------------------------------------- 00078 // void CIsvTelCallAppContainer::SetTextToLabelL( TInt ) 00079 // 00080 // ---------------------------------------------------------------------------- 00081 // 00082 void CIsvTelCallAppContainer::SetTextToLabelL( TInt aResourceId ) 00083 { 00084 TBuf<KIsvTelCallAppMessageBufLength> messageString( NULL ); 00085 iCoeEnv->ReadResource( messageString, aResourceId ); 00086 iLabel->SetTextL( messageString ); 00087 } 00088 00089 // ---------------------------------------------------------------------------- 00090 // void CIsvTelCallAppContainer::DisplayFormL( TInt, TInt ) 00091 // 00092 // ---------------------------------------------------------------------------- 00093 // 00094 void CIsvTelCallAppContainer::DisplayFormL( 00095 TInt aResourceId, 00096 TInt aPageId) 00097 { 00098 CIsvTelCallAppDlg* form = CIsvTelCallAppDlg::NewL(); 00099 form->SetTitlePane(iView->GetTitlePaneL()); 00100 form->SetContainer(this); 00101 form->SetDlgPage(aPageId); 00102 form->ExecuteLD( aResourceId ); 00103 } 00104 00105 // ---------------------------------------------------------------------------- 00106 // void CIsvTelCallAppContainer::BringToForeGroundL( ) 00107 // 00108 // ---------------------------------------------------------------------------- 00109 // 00110 void CIsvTelCallAppContainer::BringToForeGroundL( ) 00111 { 00112 iView->ActivateViewL(iView->ViewId()); 00113 } 00114 00115 // ---------------------------------------------------------------------------- 00116 // void CIsvTelCallAppContainer::CreateLabelL() 00117 // Creates label object. 00118 // ---------------------------------------------------------------------------- 00119 // 00120 void CIsvTelCallAppContainer::CreateLabelL() 00121 { 00122 if ( !iLabel ) 00123 { 00124 iLabel = new( ELeave ) CEikLabel; 00125 iLabel->SetContainerWindowL( *this ); 00126 iLabel->SetAlignment( EHCenterVCenter ); 00127 #ifdef __AVKON_APAC__ 00128 iLabel->SetFont( ApacPlain16() ); 00129 #else 00130 iLabel->SetFont( LatinBold19() ); 00131 #endif 00132 } 00133 SetTextToLabelL( R_ISVTELCALLAPP_TEXT_LABEL_TITLE ); 00134 } 00135 00136 // ---------------------------------------------------------------------------- 00137 // TKeyResponse CIsvTelCallAppContainer::OfferKeyEventL( const TKeyEvent&, 00138 // TEventCode ) 00139 // Handles the key events. 00140 // ---------------------------------------------------------------------------- 00141 // 00142 TKeyResponse CIsvTelCallAppContainer::OfferKeyEventL( 00143 const TKeyEvent& aKeyEvent, 00144 TEventCode aType ) 00145 { 00146 if ( aType != EEventKey ) // Is not key event? 00147 { 00148 return EKeyWasNotConsumed; 00149 } 00150 switch ( aKeyEvent.iCode ) // The code of key event is... 00151 { 00152 default: 00153 return EKeyWasNotConsumed; 00154 } 00155 } 00156 00157 // ---------------------------------------------------------------------------- 00158 // void CIsvTelCallAppContainer::SizeChanged() 00159 // Called by framework when the view size is changed 00160 // ---------------------------------------------------------------------------- 00161 // 00162 void CIsvTelCallAppContainer::SizeChanged() 00163 { 00164 iLabel->SetRect( Rect() ); 00165 } 00166 00167 // ---------------------------------------------------------------------------- 00168 // TInt CIsvTelCallAppContainer::CountComponentControls() const 00169 // Returns number of component. 00170 // ---------------------------------------------------------------------------- 00171 // 00172 TInt CIsvTelCallAppContainer::CountComponentControls() const 00173 { 00174 // returns nbr of controls inside this container 00175 return KIsvTelCallAppCountComponent; 00176 } 00177 00178 // ---------------------------------------------------------------------------- 00179 // CCoeControl* CIsvTelCallAppContainer::ComponentControl( TInt ) const 00180 // Returns pointer to particular component. 00181 // ---------------------------------------------------------------------------- 00182 // 00183 CCoeControl* CIsvTelCallAppContainer::ComponentControl( TInt aIndex ) const 00184 { 00185 switch ( aIndex ) // Component is... 00186 { 00187 case EIsvTelCallAppComponentLabel: // Label object. 00188 { 00189 return iLabel; 00190 } 00191 default: // Exception : returns NULL value. 00192 { 00193 return NULL; 00194 } 00195 00196 } 00197 } 00198 00199 // ---------------------------------------------------------------------------- 00200 // void CIsvTelCallAppContainer::Draw( const TRect& ) const 00201 // Clears the window's rectangle. 00202 // ---------------------------------------------------------------------------- 00203 // 00204 void CIsvTelCallAppContainer::Draw( const TRect& aRect ) const 00205 { 00206 CWindowGc& gc = SystemGc(); 00207 gc.SetPenStyle( CGraphicsContext::ENullPen ); 00208 gc.SetBrushColor( ISVTELCALLAPP_BACKGROUND_COLOR ); 00209 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); 00210 gc.DrawRect( aRect ); 00211 } 00212 00213 // End of File
|
© Nokia 2006 |