memspyui/include/MemSpyViewBase.h
branchRCL_3
changeset 20 fad26422216a
parent 0 d6fe6244b863
equal deleted inserted replaced
19:b3cee849fa46 20: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 #ifndef MEMSPYVIEWBASE_H
       
    19 #define MEMSPYVIEWBASE_H
       
    20 
       
    21 // System includes
       
    22 #include <coecntrl.h>
       
    23 #include <aknlists.h>
       
    24 #include <memspyui.rsg>
       
    25 
       
    26 // User includes
       
    27 #include "MemSpy.hrh"
       
    28 #include "MemSpyViewType.h"
       
    29 #include "MemSpyViewObserver.h"
       
    30 #include "MemSpySettings.h"
       
    31 
       
    32 // Classes referenced
       
    33 class CMemSpyEngine;
       
    34 class CMemSpyContainer;
       
    35 class MMemSpyViewObserver;
       
    36 
       
    37 
       
    38 class CMemSpyViewBase : public CCoeControl, public MCoeControlObserver, public MEikListBoxObserver
       
    39     {
       
    40 public:
       
    41     CMemSpyViewBase( CMemSpyEngine& aEngine, MMemSpyViewObserver& aObserver );
       
    42     ~CMemSpyViewBase();
       
    43     virtual void ConstructL( const TRect& aRect, CCoeControl& aContainer, TAny* aSelectionRune = NULL );
       
    44 
       
    45 public: // API
       
    46     virtual TMemSpyViewType ViewType() const = 0;
       
    47     virtual CMemSpyViewBase* PrepareParentViewL();
       
    48     virtual CMemSpyViewBase* PrepareChildViewL();
       
    49     virtual void RefreshL();
       
    50     virtual TBool HandleCommandL( TInt aCommand );
       
    51 
       
    52 public: // Menu framework
       
    53     virtual void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
    54     virtual TUint MenuCascadeResourceId() const;
       
    55     virtual TInt MenuCascadeCommandId() const;
       
    56 
       
    57 private: // Command handlers
       
    58     virtual void OnCmdViewOutputToSinkL();
       
    59 
       
    60 protected: // Construction support
       
    61     void SetTitleL( const TDesC& aText );
       
    62     TPtrC TitleL() const;
       
    63     virtual CEikListBox* ConstructListBoxL();
       
    64     virtual void SetListBoxModelL() = 0;
       
    65 
       
    66 protected: // Internal framework
       
    67     virtual void HandleListBoxItemActionedL( TInt aIndex );
       
    68     virtual void HandleListBoxItemSelectedL( TInt aIndex );
       
    69  
       
    70 protected: // Event reporting
       
    71     void ReportEventL( MMemSpyViewObserver::TViewEventType aEvent, TAny* aContext = NULL );
       
    72     void SetListBoxCurrentItemIndexL( TInt aIndex );
       
    73 
       
    74 protected: // Utility methods
       
    75     CMemSpyContainer& Container();
       
    76     CMemSpySettings& Settings();
       
    77     const CMemSpySettings& Settings() const;
       
    78 
       
    79 public: // From CCoeControl
       
    80 	TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
    81 
       
    82 protected: // From CCoeControl
       
    83     void Draw( const TRect& aRect ) const;
       
    84     void SizeChanged();
       
    85     void FocusChanged( TDrawNow aDrawNow );
       
    86     TInt CountComponentControls() const;
       
    87     CCoeControl* ComponentControl( TInt aIndex ) const;
       
    88 
       
    89 protected: // From MCoeControlObserver
       
    90     void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType );
       
    91 
       
    92 protected: // From MEikListBoxObserver
       
    93     void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType);
       
    94 
       
    95 protected: // Member data
       
    96     CMemSpyEngine& iEngine;
       
    97     MMemSpyViewObserver& iObserver;
       
    98     //
       
    99     CEikListBox* iListBox;
       
   100 
       
   101 private:
       
   102     CMemSpySettings* iSettings;
       
   103     };
       
   104 
       
   105 
       
   106 #endif