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