menufw/menufwui/mmwidgets/inc/mmgridcontainer.h
branchRCL_3
changeset 83 5456b4e8b3a8
child 88 3321d3e205b6
equal deleted inserted replaced
82:5f0182e07bfb 83:5456b4e8b3a8
       
     1 /*
       
     2 * Copyright (c)  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:  CMmGridContainer declaration
       
    15 *  Version     : %version: MM_29.1.14 % << Don't touch! Updated by Synergy at check-out.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef C_MMGRIDCONTAINER_H
       
    21 #define C_MMGRIDCONTAINER_H
       
    22 
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 #include <AknsLayeredBackgroundControlContext.h>
       
    26 #include <AknsListBoxBackgroundControlContext.h>
       
    27 #include <AknGrid.h>
       
    28 #include "mmwidgetcontainer.h"
       
    29 #include "hnglobals.h"
       
    30 
       
    31 class CMmGrid;
       
    32 class CMmMarqueeAdapter;
       
    33 class CEikColumnListBox;
       
    34 class CNaviScrollTimer;
       
    35 class CHnSuiteModel;
       
    36 class CMmTemplateLibrary;
       
    37 class CMmListBoxItemDrawer;
       
    38 
       
    39 /**
       
    40  *  Container for Multimedia Menu grid widget
       
    41  *
       
    42  *  @code
       
    43  *  @endcode
       
    44  *  @lib mmwidgets
       
    45  *  @since S60 v5.0
       
    46  *  @ingroup group_mmwidgets
       
    47  */
       
    48 NONSHARABLE_CLASS( CMmGridContainer ) : public CMmWidgetContainer
       
    49     {
       
    50 public:
       
    51     /**
       
    52      * Two-phased constructor.
       
    53      *
       
    54      * @since S60 v5.0
       
    55      * @param aRect Rectangle of widget control.
       
    56      * @param aObjectProvider Object provider.
       
    57      * @param aTemplateLibrary template library for Drawer
       
    58      */
       
    59     static CMmGridContainer* NewL( const TRect& aRect,
       
    60         MObjectProvider* aObjectProvider, CMmTemplateLibrary* aTemplateLibrary );
       
    61 
       
    62     /**
       
    63      * Two-phased constructor.
       
    64      *
       
    65      * @since S60 v5.0
       
    66      * @param aRect Rectangle of widget control.
       
    67      * @param aObjectProvider Object provider.
       
    68      * @param aTemplateLibrary template library for Drawer
       
    69      */
       
    70     static CMmGridContainer* NewLC( const TRect& aRect,
       
    71         MObjectProvider* aObjectProvider, CMmTemplateLibrary* aTemplateLibrary );
       
    72 
       
    73     /**
       
    74      * Destructor.
       
    75      *
       
    76      * @since S60 v5.0
       
    77      */
       
    78     virtual ~CMmGridContainer();
       
    79 
       
    80     /**
       
    81      * Gets grid widget.
       
    82      *
       
    83      * @since S60 v5.0
       
    84      * @return Pointer to grid.
       
    85      */
       
    86     CAknGrid* Grid();
       
    87 
       
    88 public: // from base class CMmWidgetContainer
       
    89 
       
    90     /**
       
    91      * Handle item addition.
       
    92      *
       
    93      * @since S60 v3.0
       
    94      */
       
    95     void HandleItemAdditionL();
       
    96 
       
    97     /**
       
    98      * Handle item removal.
       
    99      *
       
   100      * @since S60 v3.0
       
   101      */
       
   102     void HandleItemRemovalL();
       
   103 
       
   104     /**
       
   105      * Sets the default highlight in grid.
       
   106      *
       
   107      * @since S60 v5.0
       
   108      * @param aRedraw Is highlight to redraw.
       
   109      */
       
   110     IMPORT_C void SetDefaultHighlightL(  TBool aRedraw = ETrue  );
       
   111 
       
   112     /**
       
   113      * Checks if widget is in edit mode state.
       
   114      *
       
   115      * @since S60 v5.0
       
   116      * @param aIsEditMode Is grid in edit mode state.
       
   117      */
       
   118     void SetEditModeL( TBool aIsEditMode );
       
   119 
       
   120     /**
       
   121      * Derived from CCoeControl, called when container rectangle size is changed.
       
   122      *
       
   123      * @since S60 v5.0
       
   124      */
       
   125     void SizeChanged();
       
   126 
       
   127     /**
       
   128      * Gets grid model.
       
   129      *
       
   130      * @since S60 v5.0
       
   131      * @return Grid model.
       
   132      */
       
   133     CMmListBoxModel* GetMmModel();
       
   134 
       
   135     /**
       
   136      * Sets empty text shown when grid is empty.
       
   137      *
       
   138      * @since S60 v5.0
       
   139      * @param aText Text to be shown when grid is empty.
       
   140      */
       
   141     IMPORT_C void SetEmptyTextL( const TDesC& aText );
       
   142 
       
   143     /**
       
   144      * Sets item drawer and view background context.
       
   145      *
       
   146      * @since S60 v5.0
       
   147      * @param aBgContext Background context.
       
   148      */
       
   149     void SetItemDrawerAndViewBgContext(
       
   150         CAknsBasicBackgroundControlContext * aBgContext );
       
   151 
       
   152     /**
       
   153      * Sets up the grid layout.
       
   154      *
       
   155      * @since S60 v5.0
       
   156      */
       
   157     void SetupWidgetLayoutL();
       
   158 
       
   159     /**
       
   160      * Sets suite model.
       
   161      *
       
   162      * @since S60 v5.0
       
   163      * @param aModel Suite model.
       
   164      */
       
   165     void SetSuiteModelL( CHnSuiteModel* aModel );
       
   166 
       
   167     /**
       
   168      * Set highlight visibility.
       
   169      *
       
   170      * @since S60 v5.0
       
   171      * @param aVisible Visibility status.
       
   172      */
       
   173     void SetHighlightVisibilityL( TBool aVisible );
       
   174 
       
   175     /**
       
   176      * Retrieve type of widget.
       
   177      *
       
   178      * @since S60 v3.0
       
   179      * @return Type of widget.
       
   180      */
       
   181     THnSuiteWidgetType WidgetType();
       
   182 
       
   183     /**
       
   184       * Draws the widget view.
       
   185       *
       
   186       * @since S60 v5.0
       
   187       */
       
   188     virtual void DrawView();
       
   189 
       
   190     /**
       
   191      * Set the vertical item offset;
       
   192      * @param aOffset The offset to set to the widget.
       
   193      *
       
   194      * @since S60 v5.0
       
   195      */
       
   196     virtual void SetVerticalItemOffset( TInt aOffset );
       
   197 
       
   198     /**
       
   199      * Gets the current widget vertical item offset.
       
   200      *
       
   201      * @since S60 v5.0
       
   202      * @return The current widget vertical item offset.
       
   203      */
       
   204     virtual TInt VerticalItemOffset() const;
       
   205 
       
   206     /**
       
   207      * Tells if item is visible (fully or partially).
       
   208      * Overridden from the base class CMmWidgetContainer in order to
       
   209      * provide a reliable implementation for grid.
       
   210      *
       
   211      * @param aItemIndex Item index.
       
   212      * @return ETrue if visible, EFalse otherwise.
       
   213      */
       
   214     TBool ItemIsVisible( TInt aItemIndex ) const;
       
   215 
       
   216 private:
       
   217     /**
       
   218      * Default constructor.
       
   219      *
       
   220      * @since S60 v5.0
       
   221      */
       
   222     CMmGridContainer();
       
   223 
       
   224     /**
       
   225      * 2nd phase constructor.
       
   226      *
       
   227      * @since S60 v5.0
       
   228      * @param aRect Rectangle of widget control.
       
   229      * @param aObjectProvider Object provider.
       
   230      * @param aTemplateLibrary template library for Drawer
       
   231      */
       
   232     void ConstructL( const TRect& aRect, MObjectProvider* aObjectProvider,
       
   233         CMmTemplateLibrary* aTemplateLibrary );
       
   234 
       
   235     /**
       
   236      * Constructs listbox from resource, creates scrollbar and sets empty list background text.
       
   237      *
       
   238      * @since S60 v5.0
       
   239      * @param aTemplateLibrary template library for Drawer
       
   240      * @return Grid model.
       
   241      */
       
   242     CMmGrid* CreateGridL( CMmTemplateLibrary* aTemplateLibrary );
       
   243 
       
   244     /**
       
   245 	 * Gets column count in current view.
       
   246 	 * @returns Column count in current view.
       
   247 	 */
       
   248     TInt ColumnsInCurrentView();
       
   249 
       
   250     /**
       
   251      * Gets row count in current view.
       
   252      * @returns Row count in current view.
       
   253      */
       
   254     TInt RowsInCurrentView();
       
   255 
       
   256     /**
       
   257 	 * Updates current view's scrollbar thumbs.
       
   258 	 */
       
   259     void UpdateViewScrollBarThumbs();
       
   260 
       
   261     /**
       
   262      * Calculates offset for default highlight position based on
       
   263      * index of first visible item.
       
   264      *
       
   265      * @returns offset for default highlight
       
   266      */
       
   267     TInt DefaultHighlightOffset();
       
   268 
       
   269 private: // Data
       
   270 
       
   271     /**
       
   272      * Pointer to listbox control.
       
   273      * Own.
       
   274      */
       
   275     CMmGrid* iGrid;
       
   276 
       
   277     };
       
   278 
       
   279 #endif // C_MMGRIDCONTAINER_H