memspyui/source/MemSpyViewKernelContainers.cpp
branchRCL_3
changeset 22 fad26422216a
parent 0 d6fe6244b863
equal deleted inserted replaced
21:b3cee849fa46 22:fad26422216a
       
     1 /*
       
     2 * Copyright (c) 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 *
       
    16 */
       
    17 
       
    18 #include "MemSpyViewKernelContainers.h"
       
    19 
       
    20 // Engine includes
       
    21 #include <memspy/engine/memspyengine.h>
       
    22 #include <memspy/engine/memspyengineobjectprocess.h>
       
    23 #include <memspy/engine/memspyengineobjectthread.h>
       
    24 #include <memspy/engine/memspyengineobjectcontainer.h>
       
    25 #include <memspy/engine/memspyengineobjectthreadinfoobjects.h>
       
    26 #include <memspy/engine/memspyengineobjectthreadinfocontainer.h>
       
    27 #include <memspy/engine/memspyenginehelperkernelcontainers.h>
       
    28 
       
    29 // User includes
       
    30 #include "MemSpyUiUtils.h"
       
    31 #include "MemSpyViewKernel.h"
       
    32 #include "MemSpyContainerObserver.h"
       
    33 #include "MemSpyViewKernelObjects.h"
       
    34 
       
    35 // Literal constants
       
    36 
       
    37 
       
    38 
       
    39 CMemSpyViewKernelContainers::CMemSpyViewKernelContainers( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver )
       
    40 :   CMemSpyViewBase( aEngine, aObserver )
       
    41     {
       
    42     }
       
    43 
       
    44 
       
    45 CMemSpyViewKernelContainers::~CMemSpyViewKernelContainers()
       
    46     {
       
    47     delete iModel;
       
    48     }
       
    49 
       
    50 
       
    51 void CMemSpyViewKernelContainers::ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune )
       
    52     {
       
    53     _LIT( KTitle, "Kernel Objects" );
       
    54     SetTitleL( KTitle );
       
    55     //
       
    56     CMemSpyViewBase::ConstructL( aRect, aContainer, aSelectionRune );
       
    57     }
       
    58 
       
    59 
       
    60 void CMemSpyViewKernelContainers::RefreshL()
       
    61     {
       
    62     SetListBoxModelL();
       
    63     CMemSpyViewBase::RefreshL();
       
    64     }
       
    65 
       
    66 
       
    67 TMemSpyViewType CMemSpyViewKernelContainers::ViewType() const
       
    68     {
       
    69     return EMemSpyViewTypeKernelContainers;
       
    70     }
       
    71 
       
    72 
       
    73 CMemSpyViewBase* CMemSpyViewKernelContainers::PrepareParentViewL()
       
    74     {
       
    75     CMemSpyViewKernel* parent = new(ELeave) CMemSpyViewKernel( iEngine, iObserver );
       
    76     CleanupStack::PushL( parent );
       
    77     parent->ConstructL( Rect(), *Parent(), (TAny*) ViewType() );
       
    78     CleanupStack::Pop( parent );
       
    79     return parent;
       
    80     }
       
    81 
       
    82 
       
    83 CMemSpyViewBase* CMemSpyViewKernelContainers::PrepareChildViewL()
       
    84     {
       
    85     CMemSpyViewBase* child = NULL;
       
    86     const TInt index = iListBox->CurrentItemIndex();
       
    87     child = new(ELeave) CMemSpyViewKernelObjects( iEngine, iObserver, iModel->At( index ).Type() );
       
    88     CleanupStack::PushL( child );
       
    89     child->ConstructL( Rect(), *Parent() );
       
    90     CleanupStack::Pop( child );
       
    91     return child;
       
    92     }
       
    93 
       
    94 
       
    95 void CMemSpyViewKernelContainers::SetListBoxModelL()
       
    96     {
       
    97     // Take ownership of new model
       
    98     CMemSpyEngineHelperKernelContainers& kernelContainerManager = iEngine.HelperKernelContainers();
       
    99     CMemSpyEngineGenericKernelObjectContainer* model = kernelContainerManager.ObjectsAllL();
       
   100     delete iModel;
       
   101     iModel = model;
       
   102     
       
   103     // Set up list box
       
   104     CAknSettingStyleListBox* listbox = static_cast< CAknSettingStyleListBox* >( iListBox );
       
   105     listbox->Model()->SetItemTextArray( model );
       
   106     listbox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   107     }
       
   108 
       
   109 
       
   110 TBool CMemSpyViewKernelContainers::HandleCommandL( TInt aCommand )
       
   111     {
       
   112     TBool handled = ETrue;
       
   113     //
       
   114     switch ( aCommand )
       
   115         {
       
   116     case EMemSpyCmdKernelContainersOutput:
       
   117         OnCmdOutputAllContainerContentsL();
       
   118         break;
       
   119 
       
   120     default:
       
   121         handled = CMemSpyViewBase::HandleCommandL( aCommand );
       
   122         break;
       
   123         }
       
   124     //
       
   125     return handled;
       
   126     }
       
   127 
       
   128 
       
   129 void CMemSpyViewKernelContainers::OnCmdOutputAllContainerContentsL()
       
   130     {
       
   131     CMemSpyEngineOutputSink& sink = iEngine.Sink();
       
   132     iModel->OutputL( sink );
       
   133     }
       
   134 
       
   135 
       
   136 
       
   137