systemsettings/gssensorplugin/inc/gssensorplugincontainer.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2006 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 for the sensor settings
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef GSSENSORPLUGINCONTAINER_H
       
    20 #define GSSENSORPLUGINCONTAINER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <gsbasecontainer.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CGSListBoxItemTextArray;
       
    27 class CGSSensorPluginModel;
       
    28 class CAknViewAppUi;
       
    29 class CGSPluginInterface;
       
    30 class MGSSensorMskObserver;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35  *  GSSensorPluginContainer container class
       
    36  *
       
    37  *  container class for sensor settings view
       
    38  *
       
    39  *  @lib gssensorplugin.lib
       
    40  *  @since S60 5.0
       
    41  */
       
    42 class CGSSensorPluginContainer : public CGSBaseContainer
       
    43     {
       
    44     public:
       
    45         
       
    46         /**
       
    47          * Symbian 2nd phase constructor.
       
    48          * This constructL is not used, but it needs to be here
       
    49          * as it is derived from CGSbaseContainer
       
    50          *
       
    51          * @param aRect Listbox's rectancle
       
    52          */
       
    53         void ConstructL( const TRect& aRect );
       
    54 
       
    55         /**
       
    56          * Symbian 2nd phase constructor.
       
    57          *
       
    58          * @param aRect Rectangle
       
    59          * @param aAppUi Application UI
       
    60          * @param aPluginArray Contains information of child plugins
       
    61          */
       
    62         void ConstructL(
       
    63             const TRect& aRect,
       
    64             CAknViewAppUi* aAppUi,
       
    65             CArrayPtrFlat<CGSPluginInterface>* aPluginArray );
       
    66             
       
    67         /**
       
    68          * Destructor.
       
    69          */
       
    70         virtual ~CGSSensorPluginContainer();
       
    71         
       
    72         /**
       
    73          * C++ constructor
       
    74          *
       
    75          * @param aModel Model of this plug-in
       
    76          */
       
    77         CGSSensorPluginContainer( CGSSensorPluginModel* aModel, 
       
    78                                   MGSSensorMskObserver& aMskObserver );
       
    79 
       
    80         /**
       
    81          * Updates listbox's item's value.
       
    82          *
       
    83          * @param aFeatureId An item which is updated.
       
    84          */
       
    85         void UpdateListBoxL( TInt aFeatureId );
       
    86 
       
    87 		/**
       
    88          * Retrieves the currently selected listbox feature id
       
    89          *
       
    90          * @return TInt Current feature id.
       
    91          */
       
    92         TInt CurrentFeatureId() const;
       
    93 
       
    94         /**
       
    95          * Sets Dynamic Text value
       
    96          * 
       
    97          * @param aValue Sensors status value
       
    98          */
       
    99 	    void SetSensorStatusTextL( TInt aValue );
       
   100 
       
   101         /**
       
   102          * Finds user selected plugin from plugin array
       
   103          *
       
   104          * @return Plugin which is selected in the lbx or leaves 
       
   105          * with KErrnotFound if no plugins exist.
       
   106          */
       
   107         CGSPluginInterface* SelectedPluginL();
       
   108 
       
   109         /**
       
   110          * Makes extended plugins item
       
   111          */
       
   112         void MakeExtendedPluginsItemL();
       
   113 
       
   114         /**
       
   115          * Checks are there extended plugins and activates if only one exists
       
   116          */
       
   117         void ActivateExtendedPluginL();
       
   118 
       
   119     protected:
       
   120 
       
   121         /**
       
   122          * From CGSBaseContainer. Constructs listbox and initializes its sub-folders
       
   123          *
       
   124          * @param aResLbxId: resource ID of the listbox item array
       
   125          */
       
   126         void ConstructListBoxL( TInt aResLbxId );
       
   127 
       
   128     private:
       
   129 
       
   130         /**
       
   131          * Create listbox from resource
       
   132          */
       
   133         void CreateListBoxItemsL();
       
   134 
       
   135         /**
       
   136          * Makes Sensors view visible
       
   137          */
       
   138         void MakeSensorsItemL();
       
   139 
       
   140         /**
       
   141          * Makes Tapping Control view visible
       
   142          */
       
   143         void MakeTapCtrlItemL();
       
   144 
       
   145         /**
       
   146          * Makes Turning Control view visible
       
   147          */
       
   148         void MakeTurnCtrlItemL();
       
   149 
       
   150         /**
       
   151          * Makes Orientation view visible
       
   152          */
       
   153         void MakeOrientationItemL();
       
   154 
       
   155         /**
       
   156          * From CGSBaseContainer. Required for help.
       
   157          *
       
   158          * @param aContext Contains help context
       
   159          */
       
   160         void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   161 
       
   162         /**
       
   163          * From CGSBaseContainer. Constructs correct textformat for one list box item 
       
   164          * and adds it in listbox
       
   165          *
       
   166          * @param aPos Position of text in listbox
       
   167          * @param aFirstLabel Text in first row of listbox item
       
   168          * @param aSecondLabel Text in second row of listbox item
       
   169          */
       
   170         void AppendListItemL( const TInt aPos, 
       
   171                               const TDesC16& aFirstLabel, 
       
   172                               const TDesC16& aSecondLabel );
       
   173 
       
   174         /**
       
   175          * Handles changes in MSK label between item changes in listbox
       
   176          */
       
   177         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
       
   178 
       
   179     private: // Data
       
   180 
       
   181         /**
       
   182          * listbox item array. Contains listbox items
       
   183          */
       
   184 		CGSListBoxItemTextArray* iListboxItemArray;
       
   185 
       
   186         /**
       
   187          * Listbox item text array. Contains listbox item texts
       
   188          */
       
   189         CDesCArray* iListBoxTextArray;
       
   190 
       
   191         /** 
       
   192          * General list box items. Contains localized listbox texts
       
   193          * from resource file.
       
   194          */
       
   195         CDesCArrayFlat* iListItems;
       
   196 
       
   197         /**
       
   198          * Model pointer. Does not own it, so do not delete this pointer.
       
   199          */
       
   200         CGSSensorPluginModel* iModel;
       
   201 
       
   202         /** 
       
   203          * Sensors ON / OFF text
       
   204          */
       
   205         CDesCArrayFlat* iSensorStatusText;
       
   206 
       
   207         /**
       
   208          * Application UI. Not owned.
       
   209          */
       
   210         CAknViewAppUi* iAppUi;
       
   211 
       
   212         /**
       
   213          * Array of the child plugins. Owned by CGSSensorPlugin.
       
   214          */
       
   215         CArrayPtrFlat<CGSPluginInterface>* iPluginArray;
       
   216 
       
   217         /**
       
   218          * Reference to main view. Does not own
       
   219          */
       
   220         MGSSensorMskObserver& iMskObserver;
       
   221 
       
   222         /**
       
   223          * General item count. Used when calculating item indexes to extedned plugins
       
   224          */
       
   225         TInt iGeneralItemCount;
       
   226     };
       
   227 
       
   228 #endif //GSSENSORPLUGINCONTAINER_H