Nokia N97 SDK
Example Applications Guide

CBillboardInput Class Reference

#include <Billboardinput.h>

List of all members.


Detailed Description

Class that handles the mapping of scancodes to input signals that can then be queried from the application. When the program is initialized this class reference is given by the CBillboardContainer to CBillboard. CBillboardContainer class then notifies this class of key presses and releases. If an input signal mapping exists for a scancode the state of that input signal's state is modified. The CBillboard class can then query the state of the various input signal's from this class.

Note that this class supports mapping of multiple scancodes to a single input signal. But only one input signal can be mapped to one scancode (that means single keypress can't change multiple input signals to pressed state).

Definition at line 70 of file Billboardinput.h.


Public Member Functions

virtual  ~CBillboardInput ()
TKeyResponse  KeyDown (const int aKeyCode)
TKeyResponse  KeyUp (const int aKeyCode)
TBool  IsInputPressed (TUint aInput)

Static Public Member Functions

static CBillboardInput *  NewL ()

Protected Member Functions

  CBillboardInput ()
void  ConstructL (void)

Private Attributes

TBool *  iInputPressed


Constructor & Destructor Documentation

CBillboardInput::~CBillboardInput (   )  [virtual]
 

Destructor. Does nothing.

Definition at line 77 of file Billboardinput.cpp.

References iInputPressed.

00078     {
00079     delete iInputPressed;
00080     }

CBillboardInput::CBillboardInput (   )  [protected]
 

Standard constructor that must never Leave.

Definition at line 54 of file Billboardinput.cpp.

Referenced by NewL().

00055     {
00056     }


Member Function Documentation

CBillboardInput * CBillboardInput::NewL (   )  [static]
 

Factory method for creating a new CBillboard object. Calls the hidden constructors.

Definition at line 36 of file Billboardinput.cpp.

References CBillboardInput().

Referenced by CBillboardContainer::ConstructL().

00037     {
00038     // Symbian 2-phase constructor. Calls both the default
00039     // C++ constructor and Symbian ConstructL methods
00040     CBillboardInput* self = new (ELeave) CBillboardInput();
00041     CleanupStack::PushL( self );
00042     self->ConstructL();
00043     CleanupStack::Pop();
00044 
00045     return self;
00046     }

void CBillboardInput::ConstructL (  void   )  [protected]
 

Second phase constructor that can call methods that may leave. Does nothing.

Definition at line 63 of file Billboardinput.cpp.

References iInputPressed.

00064     {
00065     iInputPressed = new (ELeave) TBool[ MAX_NUM_INPUTS ];
00066     for( int i = 0; i < MAX_NUM_INPUTS; i++ )
00067         {
00068         iInputPressed[i] = EFalse;
00069         }
00070     }

TKeyResponse CBillboardInput::KeyDown (  const int  aKeyCode  ) 
 

If a signal mapping exists for the given keycode, then that input signal is set to pressed state.

Parameters:
aKeyCode  One of the values defined in TStdScanCode.

Definition at line 87 of file Billboardinput.cpp.

Referenced by CBillboardContainer::OfferKeyEventL().

00088 {
00089     TInt inputIdx = -1;
00090     for( int i = 0; i < KKeyCodeMapSize; i +=2 )
00091         {
00092         if( KKeyCodeMap[i] == aKeyCode )
00093             {
00094             inputIdx = KKeyCodeMap[i + 1];
00095             break;
00096             }
00097         }
00098 
00099     if( inputIdx >= 0 )
00100     {
00101         iInputPressed[ inputIdx ] = ETrue;
00102                 return EKeyWasConsumed;
00103     }
00104 
00105     return EKeyWasNotConsumed;
00106 }

TKeyResponse CBillboardInput::KeyUp (  const int  aKeyCode  ) 
 

If a signal mapping exists for the given keycode, then that input signal is set to non-pressed state.

Parameters:
aKeyCode  One of the values defined in TStdScanCode.

Definition at line 113 of file Billboardinput.cpp.

00114 {
00115     TInt inputIdx = -1;
00116     for( int i = 0; i < KKeyCodeMapSize; i +=2 )
00117         {
00118         if( KKeyCodeMap[i] == aKeyCode )
00119             {
00120             inputIdx = KKeyCodeMap[i + 1];
00121             break;
00122             }
00123         }
00124 
00125     if( inputIdx >= 0 )
00126     {
00127         iInputPressed[ inputIdx ] = EFalse;
00128                 return EKeyWasConsumed;
00129     }
00130 
00131     return EKeyWasNotConsumed;
00132 }

TBool CBillboardInput::IsInputPressed (  TUint  aInput  ) 
 

Returns whether or not a given input signal is pressed at the moment or not.

Parameters:
aInput  One of the defined input signal values.
Returns:
ETrue if the given input is pressed or EFalse if it is not pressed.

Definition at line 139 of file Billboardinput.cpp.

Referenced by CBillboard::MoveCamera().

00140 {
00141     return iInputPressed[ aInput ];
00142 }


Member Data Documentation

TBool* CBillboardInput::iInputPressed [private]
 

Pressed status for each input.

Definition at line 124 of file Billboardinput.h.

Referenced by ConstructL(), and ~CBillboardInput().


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

© Nokia 2009

Back to top