Example Application Guide

 

CGeoProfilesContainer Class Reference

#include <geoprofilescontainer.h>

Inheritance diagram for CGeoProfilesContainer:

List of all members.

Detailed Description

GeoProfiles Application's Container class. This class is the chief windowing component of GeoProfiles which displays the List of Tagged profiles

Definition at line 37 of file geoprofilescontainer.h.

Public Member Functions

 ~CGeoProfilesContainer ()
void UpdateL (CGeoProfilesLBModel &aListboxModel)
TInt GetFocussedItem ()

Static Public Member Functions

static CGeoProfilesContainerNewL (const TRect &aRect, CGeoProfilesLBModel &aListboxModel, CGeoProfilesView &aView)

Protected Member Functions

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

Private Member Functions

 CGeoProfilesContainer (CGeoProfilesLBModel &aListboxModel, CGeoProfilesView &aView)
void ConstructL (const TRect &aRect)
void MakeTitleL (TInt aResourceText)
void CreateListboxL ()

Private Attributes

CGeoProfilesLBModeliListboxModel
CAknSettingStyleListBox * iListBox
CGeoProfilesViewiView


Constructor & Destructor Documentation

CGeoProfilesContainer::~CGeoProfilesContainer  ) 
 

Virtual destructor

Definition at line 57 of file geoprofilescontainer.cpp.

References iListBox.

00058     {
00059     // Delete the list box
00060     delete iListBox;
00061     
00062     }

CGeoProfilesContainer::CGeoProfilesContainer CGeoProfilesLBModel aListboxModel,
CGeoProfilesView aView
[private]
 

C++ Default constructor

Definition at line 46 of file geoprofilescontainer.cpp.

Referenced by NewL().

00048     :iListboxModel( &aListboxModel ),
00049     iView( aView )
00050     {
00051     }


Member Function Documentation

CGeoProfilesContainer * CGeoProfilesContainer::NewL const TRect &  aRect,
CGeoProfilesLBModel aListboxModel,
CGeoProfilesView aView
[static]
 

Static Two phase constructor

Parameters:
[in] aRect,Client Rectangle for this window owning control.

Definition at line 68 of file geoprofilescontainer.cpp.

References CGeoProfilesContainer().

00072     {
00073     CGeoProfilesContainer* self = new (ELeave) CGeoProfilesContainer( aListboxModel,
00074                                                                       aView );
00075     CleanupStack::PushL( self );
00076     self->ConstructL( aRect );
00077     CleanupStack::Pop();
00078     
00079     return self;
00080     }

void CGeoProfilesContainer::UpdateL CGeoProfilesLBModel aListboxModel  ) 
 

Updates the container

Definition at line 106 of file geoprofilescontainer.cpp.

References iListBox, and iListboxModel.

Referenced by CGeoProfilesView::ProfileStatusChangedL().

00107     {
00108     // Store the new list box model
00109     iListboxModel = &aListboxModel;
00110     
00111     // Assign it to the listbox
00112     iListBox->Model()->SetItemTextArray( iListboxModel );
00113     
00114     // Update the list box
00115     iListBox->HandleItemAdditionL();
00116     iListBox->HandleItemRemovalL();
00117     
00118     DrawDeferred();
00119     }

TInt CGeoProfilesContainer::GetFocussedItem  ) 
 

Returns the currently focussed element.

Definition at line 125 of file geoprofilescontainer.cpp.

References iListBox.

Referenced by CGeoProfilesView::ContainerCommandL().

00126     {
00127     if ( !iListBox )
00128         {
00129         return KErrNotFound;        
00130         }
00131     else 
00132         {
00133         return iListBox->CurrentItemIndex();
00134         }
00135     }

void CGeoProfilesContainer::SizeChanged  )  [protected]
 

Inherited from CCoeControl

Definition at line 141 of file geoprofilescontainer.cpp.

References iListBox.

00142     {
00143     if ( iListBox )
00144         {
00145         iListBox->SetRect( Rect());
00146         }
00147     }

TInt CGeoProfilesContainer::CountComponentControls  )  const [protected]
 

Inherited from CCoeControl

Definition at line 153 of file geoprofilescontainer.cpp.

References iListBox.

00154     {
00155     if ( iListBox )
00156         {
00157         return 1;    
00158         }
00159     else
00160         {
00161         return 0;    
00162         }
00163     }

CCoeControl * CGeoProfilesContainer::ComponentControl TInt  aIndex  )  const [protected]
 

Inherited from CCoeControl

Definition at line 169 of file geoprofilescontainer.cpp.

References iListBox.

00170     {
00171     return iListBox;
00172     }

TKeyResponse CGeoProfilesContainer::OfferKeyEventL const TKeyEvent &  aKeyEvent,
TEventCode  aType
[protected]
 

Inherited from CCoeControl

Definition at line 178 of file geoprofilescontainer.cpp.

References iListBox.

00181     {
00182     switch ( aKeyEvent.iCode )
00183         {
00184         case EKeyLeftArrow:
00185         case EKeyRightArrow:
00186             {
00187             // No action in this application for the Right arrow and left
00188             // arrow.
00189             return EKeyWasNotConsumed;  
00190             }
00191         default:
00192             {
00193             break;  
00194             }
00195         }
00196     return iListBox->OfferKeyEventL( aKeyEvent, aType ); 
00197     }   

void CGeoProfilesContainer::HandleResourceChange TInt  aType  )  [protected]
 

Inherited from CCoeControl

Definition at line 203 of file geoprofilescontainer.cpp.

References CGeoProfilesView::ContainerCommandL(), and iView.

00204         {
00205     // Pass the event to the base class
00206     CCoeControl::HandleResourceChange( aType );
00207     
00208     switch( aType )
00209         {
00210         // Dynamic Layout switch and Skin Change
00211         case KEikDynamicLayoutVariantSwitch:
00212             {
00213             iView.ContainerCommandL( aType );
00214             break;
00215             }        
00216         case KAknsMessageSkinChange:
00217             {
00218             break;
00219             }
00220         default:
00221             {
00222             break;
00223             }
00224         }       
00225         }

void CGeoProfilesContainer::HandleListBoxEventL CEikListBox *  aListBox,
TListBoxEvent  aEventType
[protected]
 

Inherited from MEikListBoxObserver

Definition at line 231 of file geoprofilescontainer.cpp.

References CGeoProfilesView::ContainerCommandL(), and iView.

00234     {
00235     switch (aEventType)
00236         {
00237         // List box Item Selection
00238         case EEventEnterKeyPressed:
00239         case EEventItemDoubleClicked:
00240             {
00241             iView.ContainerCommandL( EGeoProfilesOpen );
00242             break;  
00243             }
00244         default:
00245            break;
00246         }        
00247     }

void CGeoProfilesContainer::FocusChanged TDrawNow  aDrawNow  )  [protected]
 

Focus changes event

Definition at line 254 of file geoprofilescontainer.cpp.

References iListBox.

00255     {
00256     CCoeControl::FocusChanged( aDrawNow );
00257     // The focus event has to be explicitly handed over to all the compound
00258     // controls since CCoeControl does not do that implicitly
00259     iListBox->SetFocus( IsFocused(), aDrawNow );
00260     }

void CGeoProfilesContainer::ConstructL const TRect &  aRect  )  [private]
 

Second phase of the two phase constructor

Definition at line 86 of file geoprofilescontainer.cpp.

References CreateListboxL(), and MakeTitleL().

00087     {
00088     // This is the cheif control for this application. This has to be made a 
00089     // Window owning control
00090     CreateWindowL();
00091     
00092         // Create a New Title for the View
00093         MakeTitleL( R_GEOPROFILES_TITLE );
00094     
00095     // Create the Geo Profiles list box
00096     CreateListboxL();
00097             
00098     SetRect(aRect);
00099     ActivateL();
00100     }

void CGeoProfilesContainer::MakeTitleL TInt  aResourceText  )  [private]
 

Sets the Title text

Parameters:
aResourceText Resource to create title

Definition at line 301 of file geoprofilescontainer.cpp.

Referenced by ConstructL().

00302         {
00303         CEikStatusPane* statusPane = 
00304             static_cast<CEikStatusPane*>( iEikonEnv->AppUiFactory()->StatusPane());
00305         // Obtain the title from the Status Pane
00306         CAknTitlePane* title = static_cast<CAknTitlePane*>( statusPane->
00307         ControlL( TUid::Uid( EEikStatusPaneUidTitle )));
00308        
00309     // Set the Title's buffer    
00310     HBufC* buf = StringLoader::LoadL( aResourceText );
00311     title->SetText( buf ); // Takes ownership of buf
00312         }

void CGeoProfilesContainer::CreateListboxL  )  [private]
 

Creates the Geo profiles List box

Definition at line 266 of file geoprofilescontainer.cpp.

References iListBox, and iListboxModel.

Referenced by ConstructL().

00267     {
00268     
00269     // Create the List box
00270     iListBox = new ( ELeave ) CAknSettingStyleListBox;
00271     iListBox->ConstructL( this, EAknListBoxSelectionList );
00272     iListBox->SetContainerWindowL( *this ); 
00273     iListBox->SetListBoxObserver( this );
00274     iListBox->CreateScrollBarFrameL( ETrue );
00275     iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,
00276                                                          CEikScrollBarFrame::EAuto ); 
00277                                                          
00278     // The ownership of the list box model is retained with the Container.
00279     // This is because the model contains the additional functionality of
00280     // changing the settings values in addition to retreiving it.                                                        
00281     iListBox->Model()->SetItemTextArray( iListboxModel );  
00282     iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
00283     
00284     // Set empty text for the list box
00285     HBufC* emptyText = StringLoader::LoadLC( R_LBL_GEOPROFILES_NOPROFILES );
00286     // Set text for empty list
00287     CEikListBox* listbox = iListBox;
00288     listbox->View()->SetListEmptyTextL( *emptyText );
00289     CleanupStack::PopAndDestroy( emptyText );
00290                                          
00291     iListBox->ActivateL();
00292     }


Member Data Documentation

CGeoProfilesLBModel* CGeoProfilesContainer::iListboxModel [private]
 

Reference to the list box model Does not own

Definition at line 133 of file geoprofilescontainer.h.

Referenced by CreateListboxL(), and UpdateL().

CAknSettingStyleListBox* CGeoProfilesContainer::iListBox [private]
 

Settings list box for Geo Profiles list Owns

Definition at line 139 of file geoprofilescontainer.h.

Referenced by ComponentControl(), CountComponentControls(), CreateListboxL(), FocusChanged(), GetFocussedItem(), OfferKeyEventL(), SizeChanged(), UpdateL(), and ~CGeoProfilesContainer().

CGeoProfilesView& CGeoProfilesContainer::iView [private]
 

Reference to the Container's view

Definition at line 144 of file geoprofilescontainer.h.

Referenced by HandleListBoxEventL(), and HandleResourceChange().


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

© Nokia 2009

Back to top