profilesapplication/Profiles/ProfileApp/SettingsViewInc/CProfileTabHandler.h
branchRCL_3
changeset 18 b7fa36b488f8
parent 17 861562a14a53
child 19 cd54903d48da
equal deleted inserted replaced
17:861562a14a53 18:b7fa36b488f8
     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:  Tab handler for handling tabs in Profiles
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPROFILETABHANDLER_H
       
    20 #define CPROFILETABHANDLER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <AknTabObserver.h>
       
    25 
       
    26 //  FORWARD DECLARATIONS
       
    27 class CProfileEngineHandler;
       
    28 class CProfileIndexHandler;
       
    29 class CAknNavigationControlContainer;
       
    30 class CCoeAppUi;
       
    31 class MCoeView;
       
    32 class CAknNavigationDecorator;
       
    33 class CAknTabGroup;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 *  Tab handler class for handling tabs in Profiles
       
    39 *  When instantiated, creates a tab for each profile and puts itself visible.
       
    40 *  Needs an instance of Index handler to handle indices of the profiles.
       
    41 *  Inherited from MAknTabObserver in order to receive events when tabs change.
       
    42 *  That however requires adding the tab group as topmost item in control stack.
       
    43 *
       
    44 *  @lib CProfileSettingsView.lib
       
    45 *  @since 2.5
       
    46 */
       
    47 class CProfileTabHandler : public CBase,
       
    48                            public MAknTabObserver
       
    49     {
       
    50     public:     // Constructors and destructor
       
    51 
       
    52         /**
       
    53         * Two-phased constructor.
       
    54         * @param aEngineHandler An instance of Engine Handler.
       
    55         * @param aIndexHandler An instance of Index Handler.
       
    56         * @param aNaviPane An instance of CAknNavigationControlContainer.
       
    57         * @return Returns an instance of CProfileTabHandler.
       
    58         */
       
    59         IMPORT_C static CProfileTabHandler* NewL(
       
    60             CProfileEngineHandler& aEngineHandler,
       
    61             CProfileIndexHandler& aIndexHandler,
       
    62             CAknNavigationControlContainer& aNaviPane );
       
    63 
       
    64         // Destructor.
       
    65         ~CProfileTabHandler();
       
    66 
       
    67     public:     // New methods
       
    68 
       
    69         /**
       
    70         * Returns tab group instance to be added to control stack.
       
    71         * @return Returns tab group instance.
       
    72         */
       
    73         IMPORT_C CAknTabGroup* TabGroup() const;
       
    74 
       
    75         /**
       
    76         * Sets a tab active.
       
    77         * @param aIndex Index of the tab to be activated.
       
    78         */
       
    79         void SetActiveTab( TInt aIndex );
       
    80 
       
    81         /**
       
    82         * Refreshes tab texts with profile names.
       
    83         */
       
    84         void RefreshTabsL();
       
    85         
       
    86         /**
       
    87         * Sets tab observer.
       
    88         * Tab events are forwarded to the observer if set.
       
    89         * @param aTabObserver Tab observer.
       
    90         */
       
    91         void SetTabObserver( MAknTabObserver* aTabObserver );
       
    92 
       
    93     protected:  // New methods
       
    94 
       
    95         /**
       
    96         * Creates tab group and reads names of profiles to tab texts.
       
    97         * Separated to own method to enable updating tabs dynamically
       
    98         * (i.e. supports profiles being added or deleted).
       
    99         */
       
   100         void CreateTabGroupL();
       
   101 
       
   102     protected:  // From base classes
       
   103 
       
   104        /**
       
   105         * From MAknTabObserver
       
   106         */
       
   107         void TabChangedL( TInt aIndex );
       
   108 
       
   109     protected:
       
   110 
       
   111         /**
       
   112         * C++ constructor.
       
   113         * @param aEngineHandler An instance of Engine Handler.
       
   114         * @param aIndexHandler An instance of Index Handler.
       
   115         * @param aNaviPane An instance of CAknNavigationControlContainer.
       
   116         */
       
   117         CProfileTabHandler(
       
   118             CProfileEngineHandler& aEngineHandler,
       
   119             CProfileIndexHandler& aIndexHandler,
       
   120             CAknNavigationControlContainer& aNaviPane );
       
   121 
       
   122         /**
       
   123         * By default Symbian 2nd phase constructor is private.
       
   124         */
       
   125         void ConstructL();
       
   126 
       
   127     private:    // Data
       
   128 
       
   129         // Profile Engine handler.
       
   130         CProfileEngineHandler& iEngineHandler;
       
   131 
       
   132         // Index handler
       
   133         CProfileIndexHandler& iIndexHandler;
       
   134 
       
   135         // Navi pane. Needed for creating tab group.
       
   136         CAknNavigationControlContainer& iNaviPane;
       
   137 
       
   138         // Own: Navigation decorator.
       
   139         CAknNavigationDecorator* iNaviDecorator;
       
   140 
       
   141         // Ref: Tab group owned by the navigation decorator.
       
   142         CAknTabGroup* iTabGroup;
       
   143 
       
   144         // Ref: Tab observer. Tab events are forwarded to the observer if set.
       
   145         MAknTabObserver* iTabObserver;
       
   146 
       
   147     };
       
   148 
       
   149 #endif // CPROFILETABHANDLER_H