gssettingsuis/Gs/GSApplication/Inc/GSMainContainer.h
changeset 0 8c5d936e5675
child 8 f62c3a3d66b8
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     1 /*
       
     2 * Copyright (c) 2002-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 class for main view.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef GSCONTAINER_H
       
    19 #define GSCONTAINER_H
       
    20 
       
    21 #include    "gsbasecontainer.h"
       
    22 #include    <bldvariant.hrh>
       
    23 #include    <AknIconArray.h>
       
    24 #include    <AknsUtils.h>     // For loading icons
       
    25 
       
    26 // CLASS DECLARATION
       
    27 class CAknViewAppUi;
       
    28 class CAknSingleLargeStyleListBox;
       
    29 class CGSPluginInterface;
       
    30 
       
    31 /**
       
    32 * Container class for the GS Main view.
       
    33 * @since Series60_3.1
       
    34 */
       
    35 class CGSMainContainer : public CCoeControl, public MEikListBoxObserver
       
    36 {
       
    37     public: // Constructors and destructor
       
    38 
       
    39         /**
       
    40         * Symbian OS constructor.
       
    41         * Required by the base class.
       
    42         *
       
    43         */
       
    44         void ConstructL(
       
    45             const TRect& aRect,
       
    46             CAknViewAppUi* aAppUi,
       
    47             CArrayPtrFlat<CGSPluginInterface>* aPluginArray );
       
    48 
       
    49         /**
       
    50         * Destructor.
       
    51         */
       
    52         ~CGSMainContainer();
       
    53 
       
    54     public: // New
       
    55 
       
    56         /**
       
    57         * Updates listbox.
       
    58         */
       
    59         void UpdateListBoxL();
       
    60 
       
    61         /**
       
    62         * @return pointer to owned listbox.
       
    63         */
       
    64         CAknSingleLargeStyleListBox* ListBox();
       
    65 
       
    66         /**
       
    67         * @return Plugin which is selected in the lbx.
       
    68         */
       
    69         CGSPluginInterface* SelectedPlugin();
       
    70 
       
    71         /**
       
    72         * Sets selected lbx item using the UID of the item. If the item is not
       
    73         * existing or visible anymore, selected item is the first item in the
       
    74         * lbx.
       
    75         */
       
    76         void SetSelectedItem( TUid aSelectedItemUid );
       
    77         
       
    78         /**
       
    79          * Set the empty text of list box.
       
    80          */
       
    81         void SetListBoxEmptyTextL(const TDes& aEmpty);
       
    82 
       
    83         /**
       
    84          * @return the exact position of the listbox containing current item index,
       
    85          * iVerticalOffset and  TopItemindex
       
    86          */
       
    87         void GetPositionL(RArray<TInt>& posArray);
       
    88 
       
    89         /**
       
    90          * set listbox's exact position.
       
    91          */
       
    92         void SetPosition(const RArray<TInt>& pos, TBool aChangeMode);
       
    93         
       
    94 
       
    95     public: // From CCoeControl
       
    96 
       
    97         /**
       
    98         * See base class.
       
    99         */
       
   100         void HandleResourceChange( TInt aType );
       
   101 
       
   102         /**
       
   103         * Set focus on the selected listbox. For animated skins feature.
       
   104         */
       
   105         void FocusChanged( TDrawNow aDrawNow );
       
   106 
       
   107     protected: // New
       
   108 
       
   109         /**
       
   110         * Required for help.
       
   111         */
       
   112         void GetHelpContext( TCoeHelpContext& aContext ) const;
       
   113 
       
   114     protected: // From MEikListBoxObserver
       
   115         /**
       
   116         * Handles listbox events.
       
   117         * @param aListBox Listbox where the event occurred.
       
   118         * @param aEventType Event type.
       
   119         */
       
   120         void HandleListBoxEventL( CEikListBox* aListBox,
       
   121                                   TListBoxEvent aEventType );
       
   122     private: // New
       
   123 
       
   124         /**
       
   125         * Adds plugin data to listbox.
       
   126         * @param aPlugin A plugin whose data is to be used.
       
   127         * @param aIndex Index of the plugin in the listbox.
       
   128         * @param aItemTextArray Array for plugin texts and format strings used
       
   129         *        by lbx.
       
   130         * @param aIconArray Array for icons used in lbx.
       
   131         */
       
   132         void AddPluginDataToLbxL( CGSPluginInterface* aPlugin,
       
   133                                   TInt aIndex,
       
   134                                   CDesCArray* aItemTextArray,
       
   135                                   CAknIconArray* aIconArray );
       
   136 
       
   137     private: // From CCoeControl
       
   138 
       
   139         /**
       
   140         * See base class.
       
   141         */
       
   142         void SizeChanged();
       
   143 
       
   144         /**
       
   145         * See base class.
       
   146         */
       
   147         TInt CountComponentControls() const;
       
   148 
       
   149         /**
       
   150         * See base class.
       
   151         */
       
   152         CCoeControl* ComponentControl( TInt /*aIndex*/ ) const;
       
   153 
       
   154         /**
       
   155         * See base class.
       
   156         */
       
   157         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   158                                      TEventCode aType );
       
   159 
       
   160     private: // Data
       
   161 
       
   162         // Owned listbox.
       
   163         CAknSingleLargeStyleListBox* iListBox;
       
   164 
       
   165         // Pointer to Application UI. Not owned.
       
   166         CAknViewAppUi* iAppUi;
       
   167 
       
   168         /**
       
   169         * Pointer to listbox model's item texts. Note that the indexes of
       
   170         * listbox items are mapped directly to the indexes in plugin array.
       
   171         * Plugin which maps to selected listbox item index in plugin array is
       
   172         * activated when item is selected in listbox.
       
   173         *
       
   174         * Owned by iListBox.
       
   175         */
       
   176         CDesCArray* iItemTextArray;
       
   177 
       
   178         // Given from CGSMainView - not owned
       
   179         CArrayPtrFlat<CGSPluginInterface>* iPluginArray;
       
   180 
       
   181         // Array of pointers to iPluginArray plugins which are visible.
       
   182         // This is the actual array which is displayed by the listbox.
       
   183         // It is needed because iPluginArray also contains non-visible plugins
       
   184         // and therefore the indexes do not match to lbx items.
       
   185         CArrayPtrFlat<CGSPluginInterface>* iVisiblePlugins;
       
   186 };
       
   187 
       
   188 
       
   189 #endif // GSCONTAINER_H
       
   190 // End of File