gsprofilesrv_plat/settings_framework_api/inc/GSParentContainer.h
changeset 68 13e71d907dc3
equal deleted inserted replaced
40:6465d5bb863a 68:13e71d907dc3
       
     1 /*
       
     2 * Copyright (c) 2005 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 GSParentPlugin.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef GSPARENTCONTAINER_H
       
    20 #define GSPARENTCONTAINER_H
       
    21 
       
    22 #include    "gsparentplugin.h"
       
    23 #include    <bldvariant.hrh>
       
    24 #include    <AknIconArray.h>
       
    25 #include    <AknsUtils.h>     // For loading icons
       
    26 #include    <coecntrl.h>
       
    27 #include    <eiklbx.h>
       
    28 #include    <eiktxlbx.h>
       
    29 
       
    30 // CLASS DECLARATION
       
    31 class CAknViewAppUi;
       
    32 class CGSPluginInterface;
       
    33 class CAknSingleLargeStyleListBox;
       
    34 class MGSWatchDog;
       
    35 class CGsContainerExt;
       
    36 
       
    37 /**
       
    38 *  Container class for the GS Main view.
       
    39 *  @lib GSFramework.lib
       
    40 *  @since Series60_3.1
       
    41 */
       
    42 class CGSParentContainer : public CCoeControl, public MEikListBoxObserver
       
    43     {
       
    44     public: // Constructors and destructor
       
    45 
       
    46         /**
       
    47         * Symbian OS constructor.
       
    48         * Required by the base class.
       
    49         */
       
    50         /*void ConstructL(
       
    51             const TRect& aRect,
       
    52             CAknViewAppUi* aAppUi,
       
    53             CArrayPtrFlat<CGSPluginInterface>* aPluginArray,
       
    54             TInt aTitleRscId );*/
       
    55 
       
    56         /**
       
    57         * Symbian OS constructor.
       
    58         * Required by the base class.
       
    59         */
       
    60         void ConstructL(
       
    61             const TRect& aRect,
       
    62             CAknViewAppUi* aAppUi,
       
    63             CArrayPtrFlat<CGSPluginInterface>* aPluginArray,
       
    64             TInt aTitleRscId,
       
    65             CGSParentPlugin* aParentPlugin,
       
    66             TGSListboxTypes aListBoxType =
       
    67                 EGSListBoxTypeSingleLarge );
       
    68 
       
    69 	      /**
       
    70         * Destructor.
       
    71         */
       
    72         ~CGSParentContainer();
       
    73 
       
    74     public: // New
       
    75 
       
    76         /**
       
    77         * Updates iListBox. Listbox is updated depending on the type of the
       
    78         * listbox. Plugins are inserted to listbox only if they are visible.
       
    79         */
       
    80         void UpdateListBoxL();
       
    81 
       
    82         /**
       
    83         * @return Pointer to owned listbox
       
    84         */
       
    85         CEikListBox* ListBox();
       
    86 
       
    87         /**
       
    88         * @return Plugin which is selected in the lbx or NULL if no plugins
       
    89         *         exist.
       
    90         */
       
    91         CGSPluginInterface* SelectedPlugin();
       
    92 
       
    93         /**
       
    94         * Sets selected lbx item using the UID of the item. If the item is not
       
    95         * existing or visible anymore, selected item is the first item in the
       
    96         * lbx.
       
    97         */
       
    98         void SetSelectedItem( TUid aSelectedItemUid );
       
    99         
       
   100         /**
       
   101         * @return Plugin which is top in the lbx or NULL if no plugins
       
   102         *         exist.
       
   103         */
       
   104         CGSPluginInterface* TopPlugin();
       
   105         
       
   106         /**
       
   107         * Sets top lbx item using the UID of the item.
       
   108         */
       
   109         void SetTopItem( TUid aTopItemUid );
       
   110 
       
   111         /**
       
   112          * Set the empty text of list box.
       
   113          */
       
   114         void SetListBoxEmptyTextL(const TDes& aEmpty );
       
   115         
       
   116         /**
       
   117          * Store listbox's exact position.
       
   118         * @param aPosition includes the exact position of the listbox.
       
   119         */
       
   120         void StoreListBoxPositionL( CGSParentPlugin::TListBoxPosition& aPosition );
       
   121 
       
   122         /**
       
   123         * Restore listbox's exact position.
       
   124         * @param aPosition includes the exact position of the listbox.
       
   125         * @param aScreenModeChanged indicates whether the screen mode is changed.
       
   126         */
       
   127         void RestoreListBoxPositionL( const CGSParentPlugin::TListBoxPosition& aPosition, TBool aScreenModeChanged );                
       
   128         
       
   129     public: // From CCoeControl
       
   130 
       
   131         /**
       
   132         * Set focus on the selected listbox. For animated skins feature.
       
   133         */
       
   134         IMPORT_C void FocusChanged( TDrawNow aDrawNow );
       
   135 
       
   136         /**
       
   137         * See base class.
       
   138         */
       
   139         void HandleResourceChange( TInt aType );
       
   140 
       
   141         /**
       
   142         * See base class.
       
   143         */
       
   144         void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   145 
       
   146     public: //New
       
   147 
       
   148         void HandleSelectionKeyL();
       
   149 
       
   150     protected: // From MEikListBoxObserver
       
   151 
       
   152         /**
       
   153         * Handles listbox events.
       
   154         * @param aListBox Listbox where the event occurred.
       
   155         * @param aEventType Event type.
       
   156         */
       
   157         void HandleListBoxEventL( CEikListBox* aListBox,
       
   158             TListBoxEvent aEventType );
       
   159 
       
   160     private: // New
       
   161 
       
   162         /**
       
   163         * Creates a listbox.
       
   164         */
       
   165         void CreateListBoxL( TGSListboxTypes aListBoxType );
       
   166 
       
   167         /**
       
   168         * Adds plugin data to listbox.
       
   169         * @param aPlugin A plugin whose data is to be used.
       
   170         * @param aItemTextArray Array for plugin texts and format strings used
       
   171         *        by lbx.
       
   172         * @param aIconArray Array for icons used in lbx.
       
   173         * @param aIconCounter Counter for inserted icons, will be updated.
       
   174         */
       
   175         void AddPluginDataToLbxL( CGSPluginInterface* aPlugin,
       
   176                                   CDesCArray* aItemTextArray,
       
   177                                   CAknIconArray* aIconArray,
       
   178                                   TInt& aIconCounter );
       
   179 
       
   180     private: // From CCoeControl
       
   181 
       
   182         /**
       
   183         * See base class.
       
   184         */
       
   185         void SizeChanged();
       
   186 
       
   187         /**
       
   188         * See base class.
       
   189         */
       
   190         TInt CountComponentControls() const;
       
   191 
       
   192         /**
       
   193         * See base class.
       
   194         */
       
   195         CCoeControl* ComponentControl(TInt /*aIndex*/) const;
       
   196 
       
   197         /**
       
   198         * See base class.
       
   199         */
       
   200         TKeyResponse OfferKeyEventL(
       
   201             const TKeyEvent& aKeyEvent,
       
   202             TEventCode aType );
       
   203 
       
   204     private: // Data
       
   205 
       
   206         // Application UI. Not owned.
       
   207         CAknViewAppUi* iAppUi;
       
   208 
       
   209         // Owned listbox.
       
   210         CEikListBox* iListBox;
       
   211 
       
   212         // Type of iListBox.
       
   213         TGSListboxTypes iListBoxType;
       
   214 
       
   215         // Pointer to listbox model's item texts. Note that the indexes of
       
   216         // listbox items are mapped directly to the indexes in plugin array.
       
   217         // Plugin which maps to selected listbox item index in plugin array is
       
   218         // activated when item is selected in listbox.
       
   219         //
       
   220         // Owned by iListBox.
       
   221         //
       
   222         CDesCArray* iItemTextArray;
       
   223 
       
   224         // Array of the child plugins. Owned by CGSParentPlugin.
       
   225         CArrayPtrFlat<CGSPluginInterface>* iPluginArray;
       
   226 
       
   227         // Array of pointers to iPluginArray plugins which are visible.
       
   228         // This is the actual array which is displayed by the listbox.
       
   229         // It is needed because iPluginArray also contains non-visible plugins
       
   230         // and therefore the indexes do not match to lbx items.
       
   231         CArrayPtrFlat<CGSPluginInterface>* iVisiblePlugins;
       
   232 
       
   233         // Pointer to parent plugin. Not owned.
       
   234         CGSParentPlugin* iParentPlugin;
       
   235 
       
   236         // Pointer to GSWatchDog owned by GS Application document. Not owned.
       
   237         CGsContainerExt* iExt;
       
   238     };
       
   239 
       
   240 
       
   241 #endif // GSPARENTCONTAINER_H
       
   242 // End of File