profilesapplication/Profiles/ProfileApp/UIsrc/CProfileMainContainer.h
branchRCL_3
changeset 19 cd54903d48da
parent 0 ca436256272f
equal deleted inserted replaced
18:b7fa36b488f8 19:cd54903d48da
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Container class of main view.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CPROFILEMAINCONTAINER_H
       
    21 #define CPROFILEMAINCONTAINER_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <coecntrl.h>
       
    25 #include <eiklbo.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CAknView;
       
    29 class CAknSingleStyleListBox;
       
    30 class CProfileEngineHandler;
       
    31 class CProfileIndexHandler;
       
    32 
       
    33 // CONSTANTS
       
    34 const TInt KMainContainerSubControlCount( 1 );
       
    35 
       
    36 // CLASS DECLARATION
       
    37 /**
       
    38 *  Container class of main view.
       
    39 *
       
    40 *  @lib ProfileApp.app
       
    41 *  @since 1.2
       
    42 */
       
    43 NONSHARABLE_CLASS( CProfileMainContainer ) : public CCoeControl
       
    44 							, public MEikListBoxObserver
       
    45 	{
       
    46 	public:		// Constructors and destructors
       
    47 
       
    48 		/**
       
    49         * Two-phased constructor.
       
    50         * @param aEngineHandler Engine Handler.
       
    51         * @param aIndexHandler Index Handler.
       
    52         * @param aView Pointer to the main view class.
       
    53         * @return Returns an instance of CProfileMainContainer.
       
    54         */
       
    55 		static CProfileMainContainer* NewL(
       
    56             CProfileEngineHandler& aEngineHandler,
       
    57             CProfileIndexHandler& aIndexHandler,
       
    58             CAknView& aView );
       
    59 
       
    60 		/**
       
    61 		* Destructor.
       
    62 		*/
       
    63 		~CProfileMainContainer();
       
    64 
       
    65 	public:		// New functions
       
    66 
       
    67 		/**
       
    68 		* Populates listbox with names of profiles.
       
    69 		* Separated to own method to enable updating listbox dynamically
       
    70 		* (i.e. supports profiles being added or deleted).
       
    71         * @param aTopItemIndex If given, sets list boxes top item index.
       
    72 		*/
       
    73 		void PopulateListBoxL( TInt aTopItemIndex = KErrNotFound );
       
    74 
       
    75 		/**
       
    76 		* Returns the top item index of the listbox.
       
    77 		* Needed to set index back when returning from personalise state.
       
    78         * @return Returns the top item index of the listbox.
       
    79 		*/
       
    80 		TInt TopItemIndex() const;
       
    81 
       
    82 	private:	// Functions from base classes
       
    83 
       
    84         /**
       
    85         * From CoeControl
       
    86         */
       
    87 		TInt CountComponentControls() const;
       
    88 
       
    89         /**
       
    90         * From CoeControl
       
    91         */
       
    92 		CCoeControl* ComponentControl( TInt aIndex ) const;
       
    93 
       
    94         /**
       
    95         * From CoeControl
       
    96         */
       
    97 		void SizeChanged();
       
    98 
       
    99         /**
       
   100         * From CoeControl
       
   101         */
       
   102 		TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   103 
       
   104 		/**
       
   105         * From CCoeControl
       
   106         */
       
   107         void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   108         
       
   109         /**
       
   110         * From CCoeControl
       
   111         */
       
   112         void HandleResourceChange(TInt aType);
       
   113 
       
   114         /**
       
   115          * From CCoeControl
       
   116          */
       
   117         void FocusChanged( TDrawNow aDrawNow );
       
   118 
       
   119         /**
       
   120         * From MEikListBoxObserver
       
   121         */
       
   122         void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
       
   123 
       
   124 	private:
       
   125 
       
   126         /**
       
   127         * C++ constructor.
       
   128         * @param aEngineHandler Engine Handler.
       
   129         * @param aIndexHandler Index Handler.
       
   130         * @param aView Pointer to the main view class.
       
   131 		*/
       
   132 		CProfileMainContainer(
       
   133             CProfileEngineHandler& aEngineHandler,
       
   134             CProfileIndexHandler& aIndexHandler,
       
   135             CAknView& aView );
       
   136 
       
   137         /**
       
   138         * By default Symbian 2nd phase constructor is private.
       
   139         * @param aRect Drawing area.
       
   140         */
       
   141  		void ConstructL( const TRect& aRect );
       
   142 
       
   143 	private:	// Data
       
   144 
       
   145         // Engine handler
       
   146         CProfileEngineHandler& iEngineHandler;
       
   147 
       
   148         // Index handler
       
   149         CProfileIndexHandler& iIndexHandler;
       
   150 
       
   151 		// The view class (to call HandleCommandL).
       
   152 		CAknView& iView;
       
   153 
       
   154 		// Own: Listbox class.
       
   155 		CAknSingleStyleListBox* iListBox;
       
   156 
       
   157 	};
       
   158 
       
   159 #endif // CPROFILEMAINCONTAINER_H
       
   160 
       
   161 
       
   162 // End of File