menufw/menufwui/mmwidgets/inc/mmgridcontainer.h
changeset 0 f72a12da539e
child 1 5315654608de
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     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.13 % << 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      * Called when filp state changed.
       
   185      * 
       
   186      * @since S60 v3.0
       
   187      */ 
       
   188     void FlipStateChangedL();
       
   189     
       
   190     /**
       
   191       * Draws the widget view.
       
   192       *
       
   193       * @since S60 v5.0
       
   194       */
       
   195     virtual void DrawView();
       
   196     
       
   197     /**
       
   198      * Set the vertical item offset;
       
   199      * @param aOffset The offset to set to the widget.
       
   200      * 
       
   201      * @since S60 v5.0
       
   202      */
       
   203     virtual void SetVerticalItemOffset( TInt aOffset );
       
   204 
       
   205     /**
       
   206      * Gets the current widget vertical item offset.
       
   207      * 
       
   208      * @since S60 v5.0
       
   209      * @return The current widget vertical item offset.
       
   210      */
       
   211     virtual TInt VerticalItemOffset() const;
       
   212     
       
   213     /**
       
   214      * Tells if item is visible (fully or partially).
       
   215      * Overridden from the base class CMmWidgetContainer in order to
       
   216      * provide a reliable implementation for grid.
       
   217      * 
       
   218      * @param aItemIndex Item index.
       
   219      * @return ETrue if visible, EFalse otherwise.
       
   220      */
       
   221     TBool ItemIsVisible( TInt aItemIndex ) const;
       
   222     
       
   223 private:
       
   224     /**
       
   225      * Default constructor.
       
   226      * 
       
   227      * @since S60 v5.0 
       
   228      */
       
   229     CMmGridContainer();
       
   230     
       
   231     /**
       
   232      * 2nd phase constructor.
       
   233      * 
       
   234      * @since S60 v5.0 
       
   235      * @param aRect Rectangle of widget control.
       
   236      * @param aObjectProvider Object provider.
       
   237      * @param aTemplateLibrary template library for Drawer
       
   238      */
       
   239     void ConstructL( const TRect& aRect, MObjectProvider* aObjectProvider,
       
   240         CMmTemplateLibrary* aTemplateLibrary );
       
   241 
       
   242     /**
       
   243      * Constructs listbox from resource, creates scrollbar and sets empty list background text.
       
   244      *
       
   245      * @since S60 v5.0
       
   246      * @param aTemplateLibrary template library for Drawer
       
   247      * @return Grid model.
       
   248      */
       
   249     CMmGrid* CreateGridL( CMmTemplateLibrary* aTemplateLibrary );
       
   250     
       
   251     /**
       
   252 	 * Gets column count in current view.
       
   253 	 * @returns Column count in current view.
       
   254 	 */
       
   255     TInt ColumnsInCurrentView();
       
   256     
       
   257     /**
       
   258      * Gets row count in current view.
       
   259      * @returns Row count in current view.
       
   260      */
       
   261     TInt RowsInCurrentView();
       
   262     
       
   263     /**
       
   264 	 * Updates current view's scrollbar thumbs.
       
   265 	 */
       
   266     void UpdateViewScrollBarThumbs();
       
   267     
       
   268     /**
       
   269      * Gets base default highlight in landscape mode.
       
   270      * 
       
   271      * @param aLayout current layout of the grid
       
   272      * @returns default highlight
       
   273      */
       
   274     TInt LandscapeOrientationDefaultHighlight( TSize aLayout );
       
   275 
       
   276     /**
       
   277      * Gets base default highlight in portrait mode.
       
   278      * 
       
   279      * @param aLayout current layout of the grid
       
   280      * @returns default highlight
       
   281      */
       
   282     TInt PortraitOrientationDefaultHighlight( TSize aLayout );
       
   283     
       
   284     /**
       
   285      * Calculates offset for default highlight position based on
       
   286      * index of first visible item.
       
   287      * 
       
   288      * @returns offset for default highlight
       
   289      */
       
   290     TInt DefaultHighlightOffset();
       
   291     
       
   292 private: // Data
       
   293 	
       
   294     /**
       
   295      * Pointer to listbox control.
       
   296      * Own.
       
   297      */
       
   298     CMmGrid* iGrid;
       
   299     
       
   300     };
       
   301 
       
   302 #endif // C_MMGRIDCONTAINER_H