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