memana/analyzetoolclient/configurationappgui/inc/atconfigurationappguiprocesscontainer.h
changeset 2 6a82cd05fb1e
parent 1 3ff3fecb12fe
equal deleted inserted replaced
1:3ff3fecb12fe 2:6a82cd05fb1e
     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 ATCONFIGURATIONAPPGUIPROCESSCONTAINER_H
       
    19 #define ATCONFIGURATIONAPPGUIPROCESSCONTAINER_H
       
    20 
       
    21 //INCLUDES
       
    22 #include <coecntrl.h>
       
    23 
       
    24 #include "atconfigurationappguiprocessview.h"
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class MEikCommandObserver;		
       
    28 class CAknDoubleStyleListBox;
       
    29 class CEikTextListBox;
       
    30 
       
    31 /**
       
    32  * Container class for CATConfigurationAppGuiProcessContainer
       
    33  * 
       
    34  * @class	CATConfigurationAppGuiProcessContainer
       
    35  */
       
    36 class CATConfigurationAppGuiProcessContainer : public CCoeControl
       
    37 	{
       
    38 public:
       
    39     /**
       
    40     * C++ default constructor.
       
    41     */
       
    42 	CATConfigurationAppGuiProcessContainer();
       
    43 	
       
    44     /**
       
    45     * Two-phased constructor that can leave.
       
    46     * @return A new instance of this class
       
    47     */
       
    48 	static CATConfigurationAppGuiProcessContainer* NewL( 
       
    49 		const TRect& aRect, 
       
    50 		CATConfigurationAppGuiProcessView* aParent, 
       
    51 		MEikCommandObserver* aCommandObserver, TUint aProcessId, TInt64 aProcessStartTime );
       
    52 	
       
    53     /**
       
    54     * Two-phased constructor that can leave and leaves a pointer
       
    55     * on the cleanup stack.
       
    56     * @return A new instance of this class
       
    57     */
       
    58 	static CATConfigurationAppGuiProcessContainer* NewLC( 
       
    59 		const TRect& aRect, 
       
    60 		CATConfigurationAppGuiProcessView* aParent, 
       
    61 		MEikCommandObserver* aCommandObserver, TUint aProcessId, TInt64 aProcessStartTime );
       
    62 	
       
    63     /**
       
    64     *  Symbian 2nd phase constructor.
       
    65     */
       
    66 	void ConstructL( 
       
    67 		const TRect& aRect, 
       
    68 		CATConfigurationAppGuiProcessView* aParent, 
       
    69 		MEikCommandObserver* aCommandObserver, TUint aProcessId, TInt64 aProcessStartTime );
       
    70 	
       
    71     /**
       
    72     * Destructor.
       
    73     */
       
    74 	virtual ~CATConfigurationAppGuiProcessContainer();
       
    75 	
       
    76     /**
       
    77     * Updates view components.
       
    78     */
       
    79 	void UpdateViewL();
       
    80 
       
    81 public:
       
    82 
       
    83     /**
       
    84     * From CCoeControl.
       
    85     */
       
    86 	TInt CountComponentControls() const;
       
    87 
       
    88     /**
       
    89     * From CCoeControl.
       
    90     */
       
    91 	CCoeControl* ComponentControl( TInt aIndex ) const;
       
    92 	
       
    93     /**
       
    94     * From CCoeControl.
       
    95     */
       
    96 	TKeyResponse OfferKeyEventL( 
       
    97 			const TKeyEvent& aKeyEvent, 
       
    98 			TEventCode aType );
       
    99 	
       
   100     /**
       
   101     * From CCoeControl.
       
   102     */
       
   103 	void HandleResourceChange( TInt aType );
       
   104 	
       
   105 protected:
       
   106 
       
   107     /**
       
   108     * From CCoeControl.
       
   109     */
       
   110 	void SizeChanged();
       
   111 
       
   112 private:
       
   113 
       
   114     /**
       
   115     * From CCoeControl.
       
   116     */
       
   117 	void Draw( const TRect& aRect ) const;
       
   118 
       
   119 private:
       
   120     
       
   121     /**
       
   122     * Initializes all the controls in the class.
       
   123     */
       
   124 	void InitializeControlsL();
       
   125     /**
       
   126     * Layouts controls according to the screen size.
       
   127     */
       
   128 	void LayoutControls();
       
   129 	
       
   130     // Active control
       
   131 	CCoeControl* iFocusControl;
       
   132     // Command observer
       
   133 	MEikCommandObserver* iCommandObserver;
       
   134 	CATConfigurationAppGuiProcessView* iParent;
       
   135 
       
   136 public: 
       
   137     
       
   138     /**
       
   139     * Adds an item to the listbox.
       
   140     * @param aListBox pointer to the listbox
       
   141     * @param aString a text about to be shown in the listbox.
       
   142     */
       
   143 	static void AddListBoxItemL( 
       
   144 			CEikTextListBox* aListBox,
       
   145 			const TDesC& aString );
       
   146 	
       
   147     /**
       
   148     * Returns selected listbox items.
       
   149     * @param aListBox pointer to the listbox
       
   150     * @return RArray< TInt >* array of selected items
       
   151     */
       
   152 	static RArray< TInt >* GetSelectedListBoxItemsLC( CEikTextListBox* aListBox );
       
   153 	
       
   154     /**
       
   155     * Deletes selected listbox items.
       
   156     * @param aListBox pointer to the listbox
       
   157     */
       
   158 	static void DeleteSelectedListBoxItemsL( CEikTextListBox* aListBox );
       
   159 	
       
   160     /**
       
   161     * Returns this controls listbox.
       
   162     */
       
   163 	CAknDoubleStyleListBox* ListBox();
       
   164 	
       
   165     /**
       
   166     * Creates listbox item from the given text.
       
   167     * @param aBuffer text to be appended to the listbox
       
   168     * @param aMainText a text for the first line of the item
       
   169     * @param aSecondaryText a text for the second line of the item
       
   170     */
       
   171 	static void CreateListBoxItemL( TDes& aBuffer, 
       
   172 			const TDesC& aMainText,
       
   173 			const TDesC& aSecondaryText );
       
   174 	
       
   175     /**
       
   176     * Starts adding listbox items from the resource.
       
   177     * @param aResourceId resource id of the text
       
   178     */
       
   179 	void AddListBoxResourceArrayItemL( TInt aResourceId );
       
   180 	
       
   181     /**
       
   182     * Setups listbox icons.
       
   183     */
       
   184 	void SetupListBoxIconsL();
       
   185 	
       
   186     /**
       
   187     * Handles listbox command.
       
   188     * @param aCommand command id
       
   189     */
       
   190 	TBool HandleMarkableListCommandL( TInt aCommand );
       
   191 	
       
   192     /**
       
   193     * Gets current highlighted listbox index.
       
   194     * @return TInt listbox index
       
   195     */
       
   196 	TInt GetCurrentItemIndex();
       
   197 	
       
   198 private: 
       
   199     
       
   200     // Listbox
       
   201 	CAknDoubleStyleListBox* iListBox;
       
   202 	// Id of the opened process
       
   203 	TUint iProcessId;
       
   204 	// Starting time of the opened process
       
   205 	TInt64 iProcessStartTime;
       
   206 
       
   207 protected: 
       
   208 	
       
   209 public: 
       
   210     /**
       
   211     * @enum TControls
       
   212     * Defines controls.
       
   213     */
       
   214 	enum TControls
       
   215 		{
       
   216 		EListBox,     /**< Listbox control. */
       
   217 		ELastControl  /**< Last control in the view. */
       
   218 		};
       
   219     /**
       
   220     * @enum TListBoxImages
       
   221     * Defines listbox icons.
       
   222     */
       
   223 	enum TListBoxImages
       
   224 		{
       
   225 		EListBoxFirstUserImageIndex   /**< First icon in listbox. */
       
   226 		};
       
   227 	};
       
   228 				
       
   229 #endif // ATCONFIGURATIONAPPGUIPROCESSCONTAINER_H