S60 3rd Edition SDK for Symbian OS
Example Applications Guide

CTextureAppUi Class Reference

#include <TextureAppUi.h>

List of all members.

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


Detailed Description

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

Definition at line 39 of file TextureAppUi.h.


Constructor & Destructor Documentation

CTextureAppUi::~CTextureAppUi (   )  [virtual]
 

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

Definition at line 49 of file TextureAppUi.cpp.

References iAppContainer.

00050 {
00051     if (iAppContainer)
00052     {
00053         RemoveFromStack( iAppContainer );
00054         delete iAppContainer;
00055     }
00056 }


Member Function Documentation

void CTextureAppUi::ConstructL (   ) 
 

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

Definition at line 32 of file TextureAppUi.cpp.

References CTextureContainer::ConstructL(), and iAppContainer.

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

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 66 of file TextureAppUi.cpp.

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

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

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 137 of file TextureAppUi.cpp.

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

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

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

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

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


Member Data Documentation

CTextureContainer* CTextureAppUi::iAppContainer [private]
 

GUI container that resides in this application UI.

Definition at line 86 of file TextureAppUi.h.


© Nokia 2006

Back to top