logsui/AppSrc/CGprsCtControlContainer.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 "GPRS counter" view container control class implementation
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <AknIconArray.h>		// icon array
       
    22 #include <aknnavide.h>
       
    23 #include <akntabgrp.h>			// tab group
       
    24 #include <AknsConstants.h>      // for skinned icons
       
    25 
       
    26 #include <Logs.rsg>				// note structure
       
    27 #include <logs.mbg>				// Index file for Logs icons.
       
    28 #include "CGprsCtControlContainer.h"
       
    29 #include "CGprsCtView.h"
       
    30 #include "CLogsGprsCtAdapter.h"
       
    31 #include "CLogsEngine.h"
       
    32 #include "CLogsNaviDecoratorWrapper.h"
       
    33 
       
    34 #include "LogsIcons.hrh"
       
    35 #include "Logs.hrh"
       
    36 
       
    37 #include "LogsUID.h"
       
    38 #include <csxhelp/log.hlp.hrh>
       
    39 
       
    40 // EXTERNAL DATA STRUCTURES
       
    41 
       
    42 // EXTERNAL FUNCTION PROTOTYPES  
       
    43 
       
    44 // CONSTANTS
       
    45                     
       
    46 // MACROS
       
    47 
       
    48 // LOCAL CONSTANTS AND MACROS
       
    49 
       
    50 // MODULE DATA STRUCTURES
       
    51 
       
    52 // LOCAL FUNCTION PROTOTYPES
       
    53 
       
    54 // ==================== LOCAL FUNCTIONS ====================
       
    55 
       
    56 // ================= MEMBER FUNCTIONS =======================
       
    57 
       
    58 // ----------------------------------------------------------------------------
       
    59 // CGprsCtControlContainer::NewL
       
    60 // ----------------------------------------------------------------------------
       
    61 //
       
    62 CGprsCtControlContainer* CGprsCtControlContainer::NewL( 
       
    63     CLogsBaseView* aAppView,
       
    64     const TRect& aRect )
       
    65     {
       
    66     CGprsCtControlContainer* self = new( ELeave ) CGprsCtControlContainer( aAppView );
       
    67     self->SetMopParent( aAppView );
       
    68     CleanupStack::PushL( self );
       
    69     self->ConstructL( aRect );
       
    70     CleanupStack::Pop();  // self
       
    71     return self;
       
    72     }
       
    73 
       
    74 
       
    75 // ----------------------------------------------------------------------------
       
    76 // CGprsCtControlContainer::ConstructL
       
    77 // ----------------------------------------------------------------------------
       
    78 //
       
    79 void CGprsCtControlContainer::ConstructL( const TRect& aRect )
       
    80     {
       
    81     BaseConstructL();
       
    82     iListBox = new( ELeave ) CAknDoubleLargeStyleListBox; 
       
    83     iListBox->ConstructL( this, EEikListBoxMultipleSelection );
       
    84 
       
    85 	AddControlContainerIconsL();
       
    86 
       
    87     CLogsGprsCtAdapter* adapter = CLogsGprsCtAdapter::NewL( iAppView->
       
    88                                     Engine()->SharedDataL() );
       
    89     iListBox->Model()->SetItemTextArray( adapter );
       
    90     iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray );
       
    91 
       
    92     MakeTitleL( R_GPRS_COUNTER_TITLE_TEXT );
       
    93 
       
    94     CAknNavigationDecorator* decoratedTabGroup = NavigationTabGroupL( R_LOGS_SUB_APP_PANE_TAB_GROUP,
       
    95                                                                       CLogsNaviDecoratorWrapper::InstanceL() );
       
    96 
       
    97     CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>( decoratedTabGroup->
       
    98                                     DecoratedControl() );
       
    99     tabGroup->SetActiveTabById( ESubAppGprsTabId );
       
   100 
       
   101     MakeScrollArrowsL( iListBox );
       
   102     SetRect( aRect );
       
   103     ActivateL();
       
   104     }
       
   105 
       
   106 
       
   107 // ----------------------------------------------------------------------------
       
   108 // CGprsCtControlContainer::CGprsCtControlContainer
       
   109 // ----------------------------------------------------------------------------
       
   110 //
       
   111 CGprsCtControlContainer::CGprsCtControlContainer( CLogsBaseView* aAppView ):
       
   112     CLogsBaseControlContainer( aAppView ),
       
   113     iAppView( aAppView )
       
   114     {
       
   115     }
       
   116 
       
   117 // ----------------------------------------------------------------------------
       
   118 // CGprsCtControlContainer::~CGprsCtControlContainer
       
   119 // ----------------------------------------------------------------------------
       
   120 //
       
   121 CGprsCtControlContainer::~CGprsCtControlContainer()
       
   122     {
       
   123     delete iListBox;
       
   124     }
       
   125 
       
   126 
       
   127 // ----------------------------------------------------------------------------
       
   128 // CGprsCtControlContainer::ComponentControl
       
   129 //
       
   130 //  Returns the child controls at aIndex
       
   131 // ----------------------------------------------------------------------------
       
   132 //
       
   133 CCoeControl* CGprsCtControlContainer::ComponentControl
       
   134         ( TInt /*aIndex*/) const
       
   135     {
       
   136     return iListBox;
       
   137     }
       
   138 
       
   139 // ----------------------------------------------------------------------------
       
   140 // CGprsCtControlContainer::SizeChanged
       
   141 //
       
   142 // Called when control's size changed
       
   143 // ----------------------------------------------------------------------------
       
   144 //
       
   145 void CGprsCtControlContainer::SizeChanged()
       
   146     {
       
   147     if( iListBox )
       
   148         {
       
   149         iListBox->SetRect( Rect() );
       
   150         }
       
   151     }
       
   152 
       
   153 // ----------------------------------------------------------------------------
       
   154 // CGprsCtControlContainer::ListBox
       
   155 //
       
   156 // Returns the iListBox
       
   157 // ----------------------------------------------------------------------------
       
   158 //
       
   159 CAknDoubleLargeStyleListBox* CGprsCtControlContainer::ListBox()
       
   160     {
       
   161     return iListBox;
       
   162     }
       
   163 
       
   164 // ----------------------------------------------------------------------------
       
   165 // CGprsCtControlContainer::UpdateL
       
   166 // ----------------------------------------------------------------------------
       
   167 //
       
   168 void CGprsCtControlContainer::UpdateL()
       
   169     {
       
   170     iListBox->HandleItemAdditionL();
       
   171     }
       
   172 
       
   173 // ----------------------------------------------------------------------------
       
   174 // CGprsCtControlContainer::GetHelpContext
       
   175 // ----------------------------------------------------------------------------
       
   176 //
       
   177 void CGprsCtControlContainer::GetHelpContext( TCoeHelpContext& aContext ) const
       
   178 	{
       
   179     aContext.iMajor = TUid::Uid( KLogsAppUID3 );
       
   180     aContext.iContext = KGPRS_HLP_MAIN;
       
   181     }
       
   182 
       
   183 // ----------------------------------------------------------------------------
       
   184 // CGprsCtControlContainer::AddControlContainerIconsL
       
   185 // ----------------------------------------------------------------------------
       
   186 //
       
   187 void CGprsCtControlContainer::AddControlContainerIconsL()
       
   188 	{
       
   189 	if( iListBox->ItemDrawer()->ColumnData()->IconArray() != NULL )
       
   190 		{
       
   191 		CArrayPtr<CGulIcon>* iconArray = iListBox->ItemDrawer()->ColumnData()->IconArray();
       
   192 		delete iconArray;
       
   193 		iconArray = NULL;
       
   194 		iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconArray);  
       
   195 		}
       
   196 
       
   197 	// Load and assign icons to the list box control; 2 is number of icons
       
   198 	CAknIconArray* icons = new( ELeave ) CAknIconArray( KGprsCtCCNrOfItems );
       
   199 
       
   200 	iListBox->ItemDrawer()->ColumnData()->SetIconArray( icons );
       
   201 
       
   202 	AddIconL(	icons
       
   203 			,	KLogsIconFile
       
   204             ,   KAknsIIDQgnPropLogGprsSent      //AknsConstants.h
       
   205 			,	qgn_prop_log_gprs_sent          //LogsIcons.hrh
       
   206 			,	qgn_prop_log_gprs_sent_mask     //LogsIcons.hrh
       
   207 			);
       
   208 
       
   209 	AddIconL(	icons
       
   210 			,	KLogsIconFile
       
   211             ,   KAknsIIDQgnPropLogGprsReceived
       
   212 			,	qgn_prop_log_gprs_received
       
   213 			,	qgn_prop_log_gprs_received_mask
       
   214 			);
       
   215 	}
       
   216 	
       
   217 // ----------------------------------------------------------------------------
       
   218 // CGprsCtControlContainer::FocusChanged
       
   219 //
       
   220 // This is needed to hand focus changes to list. Otherwise animations are not displayed.
       
   221 // ----------------------------------------------------------------------------
       
   222 //
       
   223 void CGprsCtControlContainer::FocusChanged(TDrawNow /* aDrawNow */ )
       
   224     {
       
   225     if( iListBox)
       
   226         {
       
   227         iListBox->SetFocus( IsFocused() );
       
   228         }
       
   229     }	
       
   230 
       
   231 //  End of File