uifw/ganes/src/HgGrid.cpp
branchRCL_3
changeset 18 0aa5fbdfbc30
parent 16 71dd06cfe933
child 25 941195f2d488
equal deleted inserted replaced
16:71dd06cfe933 18:0aa5fbdfbc30
    89 // -----------------------------------------------------------------------------
    89 // -----------------------------------------------------------------------------
    90 //
    90 //
    91 CHgGrid::CHgGrid( 
    91 CHgGrid::CHgGrid( 
    92         TInt aItemCount, 
    92         TInt aItemCount, 
    93         CGulIcon* aDefaultIcon )
    93         CGulIcon* aDefaultIcon )
    94 : CHgScroller( aItemCount, aDefaultIcon )
    94 : CHgScroller( aItemCount, aDefaultIcon ),
       
    95   iToolbarVisible( ETrue )
    95     {
    96     {
    96     // No implementation required
    97     // No implementation required
    97     }
    98     }
    98 
    99 
    99 // -----------------------------------------------------------------------------
   100 // -----------------------------------------------------------------------------
   349 //
   350 //
   350 void CHgGrid::CalculateSizes()
   351 void CHgGrid::CalculateSizes()
   351     {
   352     {
   352     // Count number of visible rows
   353     // Count number of visible rows
   353     // First is checked if 3x4 or 4x3 items fits to the grid.
   354     // First is checked if 3x4 or 4x3 items fits to the grid.
   354     TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
   355 
   355 
   356     TInt mainVariety = iToolbarVisible ? 0 : 1;
   356     TAknLayoutScalableParameterLimits limits = cell_gallery2_pane_ParamLimits(variety);
   357     TInt gridVariety = iToolbarVisible ? 0 : 2;
       
   358     TInt cellVariety = iToolbarVisible ? 0 : 4;
       
   359 
       
   360     if( Layout_Meta_Data::IsLandscapeOrientation() )
       
   361         {
       
   362         ++gridVariety;
       
   363         ++cellVariety;
       
   364         }
       
   365     
       
   366     TAknLayoutScalableParameterLimits limits = cell_gallery2_pane_ParamLimits(cellVariety);
   357     iCols = limits.LastColumn() + 1;
   367     iCols = limits.LastColumn() + 1;
   358     iRows = limits.LastRow() + 1;
   368     iRows = limits.LastRow() + 1;
   359     
   369     
   360     iLayoutData->ChangeCols( iCols );
   370     iLayoutData->ChangeCols( iCols );
   361     
   371     
   362     iLayoutData->SetBaseLayout(main_gallery2_pane(0));
   372     iLayoutData->SetBaseLayout(main_gallery2_pane(mainVariety));
   363     iLayoutData->SetItemLayout(grid_gallery2_pane(variety));
   373     iLayoutData->SetItemLayout(grid_gallery2_pane(gridVariety));
   364     iLayoutData->SetIconLayout(cell_gallery2_pane_g2(variety));        
   374     iLayoutData->SetIconLayout(cell_gallery2_pane_g2(cellVariety));        
   365     
   375     
   366     if( iLandscapeScrolling )
   376     if( iLandscapeScrolling )
   367         {
   377         {
   368         for(TInt i = 0; i < iRows; ++i)
   378         for(TInt i = 0; i < iRows; ++i)
   369             {
   379             {
   370             iLayoutData->SetColumnLayout(i, cell_gallery2_pane(variety, 0, i));            
   380             iLayoutData->SetColumnLayout(i, cell_gallery2_pane(cellVariety, 0, i));            
   371             }
   381             }
   372         }
   382         }
   373     else
   383     else
   374         {
   384         {
   375         for(TInt i = 0; i < iCols; ++i)
   385         for(TInt i = 0; i < iCols; ++i)
   376             {
   386             {
   377             iLayoutData->SetColumnLayout(i, cell_gallery2_pane(variety, i, 0));            
   387             iLayoutData->SetColumnLayout(i, cell_gallery2_pane(cellVariety, i, 0));            
   378             }
   388             }
   379         }
   389         }
   380     iLayoutData->SetFirstIndicatorLayout(cell_gallery2_pane_g5(variety));
   390     iLayoutData->SetFirstIndicatorLayout(cell_gallery2_pane_g5(cellVariety));
   381     iLayoutData->SetSecondIndicatorLayout(cell_gallery2_pane_g4(variety));
   391     iLayoutData->SetSecondIndicatorLayout(cell_gallery2_pane_g4(cellVariety));
   382     
   392     
   383     TAknLayoutRect gridAppPane;
   393     TAknLayoutRect gridAppPane;
   384     TAknLayoutRect gridItem;
   394     TAknLayoutRect gridItem;
   385     TAknLayoutRect gridImage;
   395     TAknLayoutRect gridImage;
   386     
   396     
   806 void CHgGrid::HandleScrollbarVisibilityChange( TBool /*aVisible*/ )
   816 void CHgGrid::HandleScrollbarVisibilityChange( TBool /*aVisible*/ )
   807     {
   817     {
   808     
   818     
   809     }
   819     }
   810 
   820 
       
   821 // -----------------------------------------------------------------------------
       
   822 // CHgGrid::SetToolbarVisibility()
       
   823 // -----------------------------------------------------------------------------
       
   824 //
       
   825 EXPORT_C void CHgGrid::SetToolbarVisibility( TBool aToolbarVisible )
       
   826     {
       
   827     iToolbarVisible = aToolbarVisible;
       
   828     HandleSizeChanged();
       
   829     }
       
   830 
   811 // End of File
   831 // End of File