S60 3rd Edition SDK for Symbian OS
Example Applications Guide

CSimpleLightAppUi Class Reference

#include <SimpleLightAppUi.h>

List of all members.

Public Member Functions

void ConstructL ()
virtual ~CSimpleLightAppUi ()

Private Member Functions

void DynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane)
void HandleCommandL (TInt aCommand)
virtual TKeyResponse HandleKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType)

Private Attributes

CSimpleLightContainer * iAppContainer


Detailed Description

Application UI class that is contains the CSimpleLightContainer (as required by the Symbian UI application architecture).

Definition at line 36 of file SimpleLightAppUi.h.


Constructor & Destructor Documentation

CSimpleLightAppUi::~CSimpleLightAppUi (   )  [virtual]
 

Destructor. Removes CSimpleLightContainer from the control stack and destroys it.

Definition at line 42 of file SimpleLightAppUi.cpp.

References iAppContainer.

00043     {
00044     if ( iAppContainer )
00045         {
00046         RemoveFromStack( iAppContainer );
00047         delete iAppContainer;
00048         }
00049     }


Member Function Documentation

void CSimpleLightAppUi::ConstructL (   ) 
 

Second phase constructor. Creates the CSimpleLightContainer and adds it to the control stack.

Definition at line 32 of file SimpleLightAppUi.cpp.

References CSimpleLightContainer::ConstructL(), and iAppContainer.

00033     {
00034     BaseConstructL();
00035     iAppContainer = new (ELeave) CSimpleLightContainer;
00036     iAppContainer->SetMopParent(this);
00037     iAppContainer->ConstructL( ClientRect() );
00038     AddToStackL( iAppContainer );
00039     }

void CSimpleLightAppUi::DynInitMenuPaneL (  TInt  aResourceId,
CEikMenuPane *  aMenuPane
)  [private]
 

This method is called by the EIKON framework just before it displays a menu pane. Builds the dynamic menuitems for toggling the lights on and off in the example.

Definition at line 59 of file SimpleLightAppUi.cpp.

References iAppContainer, CSimpleLight::iLampEnabled, CSimpleLight::iLightingEnabled, CSimpleLightContainer::iSimpleLight, and CSimpleLight::iSpotEnabled.

00061     {
00062     // Item texts for the lighting menu. 
00063     if ( aResourceId == R_SIMPLELIGHT_LIGHTING_MENU )
00064         {
00065         // Text for switching the lights on/off. 
00066         if ( iAppContainer->iSimpleLight->iLightingEnabled )
00067             {
00068             aMenuPane->SetItemTextL( ESimpleLightLights, R_LIGHTS_OFF );
00069             }
00070         else
00071             {
00072             aMenuPane->SetItemTextL( ESimpleLightLights, R_LIGHTS_ON  );
00073             }
00074         
00075         // Text for switching the lamp on/off. 
00076         if ( iAppContainer->iSimpleLight->iLampEnabled )
00077             {
00078             aMenuPane->SetItemTextL( ESimpleLightLamp, R_LAMP_OFF );
00079             }
00080         else
00081             {
00082             aMenuPane->SetItemTextL( ESimpleLightLamp, R_LAMP_ON );
00083             }
00084         
00085         // Text for switching the spot on/off. 
00086         if ( iAppContainer->iSimpleLight->iSpotEnabled )
00087             {
00088             aMenuPane->SetItemTextL( ESimpleLightSpot, R_SPOT_OFF );
00089             }
00090         else
00091             {
00092             aMenuPane->SetItemTextL( ESimpleLightSpot, R_SPOT_ON );
00093             }
00094         }
00095     }

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

CEikAppUi method that is used to handle user commands. Handles menu commands and application exit request.

Parameters:
aCommand Command to be handled.

Definition at line 113 of file SimpleLightAppUi.cpp.

References CSimpleLight::DuckModel(), CSimpleLight::HeadModel(), iAppContainer, CSimpleLightContainer::iSimpleLight, CSimpleLight::ToggleLamp(), CSimpleLight::ToggleLighting(), and CSimpleLight::ToggleSpot().

00114     {
00115     switch ( aCommand )
00116         {
00117         case EAknSoftkeyBack:
00118         case EEikCmdExit:
00119             {
00120             Exit();
00121             break;
00122             }
00123         case ESimpleLightLights:
00124             iAppContainer->iSimpleLight->ToggleLighting();
00125             break;
00126         case ESimpleLightLamp:
00127             iAppContainer->iSimpleLight->ToggleLamp();
00128             break;
00129         case ESimpleLightSpot:
00130             iAppContainer->iSimpleLight->ToggleSpot();
00131             break;
00132         case ESimpleLightDuck:
00133             iAppContainer->iSimpleLight->DuckModel();
00134             break;
00135         case ESimpleLightHead:
00136             iAppContainer->iSimpleLight->HeadModel();
00137             break;
00138         default:
00139             break;      
00140         }
00141     }

TKeyResponse CSimpleLightAppUi::HandleKeyEventL (  const TKeyEvent &  aKeyEvent,
TEventCode  aType
)  [private, virtual]
 

CEikAppUi method that is used to handle key events. Does nothing in this implemenation.

Parameters:
aKeyEvent Event to handled (ignored by this implementation).
aType Type of the key event (ignored by this implementation).
Returns:
Response code. Always EKeyWasNotConsumed in this implementation.

Definition at line 102 of file SimpleLightAppUi.cpp.

00104     {
00105     return EKeyWasNotConsumed;
00106     }


Member Data Documentation

CSimpleLightContainer* CSimpleLightAppUi::iAppContainer [private]
 

GUI container that resides in this application UI.

Definition at line 81 of file SimpleLightAppUi.h.


© Nokia 2006

Back to top