uifw/AvKon/src/AknCheckBoxSettingPage.cpp
changeset 0 2f259fa3e83a
child 15 08e69e956a8c
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-2009 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 *     Support for CheckBoxes in Popped up setting pages
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include "akncheckboxsettingpage.h"
       
    21 
       
    22 // For icon support
       
    23 #include <gulicon.h>
       
    24 #include <barsread.h>
       
    25 
       
    26 // For icon array support
       
    27 #include <AknIconArray.h>
       
    28 
       
    29 // lists
       
    30 #include <aknlists.h>
       
    31 
       
    32 #include <AknTasHook.h>
       
    33 // Used for setting 0 and 1 in the radio button
       
    34     _LIT(KOneSlashT, "1\t");
       
    35 
       
    36 // Selectable Item Array
       
    37 
       
    38 EXPORT_C CSelectableItem::CSelectableItem( TDesC& aItem, TBool aSelected ) :
       
    39     iDesC(aItem), iSelected( aSelected )
       
    40     {
       
    41     }
       
    42 
       
    43 
       
    44 EXPORT_C void CSelectableItem::ConstructL()
       
    45     {
       
    46     iItem = iDesC.AllocL();
       
    47     }
       
    48 
       
    49 CSelectableItem::~CSelectableItem()
       
    50     {
       
    51     delete ( iItem );
       
    52     }
       
    53 
       
    54 EXPORT_C void CSelectableItem::SetSelectionStatus( TBool aSelected )
       
    55     {
       
    56     iSelected = aSelected;
       
    57     }
       
    58 
       
    59 EXPORT_C TBool CSelectableItem::SelectionStatus()
       
    60     {
       
    61     return iSelected;
       
    62     }
       
    63 
       
    64 EXPORT_C TPtrC CSelectableItem::ItemText()
       
    65     {
       
    66     return (TPtrC)(*iItem);
       
    67     }
       
    68 
       
    69 
       
    70 EXPORT_C CSelectionItemList::CSelectionItemList(TInt aGranularity) : CArrayPtrFlat<CSelectableItem>( aGranularity )
       
    71     {
       
    72     }
       
    73 
       
    74 
       
    75 EXPORT_C TInt CSelectionItemList::MdcaCount() const
       
    76     {
       
    77     return Count();
       
    78     }
       
    79 
       
    80 EXPORT_C TPtrC CSelectionItemList::MdcaPoint(TInt anIndex) const
       
    81     {
       
    82     return ( (TPtrC)(   (At(anIndex))->ItemText()   ));
       
    83     }
       
    84 
       
    85 // Extension for CAknCheckBoxSettingPage
       
    86 NONSHARABLE_CLASS(CAknCheckBoxSettingPageExtension): public CBase
       
    87     {
       
    88 public:
       
    89     CAknCheckBoxSettingPageExtension();
       
    90 public:
       
    91     TBool iIsDragged;
       
    92     };
       
    93 
       
    94 CAknCheckBoxSettingPageExtension::CAknCheckBoxSettingPageExtension()
       
    95     : iIsDragged(EFalse)
       
    96     {
       
    97     }
       
    98 
       
    99 //////////////////////////////////////////////////////////////////////
       
   100 // Construction/Destruction
       
   101 //////////////////////////////////////////////////////////////////////
       
   102 
       
   103 
       
   104 /**
       
   105  * Destructor
       
   106  *
       
   107  */
       
   108 EXPORT_C CAknCheckBoxSettingPage::~CAknCheckBoxSettingPage()
       
   109     {
       
   110     AKNTASHOOK_REMOVE();
       
   111     delete (iInternalItemArray);
       
   112     delete iExtension;
       
   113     }
       
   114 
       
   115 
       
   116 EXPORT_C CAknCheckBoxSettingPage::CAknCheckBoxSettingPage( TInt aResourceId, CSelectionItemList* aItemArray):
       
   117      CAknListBoxSettingPage(aResourceId), iItemArray(aItemArray)
       
   118     {
       
   119     AKNTASHOOK_ADD( this, "CAknCheckBoxSettingPage" );
       
   120     }
       
   121 
       
   122 
       
   123 EXPORT_C CAknCheckBoxSettingPage::CAknCheckBoxSettingPage(
       
   124             const TDesC* aSettingText,
       
   125             TInt aSettingNumber,
       
   126             TInt aControlType,
       
   127             TInt aEditorResourceId,
       
   128             TInt aSettingPageResourceId,
       
   129             CSelectionItemList* aItemArray )
       
   130             :   CAknListBoxSettingPage(
       
   131                 aSettingText,
       
   132                 aSettingNumber,
       
   133                 aControlType,
       
   134                 aEditorResourceId,
       
   135                 aSettingPageResourceId ),
       
   136                 iItemArray(aItemArray)
       
   137     {
       
   138     AKNTASHOOK_ADD( this, "CAknCheckBoxSettingPage" );
       
   139     }
       
   140 
       
   141 
       
   142 EXPORT_C void CAknCheckBoxSettingPage::ConstructL()
       
   143     {
       
   144     BaseConstructL();
       
   145     iExtension = new(ELeave) CAknCheckBoxSettingPageExtension;
       
   146 
       
   147     CreateCheckBoxBitmapsL();
       
   148 
       
   149     GenerateInternalArrayAndGiveToListBoxL();
       
   150 
       
   151     // This updates the CBA
       
   152     CheckAndSetDataValidity();
       
   153     UpdateCbaL();
       
   154 
       
   155     // Only a reference to the CBase object; not owned
       
   156     CAknSetStyleListBox* listBox = ListBoxControl();
       
   157 
       
   158     listBox->SetListBoxObserver(this);
       
   159 
       
   160     // Set the scroller indication to appear when needed
       
   161     listBox->CreateScrollBarFrameL(ETrue, ETrue);
       
   162     listBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
       
   163     listBox->ItemDrawer()->FormattedCellData()->SetDrawScrollbarBackground( EFalse );
       
   164 
       
   165     listBox->ScrollBarFrame()->VerticalScrollBar()->SetMopParent(this);
       
   166     listBox->UpdateScrollBarsL();
       
   167 
       
   168     if(!IsBackgroundDrawingEnabled())
       
   169         	listBox->ScrollBarFrame()->DrawBackground(EFalse, EFalse);
       
   170     
       
   171     // To force the layout
       
   172     SizeChanged();
       
   173 
       
   174     // check and change MSK according to item selection status
       
   175     CEikButtonGroupContainer *bgc;
       
   176     CCoeControl* MSK(NULL);
       
   177     CEikCba* cba(NULL);
       
   178     MopGetObject(bgc);
       
   179     TInt newResourceId(NULL);    
       
   180     if (bgc)
       
   181         {
       
   182 		cba = ( static_cast<CEikCba*>( bgc->ButtonGroup() ) ); // downcast from MEikButtonGroup
       
   183 		if (cba)
       
   184 		    {
       
   185 		    MSK = cba->Control(3); // MSK's position is 3
       
   186 		    }
       
   187         }
       
   188     TInt currentSelectionIndex = listBox->CurrentItemIndex();
       
   189 
       
   190     if( iItemArray && iItemArray->Count() > 0 )
       
   191         {
       
   192         if (MSK && ( (cba->ControlId(MSK) == EAknSoftkeyMark) ||
       
   193                      (cba->ControlId(MSK) == EAknSoftkeyUnmark) ))
       
   194             {
       
   195             if( (*iItemArray)[currentSelectionIndex]->SelectionStatus() )
       
   196                 {
       
   197                 newResourceId = R_AVKON_SOFTKEY_UNMARK;
       
   198                 }
       
   199             else
       
   200                 {
       
   201                 newResourceId = R_AVKON_SOFTKEY_MARK;
       
   202                 }
       
   203             }
       
   204         if (newResourceId)
       
   205             {
       
   206             bgc->SetCommandL(3,newResourceId);
       
   207             cba->DrawNow();
       
   208             }
       
   209         }
       
   210 
       
   211     // Construct an appropriate control context for the contained editor areas.
       
   212     // Context produced is owned by CAknSettingPage.
       
   213     SetEditedItemFrameIID( KAknsIIDQsnFrSetOpt, KAknsIIDQsnFrSetOptCenter );
       
   214     }
       
   215 
       
   216 
       
   217 EXPORT_C void CAknCheckBoxSettingPage::HandleListBoxEventL(CEikListBox* /*aListBox*/,
       
   218         MEikListBoxObserver::TListBoxEvent aEventType)
       
   219     {
       
   220     if (!iExtension)
       
   221         {
       
   222         iExtension = new (ELeave) CAknCheckBoxSettingPageExtension;
       
   223         }
       
   224     
       
   225     switch ( aEventType )
       
   226         {
       
   227         // Fall through these things that should all cause the selection to change
       
   228         case MEikListBoxObserver::EEventEnterKeyPressed:
       
   229         case MEikListBoxObserver::EEventItemActioned:
       
   230         case MEikListBoxObserver::EEventItemClicked:
       
   231         case MEikListBoxObserver::EEventItemSingleClicked:
       
   232             // select when no dragging
       
   233             if ( !iExtension->iIsDragged )
       
   234                 {
       
   235                 ToggleSelectionL();
       
   236                 UpdateSettingL();
       
   237                 }
       
   238             break;
       
   239         case MEikListBoxObserver::EEventItemDraggingActioned:
       
   240         case EEventPanningStarted:
       
   241         case EEventFlickStarted:
       
   242             iExtension->iIsDragged = ETrue;
       
   243             break;
       
   244         case MEikListBoxObserver::EEventPenDownOnItem:         
       
   245             iExtension->iIsDragged = EFalse;
       
   246             if( iSettingPageObserver )
       
   247                 iSettingPageObserver->HandleSettingPageEventL(this, MAknSettingPageObserver::EEventSettingChanged);
       
   248             break;
       
   249         default:
       
   250             break;
       
   251         }
       
   252     }
       
   253 
       
   254 void CAknCheckBoxSettingPage::ToggleSelectionL()
       
   255     {
       
   256     CAknSetStyleListBox* listBox = ListBoxControl();
       
   257     CListBoxView* view = listBox->View();
       
   258     TInt currentSelectionIndex = listBox->CurrentItemIndex();
       
   259 
       
   260     TInt newResourceId(NULL);
       
   261     // Toggle based upon current master status
       
   262     if( iItemArray && iItemArray->Count() > 0 )
       
   263         {
       
   264         if( (*iItemArray)[currentSelectionIndex]->SelectionStatus() )
       
   265             {
       
   266             view->DeselectItem( currentSelectionIndex );
       
   267             ( (*iItemArray)[ currentSelectionIndex ] )->SetSelectionStatus( EFalse );
       
   268             newResourceId = R_AVKON_SOFTKEY_MARK;
       
   269             }
       
   270         else
       
   271             {
       
   272             view->SelectItemL( currentSelectionIndex );
       
   273             ( (*iItemArray)[ currentSelectionIndex ] )->SetSelectionStatus( ETrue );
       
   274             newResourceId = R_AVKON_SOFTKEY_UNMARK;
       
   275             }
       
   276         }
       
   277 
       
   278 
       
   279     // if the selection came from Mark/Unmark event from MSK, toggle also MSK
       
   280     CEikButtonGroupContainer *bgc;
       
   281     CCoeControl* MSK(NULL);
       
   282     CEikCba* cba(NULL);
       
   283     MopGetObject(bgc);
       
   284     if (bgc)
       
   285         {
       
   286 		cba = ( static_cast<CEikCba*>( bgc->ButtonGroup() ) ); // downcast from MEikButtonGroup
       
   287 		if (cba)
       
   288 		    {
       
   289 		    MSK = cba->Control(3); // MSK's position is 3
       
   290 		    }
       
   291         }
       
   292     if (MSK && ( (cba->ControlId(MSK) == EAknSoftkeyMark) ||
       
   293                  (cba->ControlId(MSK) == EAknSoftkeyUnmark) ))
       
   294         {
       
   295         if (newResourceId)
       
   296             {
       
   297             bgc->SetCommandL(3,newResourceId);
       
   298             cba->DrawNow();
       
   299             }
       
   300         }
       
   301 
       
   302     if( iSettingPageObserver )
       
   303         iSettingPageObserver->HandleSettingPageEventL(this, MAknSettingPageObserver::EEventSettingChanged);
       
   304 
       
   305     }
       
   306 
       
   307 EXPORT_C void CAknCheckBoxSettingPage::UpdateSettingL()
       
   308     {
       
   309     }
       
   310 
       
   311 EXPORT_C CAknSetStyleListBox* CAknCheckBoxSettingPage::ListBoxControl() const
       
   312     {
       
   313     return STATIC_CAST( CAknSetStyleListBox*, EditorControl());
       
   314     }
       
   315 
       
   316 
       
   317 EXPORT_C void CAknCheckBoxSettingPage::DynamicInitL()
       
   318     {
       
   319     }
       
   320 
       
   321 
       
   322 void CAknCheckBoxSettingPage::UpdateAllSelections()
       
   323     {
       
   324     TInt nItems = iItemArray->Count();
       
   325     CAknSetStyleListBox* listBox = ListBoxControl();
       
   326     CListBoxView* view = listBox->View();
       
   327 
       
   328     for (TInt ii=0; ii<nItems; ii++)
       
   329         {
       
   330         (*iItemArray)[ ii ]->SetSelectionStatus( view->ItemIsSelected( ii ) );
       
   331         }
       
   332 
       
   333     }
       
   334 
       
   335 void CAknCheckBoxSettingPage::SetAllSelectionsL()
       
   336     {
       
   337     TInt nItems = iItemArray->Count();
       
   338     CAknSetStyleListBox* listBox = ListBoxControl();
       
   339     CListBoxView* view = listBox->View();
       
   340 
       
   341     for (TInt ii=0; ii<nItems; ii++)
       
   342         {
       
   343         if ( (*iItemArray)[ ii ]->SelectionStatus() )
       
   344             view->SelectItemL( ii );
       
   345         else
       
   346             view->DeselectItem( ii );
       
   347         }
       
   348 
       
   349     }
       
   350 
       
   351 /**
       
   352  * Processes events from the softkeys. (Or tranlated from key events)
       
   353  *
       
   354  *
       
   355  * @param   aCommandId  Event Id from the soft-key
       
   356  */
       
   357 EXPORT_C void CAknCheckBoxSettingPage::ProcessCommandL(TInt aCommandId)
       
   358     {
       
   359     HideMenu();
       
   360 
       
   361     // Respond to softkey events
       
   362     switch (aCommandId)
       
   363         {
       
   364         case EAknSoftkeySelect:
       
   365         case EAknSoftkeyMark:
       
   366         case EAknSoftkeyUnmark:
       
   367             if ( AknLayoutUtils::PenEnabled() )
       
   368                 {
       
   369                 if (ListBoxControl()->View()->ItemIsVisible(ListBoxControl()->View()->CurrentItemIndex()))
       
   370                     {
       
   371                     SelectCurrentItemL();
       
   372                     }
       
   373                 else
       
   374                     {
       
   375                     // No exit in this case
       
   376                     ListBoxControl()->View()->ScrollToMakeItemVisible(ListBoxControl()->View()->CurrentItemIndex());
       
   377                     ListBoxControl()->UpdateScrollBarsL();
       
   378                     }
       
   379                 }
       
   380             else
       
   381                 {
       
   382                 SelectCurrentItemL(); // No exit in this case
       
   383                 }
       
   384             break;
       
   385         case EAknSoftkeyOk:
       
   386         case EAknSoftkeyDone:
       
   387             if ( AknLayoutUtils::PenEnabled() )
       
   388                 {
       
   389                 // Pen support changes selection only in the view, do update for items here.
       
   390                 UpdateAllSelections();
       
   391                 }
       
   392             AttemptExitL(ETrue);
       
   393             break;
       
   394         case EAknSoftkeyBack:
       
   395         case EAknSoftkeyCancel:
       
   396             AttemptExitL(EFalse);
       
   397             break;
       
   398         case EAknSoftkeyOptions:
       
   399             DisplayMenuL();
       
   400             break;
       
   401         default:
       
   402             break;
       
   403         }
       
   404     }
       
   405 
       
   406 EXPORT_C void CAknCheckBoxSettingPage::SelectCurrentItemL()
       
   407     {
       
   408     ToggleSelectionL();
       
   409     UpdateSettingL();
       
   410     }
       
   411 
       
   412 void CAknCheckBoxSettingPage::GenerateInternalArrayAndGiveToListBoxL()
       
   413     {
       
   414 
       
   415     delete iInternalItemArray;
       
   416     iInternalItemArray = 0;
       
   417 
       
   418 // Make a new owned text array from the input one:
       
   419     iInternalItemArray = new(ELeave)CDesCArrayFlat(1);
       
   420     TInt nItems = iItemArray->Count();
       
   421 
       
   422     for (TInt ii=0; ii<nItems; ii++)
       
   423         {
       
   424         // Fill up the control-owned space for the modified buffers:
       
   425         TInt newLen = ((*iItemArray)[ii]->ItemText()).Length() + KOneSlashT().Length();
       
   426         HBufC* newText = HBufC::NewMaxLC( newLen );
       
   427 
       
   428         TPtr newTPtr = newText->Des();
       
   429         newTPtr.Copy( KOneSlashT );
       
   430         newTPtr.Append( ((*iItemArray)[ii])->ItemText() );
       
   431         // A copy of the new buffer goes to the internal itemarray:
       
   432         iInternalItemArray->AppendL(newTPtr);
       
   433         CleanupStack::PopAndDestroy(); // newText
       
   434         }
       
   435 
       
   436     CAknSetStyleListBox* listBox = ListBoxControl();
       
   437 
       
   438     CTextListBoxModel* model=listBox->Model();
       
   439     model->SetItemTextArray(iInternalItemArray);
       
   440     model->SetOwnershipType(ELbmDoesNotOwnItemArray);
       
   441 
       
   442     //
       
   443     // let the list box not throw away pointer event 
       
   444     //
       
   445     if( nItems > 0)
       
   446         {	
       
   447         CArrayFix<TInt>* tmp = new(ELeave)CArrayFixFlat<TInt>(nItems);  
       
   448         CleanupStack::PushL( tmp );    
       
   449         for(TInt i=0; i<nItems; i++)
       
   450             {
       
   451             tmp->AppendL( i );
       
   452             }
       
   453         listBox->SetPointerEventFilterDisabledL( *tmp );         
       
   454         CleanupStack::PopAndDestroy( tmp );
       
   455         }
       
   456 
       
   457 // Transfer the selected status from the input array into the listbox view:
       
   458     SetAllSelectionsL();
       
   459 
       
   460     }
       
   461 
       
   462 EXPORT_C void CAknCheckBoxSettingPage::SetSelectionItemArrayL( CSelectionItemList* aItemArray )
       
   463     {
       
   464     iItemArray = aItemArray;
       
   465     GenerateInternalArrayAndGiveToListBoxL();
       
   466 
       
   467     // This updates the CBA
       
   468     CheckAndSetDataValidity();
       
   469     UpdateCbaL();
       
   470 
       
   471     SizeChanged();
       
   472     DrawDeferred();
       
   473     }
       
   474 
       
   475 /**
       
   476  * Writes the internal state of the control and its components to aStream.
       
   477  * Does nothing in release mode.
       
   478  * Designed to be overidden and base called by subclasses.
       
   479  */
       
   480 #ifndef _DEBUG
       
   481 EXPORT_C void CAknCheckBoxSettingPage::WriteInternalStateL(RWriteStream& /*aWriteStream*/) const
       
   482     {}
       
   483 #else
       
   484 EXPORT_C void CAknCheckBoxSettingPage::WriteInternalStateL(RWriteStream& aWriteStream) const
       
   485     {
       
   486     CAknSettingPage::WriteInternalStateL(aWriteStream);
       
   487     }
       
   488 #endif
       
   489 
       
   490 //---------------------------------------------------------------------------------------
       
   491 // CAknCheckBoxSettingPage::HandlePointerEventL()
       
   492 // Handles pointer events by removing Shift and Control button modifiers from it and
       
   493 // sends modified pointerevent to CEikListbox. This prevents multiselection
       
   494 //---------------------------------------------------------------------------------------
       
   495 //
       
   496 EXPORT_C void CAknCheckBoxSettingPage::HandlePointerEventL(const TPointerEvent& aPointerEvent)
       
   497     {
       
   498     if ( !iExtension )
       
   499         {
       
   500         iExtension = new(ELeave) CAknCheckBoxSettingPageExtension;
       
   501         }
       
   502 
       
   503     TPointerEvent newPointerEvent = aPointerEvent;
       
   504 
       
   505     // Remove Shift and Ctrl modifiers from PointerEvent
       
   506     newPointerEvent.iModifiers &= ~EModifierShift;
       
   507     newPointerEvent.iModifiers &= ~EModifierCtrl;
       
   508 
       
   509     // If click on an item, pressed down state draw. After dragging to other item
       
   510     // or outside, item can not be selected.        
       
   511     CAknSetStyleListBox* listbox = ListBoxControl();
       
   512     TInt index;
       
   513     if ( newPointerEvent.iType == TPointerEvent::EButton1Down 
       
   514         && listbox->View()->XYPosToItemIndex( newPointerEvent.iPosition, index ))
       
   515         {
       
   516         listbox->View()->ItemDrawer()->SetFlags( CListItemDrawer::EPressedDownState );
       
   517         }
       
   518     else if ( aPointerEvent.iType == TPointerEvent::EDrag 
       
   519               && !listbox->Rect().Contains( aPointerEvent.iPosition ))
       
   520         {
       
   521         iExtension->iIsDragged = ETrue;
       
   522         }
       
   523 
       
   524     CAknListBoxSettingPage::HandlePointerEventL( aPointerEvent );
       
   525     }
       
   526 
       
   527 void CAknCheckBoxSettingPage::CreateCheckBoxBitmapsL()
       
   528     {
       
   529     // Only a reference to the CBase object; not owned
       
   530     CAknSetStyleListBox* listBox = ListBoxControl();
       
   531     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
   532     
       
   533     // In case CAknPopupSettingList has already created the icons
       
   534     if ( listBox->ItemDrawer()->FormattedCellData()->IconArray() )
       
   535         {
       
   536         listBox->ItemDrawer()->FormattedCellData()->IconArray()->ResetAndDestroy();
       
   537         delete (listBox->ItemDrawer()->FormattedCellData()->IconArray());
       
   538         }
       
   539     
       
   540     TResourceReader reader;
       
   541     // Original code used R_AVKON_SETTING_PAGE_CHECKBOX_ICONS but
       
   542     // R_AVKON_RADIOBUTT_BMP defines the same icons.
       
   543     iCoeEnv->CreateResourceReaderLC(reader, R_AVKON_SETTING_PAGE_CHECKBOX_ICONS);
       
   544     
       
   545     reader.ReadInt16(); //not needed, simple or complex
       
   546 
       
   547     HBufC* bmpFile = reader.ReadHBufCL();
       
   548     TInt count = reader.ReadInt16(); // count
       
   549     
       
   550     if(count<2)
       
   551     	User::Leave(KErrCorrupt);
       
   552     
       
   553     TInt32 bmpSelected = reader.ReadInt32();
       
   554     TInt32 bmpSelectedM = reader.ReadInt32();
       
   555     TInt32 bmp = reader.ReadInt32();
       
   556     TInt32 bmpM = reader.ReadInt32();
       
   557     CleanupStack::PopAndDestroy(); // reader
       
   558 
       
   559     if (bmpFile == NULL)
       
   560         User::Leave(KErrCorrupt);
       
   561     
       
   562     CleanupStack::PushL(bmpFile);
       
   563 
       
   564     CArrayPtr<CGulIcon>* icons = new(ELeave) CAknIconArray(4);
       
   565     // put on the cleanup stack until ownership is transferred
       
   566     CleanupStack::PushL( icons );
       
   567 
       
   568     // create normally colored icons
       
   569     CreateIconAndAddToArrayL( icons,
       
   570                               KAknsIIDQgnIndiCheckboxOn,
       
   571                               EAknsCIQsnIconColorsCG14,
       
   572                               *bmpFile,
       
   573                               bmpSelected,
       
   574                               bmpSelectedM );
       
   575 
       
   576     CreateIconAndAddToArrayL( icons,
       
   577                               KAknsIIDQgnIndiCheckboxOff,
       
   578                               EAknsCIQsnIconColorsCG14,
       
   579                               *bmpFile,
       
   580                               bmp,
       
   581                               bmpM );
       
   582 
       
   583     // create highlight colored icons
       
   584     CreateIconAndAddToArrayL( icons,
       
   585                               KAknsIIDQgnIndiCheckboxOn,
       
   586                               EAknsCIQsnIconColorsCG18,
       
   587                               *bmpFile,
       
   588                               bmpSelected,
       
   589                               bmpSelectedM );
       
   590 
       
   591     CreateIconAndAddToArrayL( icons,
       
   592                               KAknsIIDQgnIndiCheckboxOff,
       
   593                               EAknsCIQsnIconColorsCG18,
       
   594                               *bmpFile,
       
   595                               bmp,
       
   596                               bmpM );
       
   597 
       
   598 
       
   599     listBox->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons); // ownership transferred, cell data deletes all members of list
       
   600     listBox->ItemDrawer()->FormattedCellData()->UseHighlightIconSwapping( ETrue );
       
   601         
       
   602     CleanupStack::Pop(); // icons - ownership now transferred; do not destroy
       
   603     CleanupStack::PopAndDestroy(); // bmpfile
       
   604     }
       
   605 
       
   606 EXPORT_C void CAknCheckBoxSettingPage::HandleResourceChange(TInt aType)
       
   607     {
       
   608     if( aType == KAknsMessageSkinChange )
       
   609         {
       
   610         TRAP_IGNORE( CreateCheckBoxBitmapsL() );
       
   611         }
       
   612 
       
   613     CAknSettingPage::HandleResourceChange(aType);
       
   614     }
       
   615 
       
   616 
       
   617 /**
       
   618 * Setting Page reserved methods
       
   619 */
       
   620 
       
   621 EXPORT_C void* CAknCheckBoxSettingPage::ExtensionInterface( TUid /*aInterface*/ )
       
   622     {
       
   623     return NULL;
       
   624     }
       
   625 
       
   626 /**
       
   627  *  Reserved method derived from CCoeControl
       
   628  */
       
   629 EXPORT_C void CAknCheckBoxSettingPage::Reserved_2()
       
   630     {
       
   631     }
       
   632 
       
   633 /**
       
   634 * Setting Page reserved methods
       
   635 */
       
   636 EXPORT_C void CAknCheckBoxSettingPage::CAknSettingPage_Reserved_1()
       
   637     {
       
   638     }
       
   639 EXPORT_C void CAknCheckBoxSettingPage::CAknSettingPage_Reserved_2()
       
   640     {
       
   641     }
       
   642 
       
   643 /**
       
   644 * CAknListBoxSettingPage-derived reserved methods
       
   645 */
       
   646 EXPORT_C void CAknCheckBoxSettingPage::CAknListBoxSettingPage_Reserved_1()
       
   647     {
       
   648     }
       
   649 
       
   650 // End of File