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