gsprofilesrv_plat/settings_framework_api/inc/GSParentContainer.h
changeset 0 8c5d936e5675
child 8 f62c3a3d66b8
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     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          * @return the exact position of the listbox containing current item index,
       
   117          * iVerticalOffset and  TopItemindex
       
   118          */
       
   119         void GetPositionL(RArray<TInt>& posArray);
       
   120 
       
   121         /**
       
   122          * set listbox's exact position.
       
   123          */
       
   124         void SetPosition(const RArray<TInt>& pos, TBool aChangeMode);   
       
   125         
       
   126 
       
   127     public: // From CCoeControl
       
   128 
       
   129         /**
       
   130         * Set focus on the selected listbox. For animated skins feature.
       
   131         */
       
   132         IMPORT_C void FocusChanged( TDrawNow aDrawNow );
       
   133 
       
   134         /**
       
   135         * See base class.
       
   136         */
       
   137         void HandleResourceChange( TInt aType );
       
   138 
       
   139         /**
       
   140         * See base class.
       
   141         */
       
   142         void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   143 
       
   144     public: //New
       
   145 
       
   146         void HandleSelectionKeyL();
       
   147 
       
   148     protected: // From MEikListBoxObserver
       
   149 
       
   150         /**
       
   151         * Handles listbox events.
       
   152         * @param aListBox Listbox where the event occurred.
       
   153         * @param aEventType Event type.
       
   154         */
       
   155         void HandleListBoxEventL( CEikListBox* aListBox,
       
   156             TListBoxEvent aEventType );
       
   157 
       
   158     private: // New
       
   159 
       
   160         /**
       
   161         * Creates a listbox.
       
   162         */
       
   163         void CreateListBoxL( TGSListboxTypes aListBoxType );
       
   164 
       
   165         /**
       
   166         * Adds plugin data to listbox.
       
   167         * @param aPlugin A plugin whose data is to be used.
       
   168         * @param aItemTextArray Array for plugin texts and format strings used
       
   169         *        by lbx.
       
   170         * @param aIconArray Array for icons used in lbx.
       
   171         * @param aIconCounter Counter for inserted icons, will be updated.
       
   172         */
       
   173         void AddPluginDataToLbxL( CGSPluginInterface* aPlugin,
       
   174                                   CDesCArray* aItemTextArray,
       
   175                                   CAknIconArray* aIconArray,
       
   176                                   TInt& aIconCounter );
       
   177 
       
   178     private: // From CCoeControl
       
   179 
       
   180         /**
       
   181         * See base class.
       
   182         */
       
   183         void SizeChanged();
       
   184 
       
   185         /**
       
   186         * See base class.
       
   187         */
       
   188         TInt CountComponentControls() const;
       
   189 
       
   190         /**
       
   191         * See base class.
       
   192         */
       
   193         CCoeControl* ComponentControl(TInt /*aIndex*/) const;
       
   194 
       
   195         /**
       
   196         * See base class.
       
   197         */
       
   198         TKeyResponse OfferKeyEventL(
       
   199             const TKeyEvent& aKeyEvent,
       
   200             TEventCode aType );
       
   201 
       
   202     private: // Data
       
   203 
       
   204         // Application UI. Not owned.
       
   205         CAknViewAppUi* iAppUi;
       
   206 
       
   207         // Owned listbox.
       
   208         CEikListBox* iListBox;
       
   209 
       
   210         // Type of iListBox.
       
   211         TGSListboxTypes iListBoxType;
       
   212 
       
   213         // Pointer to listbox model's item texts. Note that the indexes of
       
   214         // listbox items are mapped directly to the indexes in plugin array.
       
   215         // Plugin which maps to selected listbox item index in plugin array is
       
   216         // activated when item is selected in listbox.
       
   217         //
       
   218         // Owned by iListBox.
       
   219         //
       
   220         CDesCArray* iItemTextArray;
       
   221 
       
   222         // Array of the child plugins. Owned by CGSParentPlugin.
       
   223         CArrayPtrFlat<CGSPluginInterface>* iPluginArray;
       
   224 
       
   225         // Array of pointers to iPluginArray plugins which are visible.
       
   226         // This is the actual array which is displayed by the listbox.
       
   227         // It is needed because iPluginArray also contains non-visible plugins
       
   228         // and therefore the indexes do not match to lbx items.
       
   229         CArrayPtrFlat<CGSPluginInterface>* iVisiblePlugins;
       
   230 
       
   231         // Pointer to parent plugin. Not owned.
       
   232         CGSParentPlugin* iParentPlugin;
       
   233 
       
   234         // Pointer to GSWatchDog owned by GS Application document. Not owned.
       
   235         MGSWatchDog* iGSWatchDog;
       
   236        
       
   237     };
       
   238 
       
   239 
       
   240 #endif // GSPARENTCONTAINER_H
       
   241 // End of File