S60 3rd Edition SDK for Symbian OS
Example Applications Guide

CHelloWorldBasicAppUi Class Reference

#include <helloworldbasicappui.h>

List of all members.

Public Member Functions

void ConstructL ()
 CHelloWorldBasicAppUi ()
virtual ~CHelloWorldBasicAppUi ()

Private Member Functions

void HandleCommandL (TInt aCommand)
void HandleStatusPaneSizeChange ()

Private Attributes

CHelloWorldBasicAppView * iAppView


Detailed Description

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

Definition at line 33 of file helloworldbasicappui.h.


Constructor & Destructor Documentation

CHelloWorldBasicAppUi::CHelloWorldBasicAppUi (   ) 
 

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

Definition at line 77 of file helloworldbasicappui.cpp.

00078     {
00079     // No implementation required
00080     }

CHelloWorldBasicAppUi::~CHelloWorldBasicAppUi (   )  [virtual]
 

~CHelloWorldBasicAppUi. Virtual Destructor.

Definition at line 87 of file helloworldbasicappui.cpp.

References iAppView.

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


Member Function Documentation

void CHelloWorldBasicAppUi::ConstructL (   ) 
 

ConstructL. 2nd phase constructor.

Definition at line 40 of file helloworldbasicappui.cpp.

References iAppView, and CHelloWorldBasicAppView::NewL().

00041     {
00042     // Initialise app UI with standard value.
00043     BaseConstructL(CAknAppUi::EAknEnableSkin);
00044 // Here the Hello.txt file can be created, if it is not copied automatically.
00045 /*
00046         RFs fsSession;
00047         User::LeaveIfError(fsSession.Connect());            
00048 
00049     RFile file;
00050         
00051     // Create a file to write the text to       
00052         if ( file.Replace(fsSession, KHelloFileName, EFileWrite ) != KErrNone )
00053         {
00054                 return;
00055         }
00056         CleanupClosePushL( file );            
00057         
00058         RFileWriteStream outputFileStream( file );
00059         CleanupClosePushL( outputFileStream );
00060         outputFileStream << KHelloText;
00061 
00062     CleanupStack::PopAndDestroy(2); // file, outputFileStream
00063 
00064         fsSession.Close();
00065 */
00066 
00067     // Create view object
00068     iAppView = CHelloWorldBasicAppView::NewL( ClientRect() );
00069 
00070     
00071     }

void CHelloWorldBasicAppUi::HandleCommandL (  TInt  aCommand  )  [private]
 

From CEikAppUi, HandleCommandL. Takes care of command handling.

Parameters:
aCommand Command to be handled.

Definition at line 102 of file helloworldbasicappui.cpp.

00103     {
00104     switch( aCommand )
00105         {
00106         case EEikCmdExit:
00107         case EAknSoftkeyExit:
00108             Exit();
00109             break;
00110 
00111         case EHelloWorldBasicCommand1:
00112             {
00113             
00114             // Load a string from the resource file and display it
00115             HBufC* textResource = StringLoader::LoadLC( R_HEWB_COMMAND1_TEXT );
00116             CAknInformationNote* informationNote;
00117 
00118             informationNote = new ( ELeave ) CAknInformationNote;
00119 
00120             // Show the information Note with
00121             // textResource loaded with StringLoader.
00122             informationNote->ExecuteLD( *textResource);
00123 
00124             // Pop HBuf from CleanUpStack and Destroy it.
00125             CleanupStack::PopAndDestroy( textResource );
00126             }
00127             break;
00128                 case EHelloWorldBasicCommand2:
00129                         {
00130                         
00131                         RFs fsSession;
00132                         RFile rFile;
00133                         
00134                         // Connects a client process to the fileserver
00135                         User::LeaveIfError(fsSession.Connect());
00136                         CleanupClosePushL(fsSession);
00137                         
00138                         //Open file where the stream text is
00139                         User::LeaveIfError(rFile.Open(fsSession,KHelloFileName, EFileStreamText));//EFileShareReadersOnly));// EFileStreamText));
00140                         CleanupClosePushL(rFile);
00141                         
00142                         // copy stream from file to RFileStream object
00143                         RFileReadStream inputFileStream(rFile);
00144                 CleanupClosePushL(inputFileStream);
00145                 
00146                 // HBufC descriptor is created from the RFileStream object.
00147                 HBufC* fileData = HBufC::NewLC(inputFileStream, 32);
00148 
00149             CAknInformationNote* informationNote;
00150 
00151             informationNote = new ( ELeave ) CAknInformationNote;
00152             // Show the information Note
00153             informationNote->ExecuteLD( *fileData);                     
00154                         
00155                         // Pop loaded resources from the cleanup stack
00156                         CleanupStack::PopAndDestroy(4); // filedata, inputFileStream, rFile, fsSession
00157                         fsSession.Close();
00158                         }
00159                         break;
00160         default:
00161             Panic( EHelloWorldBasicUi );
00162             break;
00163         }
00164     }

void CHelloWorldBasicAppUi::HandleStatusPaneSizeChange (   )  [private]
 

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

Definition at line 171 of file helloworldbasicappui.cpp.

References iAppView.

00172 {
00173         iAppView->SetRect( ClientRect() );
00174         
00175 } 


Member Data Documentation

CHelloWorldBasicAppView* CHelloWorldBasicAppUi::iAppView [private]
 

The application view Owned by CHelloWorldBasicAppUi

Definition at line 79 of file helloworldbasicappui.h.


© Nokia 2006

Back to top