|
Nokia N97 SDK Example Applications Guide |
#include <HsWidgetAppUi.h>
Inheritance diagram for CHsWidgetAppUi:

Definition at line 28 of file HsWidgetAppUi.h.
Public Member Functions |
|
| void | ConstructL () |
| CHsWidgetAppUi () | |
| virtual | ~CHsWidgetAppUi () |
| void | DynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane) |
Private Member Functions |
|
| void | HandleCommandL (TInt aCommand) |
| void | HandleStatusPaneSizeChange () |
| void | HandleResourceChangeL (TInt aType) |
| CArrayFix< TCoeHelpContext > * | HelpContextL () const |
| TBool | ProcessCommandParametersL (CApaCommandLine &aCommandLine) |
Private Attributes |
|
| CHsWidgetAppView * | iAppView |
| CHsWidgetExample * | iWidgetExample |
| CHsSMWidgetExample * | iSMWidgetExample |
|
|
CHsWidgetAppUi. C++ default constructor. This needs to be public due to the way the framework constructs the AppUi Definition at line 76 of file HsWidgetAppUi.cpp.
|
|
|
~CHsWidgetAppUi. Virtual Destructor. Definition at line 86 of file HsWidgetAppUi.cpp. References iSMWidgetExample, iWidgetExample, and CHsSMWidgetExample::RemoveWidgetL(). 00087 { 00088 __LOGSTR_TOFILE("Enter CHsWidgetAppUi::~CHsWidgetAppUi"); 00089 00090 // delete the widget example 00091 // note that the widget is not unregistered 00092 // thus it will still remain at user's disposal 00093 delete iWidgetExample; 00094 00095 00096 // remove and delete this widget 00097 // if already selected by the user on the homescreen 00098 // the widget will be closed 00099 if(iSMWidgetExample!=NULL) 00100 { 00101 iSMWidgetExample->RemoveWidgetL(); 00102 delete iSMWidgetExample; 00103 iSMWidgetExample = NULL; 00104 } 00105 00106 if (iAppView) 00107 { 00108 delete iAppView; 00109 iAppView = NULL; 00110 } 00111 00112 __LOGSTR_TOFILE("Exit CHsWidgetAppUi::~CHsWidgetAppUi"); 00113 __LOGSTR_TOFILE("===================================="); 00114 }
|
|
|
ConstructL. 2nd phase constructor. Definition at line 44 of file HsWidgetAppUi.cpp. References iAppView, iSMWidgetExample, iWidgetExample, CHsSMWidgetExample::NewL(), CHsWidgetExample::NewL(), CHsWidgetAppView::NewL(), CHsSMWidgetExample::RegisterWidgetL(), CHsWidgetExample::RegisterWidgetL(), and CHsSMWidgetExample::RemoveWidgetL(). 00045 { 00046 __LOGSTR_TOFILE("Enter CHsWidgetAppUi::ConstructL"); 00047 00048 // Initialise app UI with standard value. 00049 BaseConstructL(CAknAppUi::EAknEnableSkin); 00050 00051 // Create view object 00052 iAppView = CHsWidgetAppView::NewL(ClientRect() ); 00053 00054 // if the example widget already exists when the application is started 00055 // it is possible that it was itself that lauched the 00056 // application thus we want to reconnect with it quickly 00057 // and receive its events 00058 iWidgetExample = CHsWidgetExample::NewL(); 00059 iWidgetExample->RegisterWidgetL(); 00060 00061 // if the SM Widget exists when the application starts it must be due 00062 // to a phone reboot while the widget was registered 00063 iSMWidgetExample = CHsSMWidgetExample::NewL(); 00064 iSMWidgetExample->RegisterWidgetL(); 00065 iSMWidgetExample->RemoveWidgetL(); 00066 delete iSMWidgetExample; 00067 iSMWidgetExample = NULL; 00068 00069 __LOGSTR_TOFILE("Exit CHsWidgetAppUi::ConstructL"); 00070 }
|
|
||||||||||||
|
DynInitMenuPaneL. Dynamically initialises a menu pane.
Definition at line 248 of file HsWidgetAppUi.cpp. References iSMWidgetExample, and iWidgetExample. 00249 { 00250 if( aResourceId != R_MENU ) 00251 { 00252 return; 00253 } 00254 if( iWidgetExample == NULL) 00255 { 00256 aMenuPane->SetItemDimmed( ERegisterWidget, EFalse ); 00257 aMenuPane->SetItemDimmed( EChangeWidgetValues, ETrue ); 00258 aMenuPane->SetItemDimmed( ERemoveWidget, ETrue ); 00259 } 00260 else 00261 { 00262 aMenuPane->SetItemDimmed( ERegisterWidget, ETrue ); 00263 aMenuPane->SetItemDimmed( EChangeWidgetValues, EFalse ); 00264 aMenuPane->SetItemDimmed( ERemoveWidget, EFalse ); 00265 } 00266 if( iSMWidgetExample == NULL) 00267 { 00268 aMenuPane->SetItemDimmed( ERegisterSMWidget, EFalse ); 00269 aMenuPane->SetItemDimmed( ERemoveSMWidget, ETrue ); 00270 } 00271 else 00272 { 00273 aMenuPane->SetItemDimmed( ERegisterSMWidget, ETrue ); 00274 aMenuPane->SetItemDimmed( ERemoveSMWidget, EFalse ); 00275 } 00276 00277 }
|
|
|
From CEikAppUi, HandleCommandL. Takes care of the command handling.
Definition at line 121 of file HsWidgetAppUi.cpp. References CHsWidgetExample::ChangeWidgetValuesL(), iSMWidgetExample, iWidgetExample, CHsSMWidgetExample::NewL(), CHsWidgetExample::NewL(), CHsWidgetExample::PublishWidgetL(), CHsSMWidgetExample::RegisterWidgetL(), CHsWidgetExample::RegisterWidgetL(), and CHsWidgetExample::RemoveWidgetL(). 00122 { 00123 __LOGSTR_TOFILE1("Enter CHsWidgetAppUi::HandleCommandL with aCommand = %d", aCommand); 00124 00125 switch (aCommand) 00126 { 00127 case EEikCmdExit: 00128 case EAknSoftkeyExit: 00129 Exit(); 00130 break; 00131 00132 case EAknSoftkeyBack: 00133 { 00134 TApaTask task( iEikonEnv->WsSession() ); 00135 task.SetWgId(iEikonEnv->RootWin().Identifier()); 00136 task.SendToBackground(); 00137 } 00138 break; 00139 00140 case ERegisterWidget: 00141 { 00142 if( !iWidgetExample) 00143 { 00144 iWidgetExample = CHsWidgetExample::NewL(); 00145 iWidgetExample->RegisterWidgetL(); 00146 } 00147 } 00148 break; 00149 case EChangeWidgetValues: 00150 { 00151 // set new content for the widget 00152 iWidgetExample->ChangeWidgetValuesL(); 00153 // publish the content 00154 iWidgetExample->PublishWidgetL(); 00155 } 00156 break; 00157 case ERemoveWidget: 00158 { 00159 iWidgetExample->RemoveWidgetL(); 00160 delete iWidgetExample; 00161 iWidgetExample = NULL; 00162 } 00163 break; 00164 case ERegisterSMWidget: 00165 { 00166 if(!iSMWidgetExample) 00167 { 00168 iSMWidgetExample = CHsSMWidgetExample::NewL(); 00169 // register widget 00170 iSMWidgetExample->RegisterWidgetL(); 00171 } 00172 } 00173 break; 00174 case ERemoveSMWidget: 00175 { 00176 iSMWidgetExample->RemoveWidgetL(); 00177 delete iSMWidgetExample; 00178 iSMWidgetExample = NULL; 00179 } 00180 break; 00181 case EHelp: 00182 { 00183 CArrayFix<TCoeHelpContext>* buf = 00184 CCoeAppUi::AppHelpContextL(); 00185 HlpLauncher::LaunchHelpApplicationL( 00186 iEikonEnv->WsSession(), buf); 00187 } 00188 break; 00189 case EAbout: 00190 { 00191 CAknMessageQueryDialog* dlg = 00192 new (ELeave)CAknMessageQueryDialog(); 00193 dlg->PrepareLC(R_ABOUT_QUERY_DIALOG); 00194 HBufC* title = 00195 iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TITLE); 00196 dlg->QueryHeading()->SetTextL(*title); 00197 CleanupStack::PopAndDestroy(); //title 00198 HBufC* msg = 00199 iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TEXT); 00200 dlg->SetMessageTextL(*msg); 00201 CleanupStack::PopAndDestroy(); //msg 00202 dlg->RunLD(); 00203 } 00204 break; 00205 default: 00206 Panic(EHsWidgetUi); 00207 break; 00208 } 00209 00210 __LOGSTR_TOFILE("Exit CHsWidgetAppUi::HandleCommandL"); 00211 }
|
|
|
HandleStatusPaneSizeChange. Called by the framework when the application status pane size is changed. Definition at line 218 of file HsWidgetAppUi.cpp. References iAppView. 00219 { 00220 iAppView->SetRect(ClientRect() ); 00221 }
|
|
|
HandleResourceChangeL Called by the framework when system resources are changed, for example the change of current theme Definition at line 284 of file HsWidgetAppUi.cpp. References iSMWidgetExample, and CHsSMWidgetExample::SignalLevelChangedL(). 00285 { 00286 CAknAppUi::HandleResourceChangeL( aType ); 00287 if(aType == KAknsMessageSkinChange) 00288 { 00289 __LOGSTR_TOFILE(" * CHsWidgetAppUi::HandleResourceChangeL received KAknsMessageSkinChange"); 00290 // HsSMWidgetExample depends on skin collors, must be updated 00291 if(iSMWidgetExample != NULL) 00292 { 00293 iSMWidgetExample->SignalLevelChangedL(-1,-1); 00294 } 00295 } 00296 }
|
|
|
From CCoeAppUi, HelpContextL. Provides help context for the application. size is changed. Definition at line 223 of file HsWidgetAppUi.cpp. 00224 { 00225 //#warning "Please see comment about help and UID3..." 00226 // Note: Help will not work if the application uid3 is not in the 00227 // protected range. The default uid3 range for projects created 00228 // from this template (0xE0000000 - 0xEFFFFFFF) are not in the 00229 // protected range so that they can be self signed and installed 00230 // on the device during testing. 00231 // Once you get your official uid3 from Symbian Ltd. and find/replace 00232 // all occurrences of uid3 in your project, the context help will 00233 // work. 00234 CArrayFixFlat<TCoeHelpContext>* array = 00235 new(ELeave)CArrayFixFlat<TCoeHelpContext>(1); 00236 CleanupStack::PushL(array); 00237 array->AppendL(TCoeHelpContext(KUidHsWidgetApp, KGeneral_Information)); 00238 CleanupStack::Pop(array); 00239 return array; 00240 }
|
|
|
From CAknAppUi Intercept and process received command parameters Definition at line 303 of file HsWidgetAppUi.cpp. 00304 { 00305 __LOGSTR_TOFILE("Enter CHsWidgetAppUi::ProcessCommandParametersL"); 00306 00307 if (aCommandLine.OpaqueData().Length() > 0) 00308 { 00309 // Opaque data exists so application was probably started by: 00310 // - the user from the Menu grid 00311 // - the home screen application 00312 __LOGSTR_TOFILE("Has opaque data"); 00313 } 00314 else 00315 { 00316 // Opaque data does not exists, app. has been autostarted ? 00317 __LOGSTR_TOFILE("No opaque data"); 00318 } 00319 00320 __LOGSTR_TOFILE("Exit CHsWidgetAppUi::ProcessCommandParametersL"); 00321 00322 return CEikAppUi::ProcessCommandParametersL(aCommandLine); 00323 }
|
|
|
The application view Owned by CHsWidgetAppUi Definition at line 104 of file HsWidgetAppUi.h. Referenced by ConstructL(), and HandleStatusPaneSizeChange(). |
|
|
Pointer to Homescreen widget instance Definition at line 109 of file HsWidgetAppUi.h. Referenced by ConstructL(), DynInitMenuPaneL(), HandleCommandL(), and ~CHsWidgetAppUi(). |
|
|
Pointer to Homescreen widget instance Definition at line 114 of file HsWidgetAppUi.h. Referenced by ConstructL(), DynInitMenuPaneL(), HandleCommandL(), HandleResourceChangeL(), and ~CHsWidgetAppUi(). |
|
© Nokia 2009 |