Nokia N97 SDK
Example Applications Guide

CTextureAppUi Class Reference

#include <TextureAppUi.h>

Inheritance diagram for CTextureAppUi:

List of all members.

Detailed Description

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

Definition at line 35 of file TextureAppUi.h.


Public Member Functions

void  ConstructL ()
virtual  ~CTextureAppUi ()

Private Member Functions

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

Private Attributes

CTextureContainer *  iAppContainer


Constructor & Destructor Documentation

CTextureAppUi::~CTextureAppUi (   )  [virtual]
 

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

Definition at line 46 of file TextureAppUi.cpp.

References iAppContainer.

00047 {
00048     if (iAppContainer)
00049     {
00050         RemoveFromStack( iAppContainer );
00051         delete iAppContainer;
00052     }
00053 }


Member Function Documentation

void CTextureAppUi::ConstructL (   ) 
 

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

Definition at line 29 of file TextureAppUi.cpp.

References CTextureContainer::ConstructL(), and iAppContainer.

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

void CTextureAppUi::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 various options in the example.

Definition at line 63 of file TextureAppUi.cpp.

References iAppContainer, CTexture::iPerspectiveCorrEnabled, CTextureContainer::iTexture, and CTexture::iTextureWrapEnabled.

00065 {
00066         /* Texts for menu items. */
00067     if( aResourceId == R_TEXTURE_MENU )
00068     {
00069         /* Text for perspective correction. */
00070         if( iAppContainer->iTexture->iPerspectiveCorrEnabled )
00071         {
00072             aMenuPane->SetItemTextL( ETexturePerspective, R_PERSPECTIVE_OFF );
00073         }
00074         else
00075         {
00076             aMenuPane->SetItemTextL( ETexturePerspective, R_PERSPECTIVE_ON );
00077         }
00078 
00079         /* Text for texture wrapping.*/
00080         if( iAppContainer->iTexture->iTextureWrapEnabled )
00081         {
00082             aMenuPane->SetItemTextL( ETextureWrapping, R_WRAPPING_OFF );
00083         }
00084         else
00085         {
00086             aMenuPane->SetItemTextL( ETextureWrapping, R_WRAPPING_ON );
00087         }
00088 
00089         /* Text for lighting.*/
00090         if( iAppContainer->iTexture->iLightingEnabled )
00091         {
00092             aMenuPane->SetItemTextL( ETextureLights, R_LIGHTS_OFF );
00093         }
00094         else
00095         {
00096             aMenuPane->SetItemTextL( ETextureLights, R_LIGHTS_ON );
00097         }
00098     }
00099 }

void CTextureAppUi::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 134 of file TextureAppUi.cpp.

References iAppContainer, CTextureContainer::iTexture, CTexture::ToggleLighting(), CTexture::TogglePerspective(), and CTexture::ToggleWrapping().

00135 {
00136     switch ( aCommand )
00137     {
00138     case EAknSoftkeyBack:
00139     case EEikCmdExit:
00140     {
00141         Exit();
00142         break;
00143     }
00144     case ETexturePerspective:
00145     {
00146         iAppContainer->iTexture->TogglePerspective();
00147         break;
00148     }
00149     case ETextureWrapping:
00150     {
00151         iAppContainer->iTexture->ToggleWrapping();
00152         break;
00153     }
00154     case ETextureLights:
00155         iAppContainer->iTexture->ToggleLighting();
00156         break;
00157     default:
00158         break;
00159     }
00160 }

TKeyResponse CTextureAppUi::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 107 of file TextureAppUi.cpp.

References iAppContainer, CTextureContainer::iTexture, and CTexture::ToggleBlending().

00109 {
00110     if ( iAppContainer->iTexture->GetState() == CTexture::ERunning )
00111                 {
00112                         if( aType == EEventKeyDown )
00113                         {
00114                             TUint scan = aKeyEvent.iScanCode;
00115 
00116                             switch(scan)
00117                             {
00118                             case(167):
00119                                         iAppContainer->iTexture->ToggleBlending();
00120                                         return EKeyWasConsumed;
00121                             default:
00122                                         return EKeyWasNotConsumed;
00123                             }
00124                         }
00125                 }
00126     return EKeyWasNotConsumed;
00127 }


Member Data Documentation

CTextureContainer* CTextureAppUi::iAppContainer [private]
 

GUI container that resides in this application UI.

Definition at line 82 of file TextureAppUi.h.

Referenced by ConstructL(), DynInitMenuPaneL(), HandleCommandL(), HandleKeyEventL(), and ~CTextureAppUi().


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

© Nokia 2009

Back to top