Nokia N97 SDK
Example Applications Guide

CHsWidgetAppUi Class Reference

#include <HsWidgetAppUi.h>

Inheritance diagram for CHsWidgetAppUi:

List of all members.

Detailed Description

CHsWidgetAppUi application UI class. Interacts with the user through the UI and request message processing from the handler class

Definition at line 26 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 ()
CArrayFix< TCoeHelpContext > * HelpContextL () const

Private Attributes

CHsWidgetAppViewiAppView
CHsWidgetExampleiWidgetExample


Constructor & Destructor Documentation

CHsWidgetAppUi::CHsWidgetAppUi  ) 
 

CHsWidgetAppUi. C++ default constructor. This needs to be public due to the way the framework constructs the AppUi

Definition at line 77 of file HsWidgetAppUi.cpp.

00078         {
00079         // No implementation required
00080         }

CHsWidgetAppUi::~CHsWidgetAppUi  )  [virtual]
 

~CHsWidgetAppUi. Virtual Destructor.

Definition at line 87 of file HsWidgetAppUi.cpp.

References iAppView, and iWidgetExample.

00088         {
00089         if (iAppView)
00090                 {
00091                 delete iAppView;
00092                 iAppView = NULL;
00093                 }
00094         delete iWidgetExample;
00095         }


Member Function Documentation

void CHsWidgetAppUi::ConstructL  ) 
 

ConstructL. 2nd phase constructor.

Definition at line 41 of file HsWidgetAppUi.cpp.

References iAppView, and CHsWidgetAppView::NewL().

00042         {
00043         // Initialise app UI with standard value.
00044         BaseConstructL(CAknAppUi::EAknEnableSkin);
00045 
00046         // Create view object
00047         iAppView = CHsWidgetAppView::NewL(ClientRect() );
00048 
00049         // Create a file to write the text to
00050         TInt err = CCoeEnv::Static()->FsSession().MkDirAll(KFileName);
00051         if ( (KErrNone != err) && (KErrAlreadyExists != err))
00052                 {
00053                 return;
00054                 }
00055 
00056         RFile file;
00057         err = file.Replace(CCoeEnv::Static()->FsSession(), KFileName, EFileWrite);
00058         CleanupClosePushL(file);
00059         if (KErrNone != err)
00060                 {
00061                 CleanupStack::PopAndDestroy(1); // file
00062                 return;
00063                 }
00064 
00065         RFileWriteStream outputFileStream(file);
00066         CleanupClosePushL(outputFileStream);
00067         outputFileStream << KText;
00068 
00069         CleanupStack::PopAndDestroy(2); // outputFileStream, file
00070 
00071         }

void CHsWidgetAppUi::DynInitMenuPaneL TInt  aResourceId,
CEikMenuPane *  aMenuPane
 

DynInitMenuPaneL. Dynamically initialises a menu pane..

Parameters:
aResourceId 
aMenuPane The in-memory representation of the menu bar.

Definition at line 192 of file HsWidgetAppUi.cpp.

References iWidgetExample.

00193         {
00194         if( aResourceId != R_MENU )
00195                 {
00196                 return;
00197                 }
00198         if( !iWidgetExample )
00199                 {
00200             aMenuPane->SetItemDimmed( ERegisterWidget, EFalse );
00201             aMenuPane->SetItemDimmed( EChangeWidgetValues, ETrue );
00202             aMenuPane->SetItemDimmed( ERemoveWidget, ETrue );
00203             }
00204         else
00205                 {
00206                 aMenuPane->SetItemDimmed( ERegisterWidget, ETrue );
00207             aMenuPane->SetItemDimmed( EChangeWidgetValues, EFalse );
00208             aMenuPane->SetItemDimmed( ERemoveWidget, EFalse );
00209                 }
00210         }

void CHsWidgetAppUi::HandleCommandL TInt  aCommand  )  [private]
 

From CEikAppUi, HandleCommandL. Takes care of command handling.

Parameters:
aCommand Command to be handled.

Definition at line 102 of file HsWidgetAppUi.cpp.

References CHsWidgetExample::ChangeWidgetValuesL(), iWidgetExample, CHsWidgetExample::NewL(), CHsWidgetExample::RegisterWidget(), and CHsWidgetExample::RemoveWidget().

00103         {
00104         switch (aCommand)
00105                 {
00106                 case EEikCmdExit:
00107                 case EAknSoftkeyExit:
00108                         Exit();
00109                         break;
00110 
00111                 case ERegisterWidget:
00112                         {
00113                         if( !iWidgetExample)
00114                                 {
00115                                 iWidgetExample = CHsWidgetExample::NewL();
00116                                 }
00117                         iWidgetExample->RegisterWidget();
00118                         }
00119                         break;
00120                 case EChangeWidgetValues:
00121                         {
00122                         iWidgetExample->ChangeWidgetValuesL();
00123                         }
00124                         break;
00125                 case ERemoveWidget:
00126                         {
00127                         iWidgetExample->RemoveWidget();
00128                         delete iWidgetExample;
00129                         iWidgetExample = NULL;
00130                         }
00131                         break;
00132                 case EHelp:
00133                         {
00134 
00135                         CArrayFix<TCoeHelpContext>* buf = CCoeAppUi::AppHelpContextL();
00136                         HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), buf);
00137                         }
00138                         break;
00139                 case EAbout:
00140                         {
00141 
00142                         CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
00143                         dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
00144                         HBufC* title = iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TITLE);
00145                         dlg->QueryHeading()->SetTextL(*title);
00146                         CleanupStack::PopAndDestroy(); //title
00147                         HBufC* msg = iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TEXT);
00148                         dlg->SetMessageTextL(*msg);
00149                         CleanupStack::PopAndDestroy(); //msg
00150                         dlg->RunLD();
00151                         }
00152                         break;
00153                 default:
00154                         Panic(EHsWidgetUi);
00155                         break;
00156                 }
00157         }

void CHsWidgetAppUi::HandleStatusPaneSizeChange  )  [private]
 

HandleStatusPaneSizeChange. Called by the framework when the application status pane size is changed.

Definition at line 164 of file HsWidgetAppUi.cpp.

References iAppView.

00165         {
00166         iAppView->SetRect(ClientRect() );
00167         }

CArrayFix< TCoeHelpContext > * CHsWidgetAppUi::HelpContextL  )  const [private]
 

From CCoeAppUi, HelpContextL. Provides help context for the application. size is chaluenged.

Definition at line 169 of file HsWidgetAppUi.cpp.

00170         {
00171 //#warning "Please see comment about help and UID3..."
00172         // Note: Help will not work if the application uid3 is not in the
00173         // protected range.  The default uid3 range for projects created
00174         // from this template (0xE0000000 - 0xEFFFFFFF) are not in the protected range so that they
00175         // can be self signed and installed on the device during testing.
00176         // Once you get your official uid3 from Symbian Ltd. and find/replace
00177         // all occurrences of uid3 in your project, the context help will
00178         // work.
00179         CArrayFixFlat<TCoeHelpContext>* array = new(ELeave)CArrayFixFlat<TCoeHelpContext>(1);
00180         CleanupStack::PushL(array);
00181         array->AppendL(TCoeHelpContext(KUidHsWidgetApp, KGeneral_Information));
00182         CleanupStack::Pop(array);
00183         return array;
00184         }


Member Data Documentation

CHsWidgetAppView* CHsWidgetAppUi::iAppView [private]
 

The application view Owned by CHsWidgetAppUi

Definition at line 89 of file HsWidgetAppUi.h.

Referenced by ConstructL(), HandleStatusPaneSizeChange(), and ~CHsWidgetAppUi().


The documentation for this class was generated from the following files:

© Nokia 2009

Back to top