uifw/EikStd/coctlsrc/akntoolbarextensionview.cpp
changeset 14 3320e4e6e8bb
parent 0 2f259fa3e83a
equal deleted inserted replaced
0:2f259fa3e83a 14:3320e4e6e8bb
   262                     || aKeyEvent.iCode == EKeyDevice1 
   262                     || aKeyEvent.iCode == EKeyDevice1 
   263                     || aKeyEvent.iCode == EKeyDevice3 ) )
   263                     || aKeyEvent.iCode == EKeyDevice3 ) )
   264         {
   264         {
   265         if( IsVisible()&& ( aKeyEvent.iCode == EKeyDevice0 ||
   265         if( IsVisible()&& ( aKeyEvent.iCode == EKeyDevice0 ||
   266                             aKeyEvent.iCode == EKeyDevice1 ))
   266                             aKeyEvent.iCode == EKeyDevice1 ))
   267             {
   267         	{
   268             iExtension->SetShown(EFalse);
   268 			iExtension->SetShown(EFalse);
   269             return EKeyWasConsumed; 
   269 		    return EKeyWasConsumed;	
   270             }
   270         	}
   271         return EKeyWasNotConsumed;
   271         return EKeyWasNotConsumed;
   272         }
   272         }
   273     // When this is visible and without focus, nothing to do 
   273     // When this is visible and without focus, nothing to do 
   274     //
   274     //
   275     // Exception for key filter: Image capture key (not a complete solution:
   275     // Exception for key filter: Image capture key (not a complete solution:
   939    
   939    
   940     // Calculate and set controls positions according to layout rects
   940     // Calculate and set controls positions according to layout rects
   941     TInt extensionWidth = CalculateControlPositions( 
   941     TInt extensionWidth = CalculateControlPositions( 
   942         windowRect, gridExtRect, cellExtRect );
   942         windowRect, gridExtRect, cellExtRect );
   943     
   943     
   944     //In some cases, extension height is more larger than grid rect. 
       
   945     //And for they are only used to define the margin size, width is more exact than height.
       
   946     TSize viewSize( extensionWidth + ( extensionRect.Width() - gridExtRect.Width() ),
   944     TSize viewSize( extensionWidth + ( extensionRect.Width() - gridExtRect.Width() ),
   947         ( extensionRect.Width() - gridExtRect.Width() ) + iNumberOfRows * 
   945         ( extensionRect.Height() - gridExtRect.Height() ) + iNumberOfRows * 
   948         buttonSize.iHeight ); 
   946         buttonSize.iHeight ); 
   949     
   947     
       
   948     //reset the height in portrait mode
       
   949     if ( !landscape )
       
   950         {
       
   951         //In some cases, extension rect is more larger than grid rect. 
       
   952         //And for they are only used to define the margin size, width is more exact than height.
       
   953         viewSize = TSize( extensionWidth + ( extensionRect.Width() - gridExtRect.Width() ),
       
   954             ( extensionRect.Width() - gridExtRect.Width() ) + iNumberOfRows * 
       
   955             buttonSize.iHeight ); 
       
   956         }
       
   957 
   950     TInt variety = GetVariety( iNumberOfRows - 1, landscape );
   958     TInt variety = GetVariety( iNumberOfRows - 1, landscape );
   951 
   959 
   952      // To get the correct y-coordinate
   960      // To get the correct y-coordinate
   953     TRect positionRect = RectFromLayout( mainPaneRect, floating ? 
   961     TRect positionRect = RectFromLayout( mainPaneRect, floating ? 
   954          AknLayoutScalable_Avkon::popup_tb_float_extension_window( variety ) : 
   962          AknLayoutScalable_Avkon::popup_tb_float_extension_window( variety ) : 
   958         {
   966         {
   959 
   967 
   960         TRect extButtonRect( iExtension->Rect() );
   968         TRect extButtonRect( iExtension->Rect() );
   961 
   969 
   962         // Calculate new y coordinate according to button middle point
   970         // Calculate new y coordinate according to button middle point
   963         TInt newY = extButtonRect.iTl.iY + mainPaneRect.iTl.iY;             
   971         TInt newY = 
       
   972             ( extButtonRect.iTl.iY + ( extButtonRect.Height() / 2 ) )
       
   973              - viewSize.iHeight / 2 
       
   974              + mainPaneRect.iTl.iY;
       
   975              
   964         // Check that rect with new y fits to extension view area
   976         // Check that rect with new y fits to extension view area
   965         if( newY < extensionRect.iTl.iY ) // Top
   977         if( newY < extensionRect.iTl.iY ) // Top
   966             {
   978             {
   967             newY = extensionRect.iTl.iY;
   979             newY = extensionRect.iTl.iY;
   968             }
   980             }
  1592     if ( item && item->Control() && item->IsHidden() != aHide ) 
  1604     if ( item && item->Control() && item->IsHidden() != aHide ) 
  1593         {
  1605         {
  1594         item->SetHidden( aHide ); 
  1606         item->SetHidden( aHide ); 
  1595         }
  1607         }
  1596     }
  1608     }
  1597 
       
  1598 //end file