|
Nokia N97 SDK Example Applications Guide |
00001 /* 00002 * ============================================================================ 00003 * Name : datamobilityappoutputcontainer.cpp 00004 * Part of : datamobility 00005 * Description : CDataMobilityAppOutputContainer implementation. 00006 * 00007 * Copyright (c) 2007 Nokia Corporation. 00008 * This material, including documentation and any related 00009 * computer programs, is protected by copyright controlled by 00010 * Nokia Corporation. 00011 * ============================================================================ 00012 */ 00013 00014 // INCLUDE FILES 00015 #include <AknUtils.h> 00016 #include "datamobilityappoutputcontainer.h" 00017 #include "datamobility.hrh" 00018 00019 #include "standardapplication.h" 00020 #include "applicationusingsnap.h" 00021 #include "alrapplication.h" 00022 #include "applicationtriggeringconndlg.h" 00023 #include "alrapplicationusingnopref.h" 00024 #include "applicationusinguisettings.h" 00025 00026 00027 // ============================ MEMBER FUNCTIONS =============================== 00028 00029 // ----------------------------------------------------------------------------- 00030 // CDataMobilityAppOutputContainer::ConstructL 00031 // 00032 // Symbian OS two phased constructor. 00033 // ----------------------------------------------------------------------------- 00034 // 00035 void CDataMobilityAppOutputContainer::ConstructL( const TRect& aRect, 00036 TInt aObjectToStart ) 00037 { 00038 CreateWindowL(); 00039 00040 iLinesToPrint = new ( ELeave ) CDesCArrayFlat( 8 ); 00041 00042 iAllowedToPrint = ETrue; 00043 00044 iApplication = NULL; 00045 00046 switch( aObjectToStart ) 00047 { 00048 case EAppUIGoToStandardApplication: 00049 { 00050 CStandardApplication* standardApplication = 00051 CStandardApplication::NewL( *this ); 00052 CleanupStack::PushL( standardApplication ); 00053 00054 standardApplication->StartL(); 00055 00056 CleanupStack::Pop( standardApplication ); 00057 00058 iApplication = standardApplication; 00059 break; 00060 } 00061 case EAppUIGoToApplicationUsingSnap: 00062 { 00063 CApplicationUsingSNAP* applicationUsingSNAP = 00064 CApplicationUsingSNAP::NewL( *this ); 00065 00066 CleanupStack::PushL( applicationUsingSNAP ); 00067 00068 applicationUsingSNAP->StartL(); 00069 00070 CleanupStack::Pop( applicationUsingSNAP ); 00071 00072 iApplication = applicationUsingSNAP; 00073 break; 00074 } 00075 case EAppUIGoToTriggeringConnectionDialog: 00076 { 00077 CApplicationTriggeringConnDlg* applicationTriggeringConnDlg = 00078 CApplicationTriggeringConnDlg::NewL( *this ); 00079 00080 CleanupStack::PushL( applicationTriggeringConnDlg ); 00081 00082 applicationTriggeringConnDlg->StartL(); 00083 00084 CleanupStack::Pop( applicationTriggeringConnDlg ); 00085 00086 iApplication = applicationTriggeringConnDlg; 00087 break; 00088 } 00089 case EAppUIGoToALRApplication: 00090 { 00091 CALRApplication* alrApplication = CALRApplication::NewL( *this ); 00092 00093 CleanupStack::PushL( alrApplication ); 00094 00095 alrApplication->StartL(); 00096 00097 CleanupStack::Pop( alrApplication ); 00098 00099 iApplication = alrApplication; 00100 break; 00101 } 00102 case EAppUIGoToALRApplicationUsingDefaultConnection: 00103 { 00104 CALRApplicationUsingNoPref* alrApplicationUsingNoPref = 00105 CALRApplicationUsingNoPref::NewL( *this ); 00106 00107 CleanupStack::PushL( alrApplicationUsingNoPref ); 00108 00109 alrApplicationUsingNoPref->StartL(); 00110 00111 CleanupStack::Pop( alrApplicationUsingNoPref ); 00112 00113 iApplication = alrApplicationUsingNoPref; 00114 break; 00115 } 00116 case EAppUIGoToUsingConnectionSetting: 00117 { 00118 CApplicationUsingUiSettings* applicationUsingUiSettings = 00119 CApplicationUsingUiSettings::NewL( *this ); 00120 00121 CleanupStack::PushL( applicationUsingUiSettings ); 00122 00123 applicationUsingUiSettings->StartL(); 00124 00125 CleanupStack::Pop( applicationUsingUiSettings ); 00126 00127 iApplication = applicationUsingUiSettings; 00128 break; 00129 } 00130 default: 00131 break; 00132 } 00133 00134 00135 SetRect( aRect ); 00136 ActivateL(); 00137 } 00138 00139 // ---------------------------------------------------------------------------- 00140 // CDataMobilityAppOutputContainer::~CDataMobilityAppOutputContainer 00141 // 00142 // Destructor. 00143 // ---------------------------------------------------------------------------- 00144 // 00145 CDataMobilityAppOutputContainer::~CDataMobilityAppOutputContainer() 00146 { 00147 iAllowedToPrint = EFalse; 00148 delete iApplication; 00149 delete iLinesToPrint; 00150 } 00151 00152 // ---------------------------------------------------------------------------- 00153 // CDataMobilityAppOutputContainer::Draw 00154 // 00155 // Draw a control, called by window server. 00156 // ---------------------------------------------------------------------------- 00157 // 00158 void CDataMobilityAppOutputContainer::Draw( const TRect& aRect ) const 00159 { 00160 // Get the standard graphics context 00161 CWindowGc& gc = SystemGc(); 00162 00163 // Clears the screen 00164 gc.Clear( aRect ); 00165 00166 // draw all the texts to the screen 00167 gc.UseFont( AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont ) ); 00168 00169 gc.SetPenColor( KRgbBlack ); 00170 00171 for ( TInt i( 0 ); i < iLinesToPrint->Count(); ++i ) 00172 { 00173 gc.DrawText( iLinesToPrint->MdcaPoint( i ), 00174 TPoint( KTextXMargin, KTextMinY+ 00175 ( i*KTextDistanceBetweenLines ) ) ); 00176 } 00177 00178 gc.DiscardFont(); 00179 } 00180 00181 // ---------------------------------------------------------------------------- 00182 // CDataMobilityAppOutputContainer::Print 00183 // 00184 // Print one line of text in the output view. 00185 // ---------------------------------------------------------------------------- 00186 // 00187 void CDataMobilityAppOutputContainer::Print( const TDesC& aLine ) 00188 { 00189 if ( iAllowedToPrint ) 00190 { 00191 TRAP_IGNORE( iLinesToPrint->AppendL( aLine ) ) 00192 DrawNow(); 00193 } 00194 } 00195 00196 // --------------------------------------------------------- 00197 // CDataMobilityAppOutputContainer::HandleResourceChange() 00198 // 00199 // Called by framework when layout is changed. 00200 // --------------------------------------------------------- 00201 // 00202 void CDataMobilityAppOutputContainer::HandleResourceChange( TInt aType ) 00203 { 00204 CCoeControl::HandleResourceChange( aType ); 00205 00206 // ADDED FOR SCALABLE UI SUPPORT 00207 // ***************************** 00208 if ( aType == KEikDynamicLayoutVariantSwitch ) 00209 { 00210 TRect rect; 00211 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect ); 00212 SetRect( rect ); 00213 } 00214 } 00215 00216 // End of File
|
© Nokia 2009 |