systemsettings/GSAccessoryPlugin/inc/gsaccbaseview.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2005-2008 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:  Declaration of CGSAccBaseView class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CGSACCBASEVIEW_H
       
    20 #define CGSACCBASEVIEW_H
       
    21 
       
    22 #include <AccessorySettings.h>
       
    23 #include <aknview.h>
       
    24 #include <eikclb.h>
       
    25 
       
    26 class CGSAccBaseContainer;
       
    27 class CGSAccessoryPluginModel;
       
    28 
       
    29 /**
       
    30 *  Base class for GS Accessory settings views.
       
    31 *
       
    32 *  @since S60 3.1
       
    33 */
       
    34 class CGSAccBaseView : public CAknView, public MEikListBoxObserver
       
    35     {
       
    36 
       
    37 public:
       
    38 
       
    39     /**
       
    40     * Destructor.
       
    41     */
       
    42     virtual ~CGSAccBaseView();
       
    43 
       
    44 protected: // From CAknView
       
    45 
       
    46     /**
       
    47     * @see class CAknView.
       
    48     */
       
    49     void HandleCommandL( TInt aCommand );
       
    50 
       
    51     /**
       
    52     * @see class CAknView.
       
    53     */
       
    54     void DoActivateL(
       
    55         const TVwsViewId& aPrevViewId,
       
    56         TUid aCustomMessageId,
       
    57         const TDesC8& aCustomMessage );
       
    58 
       
    59     /**
       
    60     * @see class CAknView.
       
    61     */
       
    62     void DoDeactivate();
       
    63 
       
    64 protected: // From MEikMenuObserver
       
    65 
       
    66     /**
       
    67     * @see class MEikMenuObserver.
       
    68     */
       
    69     void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
    70 
       
    71 protected: // From MEikListBoxObserver
       
    72 
       
    73     /**
       
    74     * @see class MEikListBoxObserver.
       
    75     */
       
    76     void HandleListBoxEventL(
       
    77         CEikListBox* aListBox,
       
    78         TListBoxEvent aEventType );
       
    79 
       
    80 protected:
       
    81 
       
    82     /**
       
    83     * First phase constructor.
       
    84     *
       
    85     * @param aModel Data model for reading and writing settings.
       
    86     */
       
    87     CGSAccBaseView( CGSAccessoryPluginModel& aModel );
       
    88 
       
    89     /**
       
    90     * Updates listbox items value.
       
    91     *
       
    92     * @param aItemId Item which is updated.
       
    93     */
       
    94     void UpdateListBoxL( TInt aItemId );
       
    95 
       
    96     /**
       
    97     * Show a selection dialog with content specified in resources.
       
    98     *
       
    99     * @param aDlgResourceID Resource id for the dialog resource.
       
   100     * @param aItemsResourceID Resource id for the list of available items.
       
   101     * @param aCurrentSelectionIndex Index of the item which should be selected
       
   102     * initially. On return, contains the selection made by the user.
       
   103     * @return ETrue if the new value should be saved.
       
   104     */
       
   105     TBool ShowRadioButtonSettingsPageL(
       
   106         TInt aDlgResourceID,
       
   107         TInt aItemsResourceID,
       
   108 		TInt& aCurrentSelectionIndex ) const;
       
   109 
       
   110     /**
       
   111     * Show a selection dialog with content given as parameter.
       
   112     *
       
   113     * @param aDlgResourceID Resource id for the dialog resource.
       
   114     * @param aItemArray Array of available items.
       
   115     * @param aCurrentSelectionIndex Index of the item which should be selected
       
   116     * initially. On return, contains the selection made by the user.
       
   117     * @return ETrue if the new value should be saved.
       
   118     */
       
   119     TBool ShowRadioButtonSettingsPageL(
       
   120         TInt aDlgResourceID,
       
   121 		const MDesCArray& aItemArray,
       
   122 		TInt& aCurrentSelectionIndex ) const;
       
   123 
       
   124     /**
       
   125     * Show the default profile selection dialog and store user selection.
       
   126     *
       
   127     * @param aProfileIdKey Cenrep key where the default profile is stored.
       
   128     * @param aListBoxId Identifies list box to update if profile is changed.
       
   129     */
       
   130     void ChangeDefaultProfileL(
       
   131         TInt aProfileKey,
       
   132         TInt aListBoxId );
       
   133 
       
   134     /**
       
   135     * Change automatic answer mode setting.
       
   136     *
       
   137     * @param aAutoAnswerKey Cenrep key where the auto answer mode is stored.
       
   138     * @param aListBoxId Identifies list box to update if mode is changed.
       
   139     * @param aSettingPage Show the setting page if ETrue, otherwise just flip
       
   140     * the value.
       
   141     */
       
   142     void ChangeAutoAnswerModeSettingL(
       
   143         TInt aAutoAnswerKey,
       
   144         TInt aListBoxId,
       
   145         TBool aUseSettingPage );
       
   146 
       
   147     /**
       
   148     * Change lights mode setting.
       
   149     *
       
   150     * @param aAccMode Identifies the accessory mode to change the light
       
   151     * setting for.
       
   152     * @param aAccSetting Identifies the light setting to change.
       
   153     * @param aListBoxId Identifies list box to update if mode is changed.
       
   154     * @param aSettingPage Show the setting page if ETrue, otherwise just flip
       
   155     * the value.
       
   156     */
       
   157     void ChangeLightModeSettingL(
       
   158         TAccMode aAccMode,
       
   159         TInt aAccSetting,
       
   160         TInt aListBoxId,
       
   161         TBool aUseSettingPage );
       
   162 
       
   163 protected:
       
   164 
       
   165     /**
       
   166     * Functionality for creating a container. Called by DoActivateL().
       
   167     * Implemented by sub-class.
       
   168     */
       
   169     virtual void NewContainerL() = 0;
       
   170 
       
   171     /**
       
   172     * Handle selection of list box.
       
   173     * Called by HandleListBoxEventL
       
   174     *
       
   175     * @param aSelectedItem Currently selected item.
       
   176     */
       
   177     virtual void HandleListBoxSelectionL( TInt aSelectedItem ) = 0;
       
   178 
       
   179 private:
       
   180 
       
   181     /**
       
   182     * Basic idea behind General Settings plugin framework is that view objects
       
   183     * stay alive even when they are not active, but container objects do not.
       
   184     * Create new container.
       
   185     */
       
   186     void CreateContainerL();
       
   187 
       
   188     /**
       
   189     * Delele the container.
       
   190     */
       
   191     void DestroyContainer();
       
   192 
       
   193 protected: // data
       
   194 
       
   195     /** Data model. */
       
   196     CGSAccessoryPluginModel& iModel;
       
   197 
       
   198     /**
       
   199     * Container. Own.
       
   200     * Sub-classes are responsible for creating object of correct type.
       
   201     */
       
   202     CGSAccBaseContainer* iContainer;
       
   203     };
       
   204 
       
   205 #endif // CGSACCBASEVIEW_H