idlehomescreen/examples/hscontentcontrolexample/inc/HsContentControlListBox.h
branchRCL_3
changeset 102 ba63c83f4716
parent 93 b01126ce0bec
child 103 966d119a7e67
equal deleted inserted replaced
93:b01126ce0bec 102:ba63c83f4716
     1 /*
       
     2 * Copyright (c) 2010 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:  Content Control example
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __HSCONTENTCONTROLLISTBOX_H__
       
    20 #define __HSCONTENTCONTROLLISTBOX_H__
       
    21 
       
    22 //  Includes
       
    23 #include <coecntrl.h>        
       
    24 #include <akntreelistobserver.h>
       
    25 #include <AknTabObserver.h>
       
    26 #include <hscontentcontrol.h>
       
    27 
       
    28 //  Forward declarations
       
    29 class MEikCommandObserver;        
       
    30 class CAknSingleStyleTreeList;
       
    31 class CAknsBasicBackgroundControlContext;
       
    32 class CAknNavigationDecorator;
       
    33 class CAknTabGroup;
       
    34 class CAknStylusPopUpMenu;
       
    35 class CHsCcApiClient;
       
    36 class CHsContentInfoArray;
       
    37 
       
    38 /**
       
    39  * Container class for HsContentControlListBox
       
    40  * 
       
    41  * @class    CHsContentControlListBox HsContentControlListBox.h
       
    42  */
       
    43 class CHsContentControlListBox : public CCoeControl,     
       
    44     public MAknTreeListObserver,
       
    45     public MAknTabObserver,
       
    46     public MEikMenuObserver,
       
    47     public MHsContentControl    
       
    48     {
       
    49 public:
       
    50     // constructors and destructor
       
    51     
       
    52     /**
       
    53      * Two-phased constructor.
       
    54      */    
       
    55     static CHsContentControlListBox* NewL( 
       
    56         const TRect& aRect, 
       
    57         const CCoeControl* aParent, 
       
    58         MEikCommandObserver* aCommandObserver );
       
    59 
       
    60     /**
       
    61      * Two-phased constructor.
       
    62      */    
       
    63     static CHsContentControlListBox* NewLC( 
       
    64         const TRect& aRect, 
       
    65         const CCoeControl* aParent, 
       
    66         MEikCommandObserver* aCommandObserver );
       
    67         
       
    68     /**
       
    69      * Destructor
       
    70      */    
       
    71     ~CHsContentControlListBox();
       
    72 
       
    73 public:
       
    74     // from CCoeControl
       
    75     
       
    76     /**
       
    77      * @see CCoeControl
       
    78      */            
       
    79     TInt CountComponentControls() const;
       
    80 
       
    81     /**
       
    82      * @see CCoeControl
       
    83      */                
       
    84     CCoeControl* ComponentControl( TInt aIndex ) const;
       
    85     
       
    86     /**
       
    87      * @see CCoeControl
       
    88      */                
       
    89     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); 
       
    90     
       
    91     /**
       
    92      * @see CCoeControl
       
    93      */                
       
    94     void HandleResourceChange( TInt aType );
       
    95 
       
    96     /**
       
    97      * @see CCoeControl
       
    98      */                
       
    99     void SizeChanged();
       
   100 
       
   101     /**
       
   102      * @see CCoeControl
       
   103      */                
       
   104     TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
       
   105             
       
   106 private:
       
   107    // from MAknTreeListObserver
       
   108 
       
   109     /**
       
   110      * @see MAknTreeListObserver
       
   111      */
       
   112     TInt HandleTreeListEvent(       
       
   113         CAknTreeList& aList,
       
   114         TAknTreeItemID aItem,
       
   115         TEvent aEvent );
       
   116     
       
   117 private:    
       
   118     // From MEikMenuObserver
       
   119 
       
   120     /**
       
   121      * @see MEikMenuObserver
       
   122      */
       
   123     void ProcessCommandL( TInt aCommandId );
       
   124     
       
   125     /**
       
   126      * @see MEikMenuObserver
       
   127      */
       
   128     void SetEmphasis( CCoeControl* aMenuControl, TBool aEmphasis );
       
   129     
       
   130 private:
       
   131     // from MAknTabObserver
       
   132     
       
   133     /**
       
   134      * @see MAknTabObserver
       
   135      */    
       
   136     void TabChangedL( TInt aIndex );
       
   137     
       
   138 private:
       
   139     // from MHsContentControl
       
   140     
       
   141     /**
       
   142      * @see MHsContentControl
       
   143      */
       
   144     void NotifyWidgetListChanged();
       
   145 
       
   146     /**
       
   147      * @see MHsContentControl
       
   148      */
       
   149     void NotifyViewListChanged();
       
   150 
       
   151     /**
       
   152      * @see MHsContentControl
       
   153      */
       
   154     void NotifyAppListChanged();
       
   155           
       
   156 private:
       
   157     // new functions
       
   158     
       
   159     void InitializeControlsL();    
       
   160     void LayoutControls();
       
   161     void PopulateListL();
       
   162 
       
   163     static TInt PopulateList( TAny* aAny );
       
   164     
       
   165 private:
       
   166     // constructors
       
   167 
       
   168     /**
       
   169      * C++ default constructor
       
   170      */    
       
   171     CHsContentControlListBox();
       
   172 
       
   173     /** 
       
   174      * 2nd phase constructor
       
   175      */
       
   176     void ConstructL( 
       
   177         const TRect& aRect, 
       
   178         const CCoeControl* aParent, 
       
   179         MEikCommandObserver* aCommandObserver );
       
   180     
       
   181 private:
       
   182     // data
       
   183 
       
   184     /** Homescreen content control client, owned */
       
   185     CHsCcApiClient* iHsCcApiClient;    
       
   186     /** Callback, owned */
       
   187     CAsyncCallBack* iCallback;
       
   188     /** Popup menu, owned */
       
   189     CAknStylusPopUpMenu* iPopup;    
       
   190     /** List box, owned */
       
   191     CAknSingleStyleTreeList* iListBox;
       
   192     /** Bg context, owned */
       
   193     CAknsBasicBackgroundControlContext* iBgContext;
       
   194     /** Content info array, owned */
       
   195     CHsContentInfoArray* iArray;
       
   196     /** Navigation decorator, owned */
       
   197     CAknNavigationDecorator* iDecorator;
       
   198     /** Tab group, not owned */
       
   199     CAknTabGroup* iTabGroup;   
       
   200     /** Selected tree item */
       
   201     TAknTreeItemID iSelectedItem;    
       
   202     /** Active tab index */
       
   203     TInt iTabIndex;
       
   204     };
       
   205                 
       
   206 #endif // __HSCONTENTCONTROLLISTBOX_H__