logsui/AppSrc/CLogsAppListControlContainer.cpp
changeset 0 e686773b3f54
child 68 9da50d567e3c
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *     Logs "Aplication List" view container control class implementation
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <AknIconArray.h>
       
    22 #include <aknnavide.h>
       
    23 #include <akntabgrp.h>
       
    24 #include <AknsConstants.h>      // for skinned icons
       
    25 
       
    26 #include <Logs.rsg>
       
    27 #include <logs.mbg>      // Index file for Logs icons.
       
    28 
       
    29 #include "CLogsAppListControlContainer.h"
       
    30 #include "CLogsBaseView.h"
       
    31 
       
    32 #include "Logs.hrh"
       
    33 #include "LogsIcons.hrh"
       
    34 
       
    35 #include "LogsUID.h" 
       
    36 #include <csxhelp/log.hlp.hrh>
       
    37 #include "CLogsNaviDecoratorWrapper.h"
       
    38 
       
    39 // EXTERNAL DATA STRUCTURES
       
    40 
       
    41 // EXTERNAL FUNCTION PROTOTYPES  
       
    42 
       
    43 // CONSTANTS
       
    44 
       
    45 // MACROS
       
    46 
       
    47 // LOCAL CONSTANTS AND MACROS
       
    48 
       
    49 // MODULE DATA STRUCTURES
       
    50 
       
    51 // LOCAL FUNCTION PROTOTYPES
       
    52 
       
    53 // ==================== LOCAL FUNCTIONS ====================
       
    54 
       
    55 // ================= MEMBER FUNCTIONS =======================
       
    56 
       
    57 
       
    58 // ----------------------------------------------------------------------------
       
    59 // CLogsAppListControlContainer::NewL
       
    60 // ----------------------------------------------------------------------------
       
    61 //
       
    62 CLogsAppListControlContainer* CLogsAppListControlContainer::NewL
       
    63         ( CLogsBaseView* aAppView, const TRect& aRect )
       
    64     {
       
    65     CLogsAppListControlContainer* self = new ( ELeave )
       
    66                             CLogsAppListControlContainer( aAppView );
       
    67     self->SetMopParent( aAppView );
       
    68     CleanupStack::PushL( self );
       
    69     self->ConstructL( aRect );
       
    70     CleanupStack::Pop();  // self
       
    71     return self;
       
    72     }
       
    73 
       
    74 // ----------------------------------------------------------------------------
       
    75 // CLogsAppListControlContainer::~CLogsAppListControlContainer
       
    76 // ----------------------------------------------------------------------------
       
    77 //
       
    78 CLogsAppListControlContainer::~CLogsAppListControlContainer()
       
    79     {
       
    80     delete iListBox;
       
    81     }
       
    82 
       
    83 // ----------------------------------------------------------------------------
       
    84 // CLogsAppListControlContainer::CLogsAppListControlContainer
       
    85 // ----------------------------------------------------------------------------
       
    86 //
       
    87 CLogsAppListControlContainer::CLogsAppListControlContainer
       
    88 	(	CLogsBaseView* aAppView
       
    89 	)
       
    90 	: CLogsBaseControlContainer( aAppView  ), iAppView( aAppView )
       
    91     {
       
    92     }
       
    93 
       
    94 // ----------------------------------------------------------------------------
       
    95 // CLogsAppListControlContainer::ConstructL
       
    96 // ----------------------------------------------------------------------------
       
    97 //
       
    98 void CLogsAppListControlContainer::ConstructL( const TRect& aRect )
       
    99     {
       
   100     BaseConstructL();
       
   101     CreateListBoxL();
       
   102     
       
   103     MakeScrollArrowsL( iListBox );
       
   104 
       
   105     // activate control and sub-controls
       
   106     SetRect( aRect );
       
   107     ActivateL();
       
   108     
       
   109     }
       
   110 
       
   111 // ----------------------------------------------------------------------------
       
   112 // CLogsAppListControlContainer::ComponentControl
       
   113 // ----------------------------------------------------------------------------
       
   114 //
       
   115 CCoeControl* CLogsAppListControlContainer::ComponentControl
       
   116         ( TInt /*aIndex*/ ) const
       
   117     {
       
   118     return iListBox;
       
   119     }
       
   120 
       
   121 // ----------------------------------------------------------------------------
       
   122 // CLogsAppListControlContainer::SizeChanged
       
   123 // ----------------------------------------------------------------------------
       
   124 //
       
   125 void CLogsAppListControlContainer::SizeChanged()
       
   126     {
       
   127     if( iListBox )
       
   128         {
       
   129         iListBox->SetRect( Rect() );
       
   130         }
       
   131     }
       
   132 
       
   133 // ----------------------------------------------------------------------------
       
   134 // CLogsAppListControlContainer::ListBox
       
   135 // ----------------------------------------------------------------------------
       
   136 //
       
   137 CAknDoubleLargeStyleListBox* CLogsAppListControlContainer::ListBox()
       
   138     {
       
   139     return iListBox;
       
   140     }
       
   141     
       
   142 // ----------------------------------------------------------------------------
       
   143 // CLogsAppListControlContainer::CreateListBoxL
       
   144 // ----------------------------------------------------------------------------
       
   145 //
       
   146 void CLogsAppListControlContainer::CreateListBoxL()
       
   147     {
       
   148     if( iListBox )
       
   149         {
       
   150         delete iListBox;
       
   151         iListBox = NULL;
       
   152         }
       
   153 
       
   154     iListBox = new( ELeave ) CAknDoubleLargeStyleListBox;
       
   155     iListBox->ConstructL( this, EAknListBoxSelectionList );
       
   156     CreateListBoxContentsL();    
       
   157     }
       
   158 
       
   159 
       
   160 // ----------------------------------------------------------------------------
       
   161 // CLogsAppListControlContainer::CreateListBoxContentsL
       
   162 // ----------------------------------------------------------------------------
       
   163 //
       
   164 void CLogsAppListControlContainer::CreateListBoxContentsL()
       
   165     {
       
   166     if( !iListBox )
       
   167         {
       
   168         return;
       
   169         }
       
   170         
       
   171     //  Creation of the items in which the temporary text will be inserted
       
   172     CDesCArrayFlat* items = new( ELeave )CDesCArrayFlat( KAppListCCNrOfItems);
       
   173     CleanupStack::PushL( items );
       
   174 
       
   175     // STM main view
       
   176     MakeListBoxLineL( items, KFirstIconAndTab, R_SUB_APP_CALL_REGISTER );
       
   177 
       
   178     // Call Timers view
       
   179     MakeListBoxLineL( items, KSecondIconAndTab, R_SUB_APP_CALL_TIMERS );
       
   180 
       
   181     // GPRS counter view
       
   182     MakeListBoxLineL( items, KThirdIconAndTab, R_SUB_APP_GPRS_COUNTER );
       
   183 
       
   184     //  Creation of the model, which handles the text items
       
   185     CTextListBoxModel* model = iListBox->Model();
       
   186     model->SetItemTextArray( items );
       
   187     model->SetOwnershipType( ELbmOwnsItemArray );
       
   188     CleanupStack::Pop();    // items
       
   189     iListBox->HandleItemAdditionL();
       
   190 
       
   191 	AddControlContainerIconsL();
       
   192 
       
   193     MakeTitleL( R_LOGS_TITLE_TEXT );
       
   194 
       
   195     CAknNavigationDecorator* decoratedTabGroup = NavigationTabGroupL( R_LOGS_NAVI_PANE_TAB_GROUP, 
       
   196                                                                       CLogsNaviDecoratorWrapper::InstanceL() );
       
   197 
       
   198     CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>( decoratedTabGroup->
       
   199                                     DecoratedControl() );
       
   200 	tabGroup->SetActiveTabById( EAppListTabId );
       
   201   
       
   202     }
       
   203     
       
   204 
       
   205 // ----------------------------------------------------------------------------
       
   206 // CLogsAppListControlContainer::GetHelpContext
       
   207 // ----------------------------------------------------------------------------
       
   208 //
       
   209 void CLogsAppListControlContainer::GetHelpContext( TCoeHelpContext& aContext ) const
       
   210 	{
       
   211     aContext.iMajor = TUid::Uid( KLogsAppUID3 );
       
   212     aContext.iContext = KLOGS_HLP_COUNTER;
       
   213     }
       
   214 
       
   215 // ----------------------------------------------------------------------------
       
   216 // CLogsAppListControlContainer::AddControlContainerIconsL
       
   217 // ----------------------------------------------------------------------------
       
   218 //
       
   219 void CLogsAppListControlContainer::AddControlContainerIconsL()
       
   220 	{
       
   221 	if( iListBox->ItemDrawer()->FormattedCellData()->IconArray() != NULL )
       
   222 		{
       
   223 		CArrayPtr<CGulIcon>* iconArray = iListBox->ItemDrawer()->FormattedCellData()->IconArray();
       
   224 		delete iconArray;
       
   225 		iconArray = NULL;
       
   226 		iListBox->ItemDrawer()->FormattedCellData()->SetIconArray( iconArray);        
       
   227 		}
       
   228 
       
   229 	// Load and assign icons to the list box control; 3 is number of icons
       
   230 	CAknIconArray* icons = new( ELeave ) CAknIconArray( KAppListCCNrOfItems );
       
   231 
       
   232 	iListBox->ItemDrawer()->FormattedCellData()->SetIconArray( icons );
       
   233 
       
   234 	// First icon & mask  ( Recent Calls )
       
   235 	AddIconL(	icons
       
   236 			,	KLogsIconFile
       
   237             ,   KAknsIIDQgnPropLogCallsSub
       
   238 			,	qgn_prop_log_calls_sub
       
   239 			,	qgn_prop_log_calls_sub_mask
       
   240 			);
       
   241 
       
   242 	// Second icon & mask  ( Call Timers )
       
   243 	AddIconL(	icons
       
   244 			,	KLogsIconFile
       
   245             ,   KAknsIIDQgnPropLogTimersSub
       
   246 			,	qgn_prop_log_timers_sub
       
   247 			,	qgn_prop_log_timers_sub_mask
       
   248 			);
       
   249 
       
   250 	// Third icon & mask  ( GPRS counter )
       
   251 	AddIconL(	icons
       
   252 			,	KLogsIconFile
       
   253             ,   KAknsIIDQgnPropLogGprsSub
       
   254 			,	qgn_prop_log_gprs_sub
       
   255 			,	qgn_prop_log_gprs_sub_mask
       
   256 			);
       
   257 	}
       
   258 	
       
   259 // ----------------------------------------------------------------------------
       
   260 // CLogsAppListControlContainer::FocusChanged
       
   261 //
       
   262 // This is needed to hand focus changes to list. Otherwise animations are not displayed.
       
   263 // ----------------------------------------------------------------------------
       
   264 //
       
   265 void CLogsAppListControlContainer::FocusChanged(TDrawNow /* aDrawNow */ )
       
   266     {
       
   267     if( iListBox)
       
   268         {
       
   269         iListBox->SetFocus( IsFocused() );
       
   270         }
       
   271     }	
       
   272 	
       
   273 
       
   274 //  End of File