Nokia N97 SDK
Example Applications Guide

CSimpleLightAppUi Class Reference

#include <SimpleLightAppUi.h>

Inheritance diagram for CSimpleLightAppUi:

List of all members.

Detailed Description

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

Definition at line 33 of file SimpleLightAppUi.h.


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


Constructor & Destructor Documentation

CSimpleLightAppUi::~CSimpleLightAppUi (   )  [virtual]
 

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

Definition at line 39 of file SimpleLightAppUi.cpp.

References iAppContainer.

00040     {
00041     if ( iAppContainer )
00042         {
00043         RemoveFromStack( iAppContainer );
00044         delete iAppContainer;
00045         }
00046     }


Member Function Documentation

void CSimpleLightAppUi::ConstructL (   ) 
 

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

Definition at line 29 of file SimpleLightAppUi.cpp.

References CSimpleLightContainer::ConstructL(), and iAppContainer.

00030     {
00031     BaseConstructL();
00032     iAppContainer = new (ELeave) CSimpleLightContainer;
00033     iAppContainer->SetMopParent(this);
00034     iAppContainer->ConstructL( ClientRect(), this );
00035     AddToStackL( iAppContainer );
00036     }

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 56 of file SimpleLightAppUi.cpp.

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

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

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 110 of file SimpleLightAppUi.cpp.

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

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

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 99 of file SimpleLightAppUi.cpp.

00101     {
00102     return EKeyWasNotConsumed;
00103     }


Member Data Documentation

CSimpleLightContainer* CSimpleLightAppUi::iAppContainer [private]
 

GUI container that resides in this application UI.

Definition at line 78 of file SimpleLightAppUi.h.

Referenced by ConstructL(), DynInitMenuPaneL(), HandleCommandL(), and ~CSimpleLightAppUi().


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

© Nokia 2009

Back to top