Nokia N97 SDK
Example Applications Guide

CDataMobilityAppMenuContainer Class Reference

#include <datamobilityappmenucontainer.h>

Inheritance diagram for CDataMobilityAppMenuContainer:

List of all members.

Detailed Description

CDataMobilityAppMenuContainer container control class.

Definition at line 30 of file datamobilityappmenucontainer.h.


Public Member Functions

void  ConstructL (const TRect &aRect)
  ~CDataMobilityAppMenuContainer ()
TInt  GetActiveLine () const
void  HandleSelectedListItemL (TInt aIndex) const

Private Member Functions

void  SizeChanged ()
TInt  CountComponentControls () const
CCoeControl *  ComponentControl (TInt aIndex) const
void  HandleListBoxEventL (CEikListBox *aListBox, TListBoxEvent aEventType)
TKeyResponse  OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType)
virtual void  HandleResourceChange (TInt aType)

Private Attributes

CEikTextListBox *  iListBox


Constructor & Destructor Documentation

CDataMobilityAppMenuContainer::~CDataMobilityAppMenuContainer (   ) 
 

Destructor.

Definition at line 55 of file datamobilityappmenucontainer.cpp.

References iListBox.

00056     {
00057     if( iListBox )
00058         {
00059         delete iListBox;
00060         iListBox = NULL;
00061         }
00062     }


Member Function Documentation

void CDataMobilityAppMenuContainer::ConstructL (  const TRect &  aRect  ) 
 

Symbian OS default constructor.

Parameters:
aRect  Frame rectangle for container.

Definition at line 31 of file datamobilityappmenucontainer.cpp.

References iListBox.

Referenced by CDataMobilityAppMenuView::DoActivateL().

00032     {
00033     CreateWindowL();
00034 
00035     iListBox = new ( ELeave ) CAknSingleStyleListBox();
00036     iListBox->SetContainerWindowL( *this );
00037     TResourceReader reader;
00038     iCoeEnv->CreateResourceReaderLC( reader, R_MENU_LISTBOX );
00039     iListBox->SetListBoxObserver( this );
00040     iListBox->ConstructFromResourceL( reader );
00041     CleanupStack::PopAndDestroy(); // resource stuffs.
00042     iListBox->ActivateL(); // Sets control as ready to be drawn
00043 
00044     SetRect( aRect );
00045     ActivateL();
00046     }

TInt CDataMobilityAppMenuContainer::GetActiveLine (   )  const
 

Get currently selected items index.

Returns:
Current item index.

Definition at line 188 of file datamobilityappmenucontainer.cpp.

References iListBox.

Referenced by CDataMobilityAppMenuView::HandleCommandL().

00189     {
00190     return iListBox->CurrentItemIndex();
00191     }

void CDataMobilityAppMenuContainer::HandleSelectedListItemL (  TInt  aIndex  )  const
 

Method HandleSelectedListItemL handles valid index.

Parameters:
aIndex  Current item index.

Definition at line 127 of file datamobilityappmenucontainer.cpp.

Referenced by CDataMobilityAppMenuView::HandleCommandL(), and HandleListBoxEventL().

00128     {
00129     CEikAppUi* appUi = static_cast<CEikAppUi*>( iCoeEnv->AppUi() );
00130 
00131     // Change active view.
00132     switch ( aIndex )
00133         {
00134         case 0:
00135             appUi->HandleCommandL( EAppUIGoToStandardApplication );
00136             break;
00137         case 1:
00138             appUi->HandleCommandL( EAppUIGoToApplicationUsingSnap );
00139             break;
00140         case 2:
00141             appUi->HandleCommandL( EAppUIGoToTriggeringConnectionDialog );
00142             break;
00143         case 3:
00144             appUi->HandleCommandL( EAppUIGoToALRApplication );
00145             break;
00146         case 4:
00147             appUi->HandleCommandL( EAppUIGoToALRApplicationUsingDefaultConnection );
00148             break;
00149         case 5:
00150             appUi->HandleCommandL( EAppUIGoToUsingConnectionSetting );
00151             break;
00152         default:
00153             break;
00154         }
00155     }

void CDataMobilityAppMenuContainer::SizeChanged (   )  [private]
 

From CoeControl,SizeChanged. Called by framework when the view size is changed.

Definition at line 70 of file datamobilityappmenucontainer.cpp.

References iListBox.

00071     {
00072     if ( iListBox )
00073         {
00074         iListBox->SetRect( Rect() ); // Sets rectangle of listbox.
00075         }
00076     }

TInt CDataMobilityAppMenuContainer::CountComponentControls (   )  const [private]
 

From CoeControl,CountComponentControls.

Returns:
Number of controls indside this container.

Definition at line 84 of file datamobilityappmenucontainer.cpp.

00085     {
00086     return 1;
00087     }

CCoeControl * CDataMobilityAppMenuContainer::ComponentControl (  TInt  aIndex  )  const [private]
 

From CCoeControl,ComponentControl. Gets the specified component of a compound control.

Parameters:
aIndex  The index of the control to get.
Returns:
The component control with an index of aIndex.

Definition at line 95 of file datamobilityappmenucontainer.cpp.

References iListBox.

00096     {
00097     switch ( aIndex )
00098         {
00099         case 0:
00100             return iListBox;
00101         default:
00102             return NULL;
00103         }
00104     }

void CDataMobilityAppMenuContainer::HandleListBoxEventL (  CEikListBox *  aListBox,
TListBoxEvent  aEventType
)  [private]
 

Handles list box events.

Parameters:
aListBox  The originating list box.
aEventType  A code for the event. Further information may be obtained by accessing the list box itself.

Definition at line 112 of file datamobilityappmenucontainer.cpp.

References HandleSelectedListItemL().

00114     {
00115     if ( aEventType == EEventEnterKeyPressed && aListBox )
00116         {
00117         HandleSelectedListItemL( aListBox->CurrentItemIndex() );
00118         }
00119     }

TKeyResponse CDataMobilityAppMenuContainer::OfferKeyEventL (  const TKeyEvent &  aKeyEvent,
TEventCode  aType
)  [private]
 

From CCoeControl,OfferKeyEventL Handles key events.

Parameters:
aKeyEvent  The key event.
aType  The type of key event.
Returns:
Indicates whether or not the key event was used by this control.

Definition at line 163 of file datamobilityappmenucontainer.cpp.

References iListBox.

00165     {
00166     if ( aType != EEventKey )
00167         {
00168         return EKeyWasNotConsumed;
00169         }
00170 
00171     // Offers key events to list box
00172     if ( iListBox )
00173         {
00174         return iListBox->OfferKeyEventL( aKeyEvent, aType );
00175         }
00176     else
00177         {
00178         return EKeyWasNotConsumed;
00179         }
00180     }

void CDataMobilityAppMenuContainer::HandleResourceChange (  TInt  aType  )  [private, virtual]
 

From CCoeControl,OfferKeyEventL Called by framework when the view layout is changed.

Parameters:
aType  The type of resource change.

Definition at line 199 of file datamobilityappmenucontainer.cpp.

00200     {
00201     CCoeControl::HandleResourceChange( aType );
00202 
00203     // ADDED FOR SCALABLE UI SUPPORT
00204     // *****************************
00205     if ( aType == KEikDynamicLayoutVariantSwitch )
00206         {
00207         TRect rect;
00208         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
00209         SetRect( rect );
00210         }
00211     }


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

© Nokia 2009

Back to top