uifw/AvKon/src/AknCharMap.cpp
changeset 14 3320e4e6e8bb
parent 0 2f259fa3e83a
child 26 62ef28f7b435
equal deleted inserted replaced
0:2f259fa3e83a 14:3320e4e6e8bb
    66 #include <eikedwin.h>
    66 #include <eikedwin.h>
    67 #include <gulbordr.h>
    67 #include <gulbordr.h>
    68 #include <touchfeedback.h>
    68 #include <touchfeedback.h>
    69 #include <eiklabel.h>
    69 #include <eiklabel.h>
    70 #include <aknphysics.h>
    70 #include <aknphysics.h>
    71 #include <AknPriv.hrh>
       
    72 
    71 
    73 #include "PictograhGrouping.h"
    72 #include "PictograhGrouping.h"
    74 #include "AknSettingCache.h"
    73 #include "AknSettingCache.h"
    75 #include "aknsctfocushandler.h"
    74 #include "aknsctfocushandler.h"
    76 
    75 
  2942     delete iPictographsBuffer2;
  2941     delete iPictographsBuffer2;
  2943     
  2942     
  2944     delete iSBFrame;
  2943     delete iSBFrame;
  2945     delete iPictoInterface;
  2944     delete iPictoInterface;
  2946 
  2945 
       
  2946     delete iOffscreenBg;
       
  2947     delete iBitmapDevice;
       
  2948     delete iBitmapGc;
  2947 
  2949 
  2948     delete iTitleDefault;
  2950     delete iTitleDefault;
  2949     delete iTitleFull;
  2951     delete iTitleFull;
  2950     delete iTitleHalf;
  2952     delete iTitleHalf;
  2951     delete iTitlePicto;
  2953     delete iTitlePicto;
  3988 
  3990 
  3989 void CAknCharMap::DoHandleResourceChangeL(TInt aType)
  3991 void CAknCharMap::DoHandleResourceChangeL(TInt aType)
  3990     {
  3992     {
  3991     if (aType == KEikDynamicLayoutVariantSwitch)
  3993     if (aType == KEikDynamicLayoutVariantSwitch)
  3992         {
  3994         {
  3993         TInt cursorIndexBeforeSwitch = (iFirstVisibleRow + iCursorPos.iY) * iMaxColumns + iCursorPos.iX;
  3995         TInt pos = (iFirstVisibleRow + iCursorPos.iY) * iMaxColumns + iCursorPos.iX;
  3994         TInt recentLengthBeforeSwitch = iMaxColumns;
  3996 
  3995         TBool recentWasSetBeforeSwitch = iSetRecentSct;
  3997         // Cursor position before layout switch.
       
  3998         TInt previousCursorPosition;
       
  3999         TInt previousLength = iMaxColumns;
       
  4000         if (pos < previousLength)
       
  4001             {
       
  4002             previousCursorPosition = pos; // recent char
       
  4003             }
       
  4004         else
       
  4005             {
       
  4006             previousCursorPosition = pos - previousLength; // grid.
       
  4007             }
  3996 
  4008 
  3997         // Disabled because the buffer content may change due to diffent layout.
  4009         // Disabled because the buffer content may change due to diffent layout.
  3998         if (recentWasSetBeforeSwitch) DisableRecentCharsRow();
  4010         TBool recentWasSet = iSetRecentSct;
       
  4011         if (recentWasSet) DisableRecentCharsRow();
  3999 
  4012 
  4000         // Calculate the new magnitudes (iMaxColumns, etc.).
  4013         // Calculate the new magnitudes (iMaxColumns, etc.).
  4001         DoLayout();
  4014         DoLayout();
  4002 
  4015 
  4003         // Append right amount of recent characters due to different layout.
  4016         // Append right amount of recent characters due to different layout.
  4004         if (recentWasSetBeforeSwitch) AppendRecentCharL();
  4017         if (recentWasSet) AppendRecentCharL();
  4005 
  4018 
  4006         // Sets the character case because the buffer content may have changed.
  4019         // Sets the character case because the buffer content may have changed.
  4007         SetCharacterCaseL(iSpecialCharCase);
  4020         SetCharacterCaseL(iSpecialCharCase);
  4008 
  4021 
  4009         // status after layout switch.
  4022         // Calculates the index position of the cursor in the char table and
  4010         TInt recentLengthAfterSwitch = iMaxColumns; // recentLength has changed after switch
  4023         // update the x and y positions for the new grid with it
  4011         TInt cursorIndexAfterSwitch;
  4024         TInt currentCursorPosition = previousCursorPosition;
  4012         if(cursorIndexBeforeSwitch < recentLengthBeforeSwitch)
  4025         TInt currentLength = iMaxColumns; // iMaxColumns may have changed.
  4013             {
  4026         if (pos < previousLength) // recent char
  4014             cursorIndexAfterSwitch = cursorIndexBeforeSwitch;
  4027             {
  4015             }
  4028             if (pos >= currentLength) // cannot be shown.
  4016         else
  4029                 {
  4017             {
  4030                 currentCursorPosition = 0;
  4018             cursorIndexAfterSwitch = cursorIndexBeforeSwitch - recentLengthBeforeSwitch + recentLengthAfterSwitch;
  4031                 }
       
  4032             }
       
  4033         else // grid cell
       
  4034             {
       
  4035             currentCursorPosition += currentLength;
  4019             }
  4036             }
  4020 
  4037 
  4021         // the new first row is the top row on the page where the new focus is.
  4038         // the new first row is the top row on the page where the new focus is.
  4022         TInt pageVolume = iMaxColumns * iExtension->iMaxVisibleRows;
  4039         iFirstVisibleRow = iExtension->iMaxVisibleRows *
  4023         iFirstVisibleRow = (cursorIndexAfterSwitch / pageVolume * pageVolume) / iMaxColumns;
  4040             (currentCursorPosition / (iMaxColumns * iExtension->iMaxVisibleRows));
  4024 
  4041 
  4025         // the cursor positions are relative to current page
  4042         // the cursor positions are relative to current page
  4026         TInt cursorIndexAfterSwitchInPage = cursorIndexAfterSwitch - (iMaxColumns * iFirstVisibleRow);
  4043         iCursorPos.iY = (currentCursorPosition -
  4027         iCursorPos.iX = cursorIndexAfterSwitchInPage % iMaxColumns;
  4044             (iMaxColumns * iFirstVisibleRow)) / iMaxColumns;
  4028         iCursorPos.iY = cursorIndexAfterSwitchInPage / iMaxColumns;
  4045 
  4029         
  4046         iCursorPos.iX = currentCursorPosition -
  4030         iOldCursorPos = iCursorPos;
  4047             (iMaxColumns * iFirstVisibleRow) - (iMaxColumns * iCursorPos.iY);
       
  4048 
       
  4049         iOldCursorPos.iY = (previousCursorPosition -
       
  4050             (iMaxColumns * iFirstVisibleRow)) / iMaxColumns;
       
  4051 
       
  4052         iOldCursorPos.iX = previousCursorPosition -
       
  4053             (iMaxColumns * iFirstVisibleRow) - (iMaxColumns * iOldCursorPos.iY);
  4031 
  4054 
  4032         // for full screen touch UI.
  4055         // for full screen touch UI.
  4033         CEikDialog* dlg;
  4056         CEikDialog* dlg;
  4034         MopGetObject(dlg);
  4057         MopGetObject(dlg);
  4035         CEikDialogExtension* dlgExtension = dlg ? dlg->Extension() : NULL;
  4058         CEikDialogExtension* dlgExtension = dlg ? dlg->Extension() : NULL;
  4104         // !resize an option but the cost only differs with the creation of the graphic objects!
  4127         // !resize an option but the cost only differs with the creation of the graphic objects!
  4105         CreateOffscreenBackgroundL();
  4128         CreateOffscreenBackgroundL();
  4106         iOffscreenBgDrawn = EFalse;
  4129         iOffscreenBgDrawn = EFalse;
  4107         }
  4130         }
  4108 
  4131 
  4109     else if ( aType == KAknsMessageSkinChange )
  4132 
       
  4133     if( aType == KAknsMessageSkinChange )
  4110         {
  4134         {
  4111         iOffscreenBgDrawn = EFalse;
  4135         iOffscreenBgDrawn = EFalse;
  4112         }
       
  4113     else if ( aType == KAknMessageFocusLost && iExtension->iHighlightVisible )
       
  4114         {
       
  4115         iExtension->iHighlightVisible = EFalse;
       
  4116         DrawCursor();
       
  4117         }
  4136         }
  4118     }
  4137     }
  4119 
  4138 
  4120 void CAknCharMap::EnableNavigationButtonsL()
  4139 void CAknCharMap::EnableNavigationButtonsL()
  4121     {
  4140     {
  4351         {
  4370         {
  4352         // 1) Draw the background
  4371         // 1) Draw the background
  4353 
  4372 
  4354         // Check if we got an offscreen bitmap allocated for skin background and
  4373         // Check if we got an offscreen bitmap allocated for skin background and
  4355         // there is bitmap background in the current skin.
  4374         // there is bitmap background in the current skin.
  4356 		if( CAknEnv::Static()->TransparencyEnabled() )
  4375         if ( iOffscreenBg )
  4357 			{
  4376             {
  4358 			TRegionFix<10> clipReg;
  4377             DrawOffscreenBackgroundIfRequired();
  4359 			clipReg.AddRect(rect);
  4378             gc.BitBlt( rect.iTl, iOffscreenBg );
  4360 			if ( iFirstVisibleRow == 0 && iSetRecentSct )
  4379             }
  4361 				{
  4380         else
  4362 				TPoint pos = iGridTopLeft;
  4381             {
  4363 				TInt endX = pos.iX + iGridItemWidth * iMaxColumns + 1;
  4382             if( CAknEnv::Static()->TransparencyEnabled() )
  4364 				TInt endY = pos.iY + iGridItemHeight;
  4383                 {
  4365 				// eliminate the overlap area between menu sct and the first menu item.
  4384                 TRegionFix<10> clipReg;
  4366 				if ( Extension()->iMenuSct )
  4385                 clipReg.AddRect(rect);
  4367 					{
  4386                 if ( iFirstVisibleRow == 0 && iSetRecentSct )
  4368 					endY--;
  4387                     {
  4369 					}
  4388                     TPoint pos = iGridTopLeft;
  4370 				clipReg.SubRect( TRect( pos, TPoint( endX, endY ) ) );
  4389                     TInt endX = pos.iX + iGridItemWidth * iMaxColumns + 1;
  4371 				}
  4390                     TInt endY = pos.iY + iGridItemHeight;
  4372 			// Take scroll bar out of clip region
  4391                     // eliminate the overlap area between menu sct and the first menu item.
  4373 			if (iSBFrame)
  4392                     if ( Extension()->iMenuSct )
  4374 				{
  4393                         {
  4375 				clipReg.SubRect(iSBFrame->GetScrollBarHandle(
  4394                         endY--;
  4376 					CEikScrollBar::EVertical)->Rect());
  4395                         }
  4377 				}
  4396                     clipReg.SubRect( TRect( pos, TPoint( endX, endY ) ) );
  4378 			gc.SetClippingRegion(clipReg);
  4397                     }
  4379 			}
  4398                 // Take scroll bar out of clip region
  4380 		AknsDrawUtils::Background( skin, cc, this, gc, rect,KAknsDrawParamNoClearUnderImage);
  4399                 if (iSBFrame)
  4381 		if( CAknEnv::Static()->TransparencyEnabled() )
  4400                     {
  4382 			{
  4401                     clipReg.SubRect(iSBFrame->GetScrollBarHandle(
  4383 			gc.CancelClippingRegion();
  4402                         CEikScrollBar::EVertical)->Rect());
  4384 			}
  4403                     }
       
  4404                 gc.SetClippingRegion(clipReg);
       
  4405                 }
       
  4406             AknsDrawUtils::Background( skin, cc, this, gc, rect,KAknsDrawParamNoClearUnderImage);
       
  4407             if( CAknEnv::Static()->TransparencyEnabled() )
       
  4408                 {
       
  4409                 gc.CancelClippingRegion();
       
  4410                 }
       
  4411             }
  4385 
  4412 
  4386         gc.SetPenStyle(CGraphicsContext::ESolidPen);
  4413         gc.SetPenStyle(CGraphicsContext::ESolidPen);
  4387         gc.SetBrushStyle(CGraphicsContext::ENullBrush);
  4414         gc.SetBrushStyle(CGraphicsContext::ENullBrush);
  4388         gc.SetPenSize(TSize(1,1));
  4415         gc.SetPenSize(TSize(1,1));
  4389 
  4416 
  4761         {
  4788         {
  4762         CAknCharMap* mutableThis = MUTABLE_CAST( CAknCharMap* ,this );
  4789         CAknCharMap* mutableThis = MUTABLE_CAST( CAknCharMap* ,this );
  4763         TInt recentChars = mutableThis->LengthOfRecentChar();
  4790         TInt recentChars = mutableThis->LengthOfRecentChar();
  4764         TRect rect;
  4791         TRect rect;
  4765         spec->AddFeedback( ETouchEventStylusDown, 
  4792         spec->AddFeedback( ETouchEventStylusDown, 
  4766                            ETouchFeedbackList );
  4793                            ETouchFeedbackBasicItem );
  4767         rect.SetRect( pos, TPoint( pos.iX + recentChars * iGridItemWidth, pos.iY + iGridItemHeight ));
  4794         rect.SetRect( pos, TPoint( pos.iX + recentChars * iGridItemWidth, pos.iY + iGridItemHeight ));
  4768         if ( iIsMirrored )
  4795         if ( iIsMirrored )
  4769             {
  4796             {
  4770             TInt emptyRecentSlots = iMaxColumns - recentChars;
  4797             TInt emptyRecentSlots = iMaxColumns - recentChars;
  4771             rect.Move( emptyRecentSlots * iGridItemWidth, 0 );
  4798             rect.Move( emptyRecentSlots * iGridItemWidth, 0 );
  4865             {
  4892             {
  4866             rectMain.Move( ( 1 - iMaxColumns ) * iGridItemWidth, 0 );
  4893             rectMain.Move( ( 1 - iMaxColumns ) * iGridItemWidth, 0 );
  4867             }
  4894             }
  4868 
  4895 
  4869         spec->AddFeedback( ETouchEventStylusDown, 
  4896         spec->AddFeedback( ETouchEventStylusDown, 
  4870                            ETouchFeedbackList );
  4897                            ETouchFeedbackBasicItem );
  4871         if ( rows )
  4898         if ( rows )
  4872             {
  4899             {
  4873             feedback->SetFeedbackArea( this, KAreaIdMain, rectMain, spec );
  4900             feedback->SetFeedbackArea( this, KAreaIdMain, rectMain, spec );
  4874             }
  4901             }
  4875         else
  4902         else
  5713     return result;
  5740     return result;
  5714     }
  5741     }
  5715 
  5742 
  5716 void CAknCharMap::CreateOffscreenBackgroundL()
  5743 void CAknCharMap::CreateOffscreenBackgroundL()
  5717     {
  5744     {
  5718 	
  5745     // Offscreen background bitmap for pictograph table - needed for performance.
       
  5746     // It is created always even if the current skin does not contain bitmap
       
  5747     // background, because skin change is done in a non-leaving function
       
  5748     // HandleResourceChange so memory allocations should not be done there.
       
  5749 
       
  5750     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
  5751     MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
       
  5752 
       
  5753     iOffscreenBgDrawn = EFalse;
       
  5754 
       
  5755     TRect popupGridRect;
       
  5756     if (!AknLayoutUtils::PenEnabled() || Extension()->iMenuSct)
       
  5757         {
       
  5758         TRect mainPaneRect;
       
  5759         if(!AknLayoutUtils::LayoutMetricsRect(
       
  5760             AknLayoutUtils::EPopupParent, mainPaneRect))
       
  5761             {
       
  5762             mainPaneRect = iAvkonAppUi->ClientRect();
       
  5763             }
       
  5764         TAknLayoutScalableParameterLimits charMapDialogVariety =
       
  5765             AknLayoutScalable_Avkon::popup_grid_graphic_window_ParamLimits();
       
  5766 
       
  5767         TInt maxVariety = charMapDialogVariety.LastVariety();
       
  5768 
       
  5769         AknLayoutUtils::TAknCbaLocation location = AknLayoutUtils::CbaLocation();
       
  5770         TInt maxVarietyOffset = 0;
       
  5771         TInt varietyOffset = maxVariety + 1;
       
  5772         if(Layout_Meta_Data::IsLandscapeOrientation())
       
  5773             {
       
  5774             varietyOffset = (maxVariety + 1) / KAknSctCBaButtonDirections;
       
  5775             }
       
  5776 
       
  5777         if(location == AknLayoutUtils::EAknCbaLocationRight)
       
  5778             {
       
  5779             maxVarietyOffset = varietyOffset;
       
  5780             }
       
  5781         else if(location == AknLayoutUtils::EAknCbaLocationLeft)
       
  5782             {
       
  5783             maxVarietyOffset = varietyOffset + varietyOffset;
       
  5784             }
       
  5785         TInt varietyNumber = varietyOffset - iRows;
       
  5786 
       
  5787         if(varietyNumber < 0)
       
  5788             {
       
  5789             varietyNumber = 0;
       
  5790             }
       
  5791         else if(iRows<=0)
       
  5792             {
       
  5793             varietyNumber -= 1;
       
  5794             }
       
  5795 
       
  5796         varietyNumber += maxVarietyOffset;
       
  5797 
       
  5798         TAknLayoutRect popupGridLayRect;
       
  5799         popupGridLayRect.LayoutRect(mainPaneRect,
       
  5800             AknLayoutScalable_Avkon::popup_grid_graphic_window(varietyNumber));
       
  5801 
       
  5802         popupGridRect = popupGridLayRect.Rect();
       
  5803         }
       
  5804     else
       
  5805         {
       
  5806         TAknLayoutRect popupGridLayRect;
       
  5807         popupGridLayRect.LayoutRect(iAvkonAppUi->ApplicationRect(),
       
  5808             AknLayoutScalable_Avkon::popup_grid_graphic2_window(0));
       
  5809 
       
  5810         popupGridRect = popupGridLayRect.Rect();
       
  5811         }
       
  5812 
       
  5813 
       
  5814     if(iOffscreenBg)
       
  5815         {
       
  5816         delete iOffscreenBg;
       
  5817         iOffscreenBg = NULL;
       
  5818         }
       
  5819 
       
  5820     iOffscreenBg = new( ELeave ) CFbsBitmap;
       
  5821     TDisplayMode mode = iCoeEnv->ScreenDevice()->DisplayMode();
       
  5822 
       
  5823     // This is larger rect that is actually needed for the charmap
       
  5824     // control - the problem is that we do not know the changed rect
       
  5825     // of the charmap control yet (because the dialog is just about
       
  5826     // to resize itself).
       
  5827 
       
  5828     if(iBitmapDevice)
       
  5829         {
       
  5830         delete iBitmapDevice;
       
  5831         iBitmapDevice = NULL;
       
  5832         }
       
  5833 
       
  5834     if(iBitmapGc)
       
  5835         {
       
  5836         delete iBitmapGc;
       
  5837         iBitmapGc = NULL;
       
  5838         }
       
  5839 
       
  5840     User::LeaveIfError(
       
  5841         iOffscreenBg->Create( popupGridRect.Size(), mode ) );
       
  5842     iBitmapDevice = CFbsBitmapDevice::NewL( iOffscreenBg );
       
  5843     User::LeaveIfError( iBitmapDevice->CreateContext( iBitmapGc ) );
       
  5844 
  5719     }
  5845     }
  5720 
  5846 
  5721 TInt CAknCharMap::NextPageL()
  5847 TInt CAknCharMap::NextPageL()
  5722     {
  5848     {
  5723     HandleFocusStatusChanged(EFalse);
  5849     HandleFocusStatusChanged(EFalse);
  5861         }
  5987         }
  5862 
  5988 
  5863     // Draw the background of the item if requested
  5989     // Draw the background of the item if requested
  5864     else if ( aDrawBackground )
  5990     else if ( aDrawBackground )
  5865         {
  5991         {
  5866 		aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
  5992         if ( iOffscreenBg )
  5867 		aGc.SetBrushColor(AKN_LAF_COLOR(0));
  5993             {
  5868 
  5994             TRect offscreenRect = aSctPosition;
  5869 		TRect innerRect = aSctPosition;
  5995             if (IsRecentChar(aCharIndex))
  5870 		if (IsRecentChar(aCharIndex))
  5996                 {
  5871 			{
  5997                 TRgb colorRecentLine = AKN_LAF_COLOR(215);
  5872 			innerRect.Shrink(1,1);
  5998                 AknsUtils::GetCachedColor( skin, colorRecentLine,
  5873 			}
  5999                         KAknsIIDQsnLineColors, EAknsCIQsnLineColorsCG7 );
  5874 		aGc.Clear( innerRect );
  6000                 aGc.SetPenColor(colorRecentLine);
       
  6001                 // draw top line
       
  6002                 aGc.DrawLine( aSctPosition.iTl,
       
  6003                     TPoint( aSctPosition.iBr.iX, aSctPosition.iTl.iY ) );
       
  6004                 // draw under line
       
  6005                 aGc.DrawLine( TPoint( aSctPosition.iTl.iX, aSctPosition.iBr.iY - 1 ),
       
  6006                               TPoint( aSctPosition.iBr.iX, aSctPosition.iBr.iY - 1) );
       
  6007                 if (aCharIndex == 0)
       
  6008                     {
       
  6009                     // draw left line
       
  6010                     aGc.DrawLine( aSctPosition.iTl,
       
  6011                         TPoint( aSctPosition.iTl.iX, aSctPosition.iBr.iY ) );
       
  6012                     }
       
  6013                 if (aCharIndex == (iMaxColumns-1) )
       
  6014                     {
       
  6015                     // draw right line
       
  6016                     aGc.DrawLine( TPoint( aSctPosition.iBr.iX -1, aSctPosition.iTl.iY ),
       
  6017                                   TPoint( aSctPosition.iBr.iX -1, aSctPosition.iBr.iY ) );
       
  6018                     }
       
  6019                 }
       
  6020             TPoint topleft = offscreenRect.iTl;
       
  6021 
       
  6022             // Our offscreen bitmap's origo is in the control rect's top left.
       
  6023             offscreenRect.Move( -( Rect().iTl ) );
       
  6024             aGc.BitBlt( topleft, iOffscreenBg, offscreenRect );
       
  6025             }
       
  6026         else
       
  6027             {
       
  6028             aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
  6029             aGc.SetBrushColor(AKN_LAF_COLOR(0));
       
  6030 
       
  6031             TRect innerRect = aSctPosition;
       
  6032             if (IsRecentChar(aCharIndex))
       
  6033                 {
       
  6034                 innerRect.Shrink(1,1);
       
  6035                 }
       
  6036             aGc.Clear( innerRect );
       
  6037             }
  5875         }
  6038         }
  5876     if (iPictoInterface->Interface()->IsPictograph((*iChars)[aCharIndex]))
  6039     if (iPictoInterface->Interface()->IsPictograph((*iChars)[aCharIndex]))
  5877         {
  6040         {
  5878         if (iExtension->iPictographsBufferGrouping)
  6041         if (iExtension->iPictographsBufferGrouping)
  5879             {
  6042             {
  5889         }
  6052         }
  5890     }
  6053     }
  5891 
  6054 
  5892 void CAknCharMap::DrawOffscreenBackgroundIfRequired() const
  6055 void CAknCharMap::DrawOffscreenBackgroundIfRequired() const
  5893     {
  6056     {
  5894 	
  6057     if ( iOffscreenBg )
       
  6058         {
       
  6059         if ( !iOffscreenBgDrawn )
       
  6060             {
       
  6061 
       
  6062             MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
  6063             MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
       
  6064 
       
  6065             TRect popupGridRect;
       
  6066             if (!AknLayoutUtils::PenEnabled() || Extension()->iMenuSct)
       
  6067                 {
       
  6068                 TRect mainPaneRect;
       
  6069                 if(!AknLayoutUtils::LayoutMetricsRect(
       
  6070                     AknLayoutUtils::EPopupParent, mainPaneRect))
       
  6071                     {
       
  6072                     mainPaneRect = iAvkonAppUi->ClientRect();
       
  6073                     }
       
  6074                 TAknLayoutScalableParameterLimits charMapDialogVariety =
       
  6075                     AknLayoutScalable_Avkon::popup_grid_graphic_window_ParamLimits();
       
  6076 
       
  6077                 TInt maxVariety = charMapDialogVariety.LastVariety();
       
  6078 
       
  6079                 AknLayoutUtils::TAknCbaLocation location =
       
  6080                     AknLayoutUtils::CbaLocation();
       
  6081                 TInt maxVarietyOffset = 0;
       
  6082                 TInt varietyOffset = maxVariety + 1;
       
  6083                 if(Layout_Meta_Data::IsLandscapeOrientation())
       
  6084                     {
       
  6085                     varietyOffset = (maxVariety + 1)/KAknSctCBaButtonDirections;
       
  6086                     }
       
  6087 
       
  6088                 if(location == AknLayoutUtils::EAknCbaLocationRight)
       
  6089                     {
       
  6090                     maxVarietyOffset = varietyOffset;
       
  6091                     }
       
  6092                 else if(location == AknLayoutUtils::EAknCbaLocationLeft)
       
  6093                     {
       
  6094                     maxVarietyOffset = varietyOffset + varietyOffset;
       
  6095                     }
       
  6096                 TInt varietyNumber = varietyOffset - iRows;
       
  6097 
       
  6098                 if(varietyNumber < 0)
       
  6099                     {
       
  6100                     varietyNumber = 0;
       
  6101                     }
       
  6102                 else if(iRows<=0)
       
  6103                     {
       
  6104                     varietyNumber -= 1;
       
  6105                     }
       
  6106                 varietyNumber += maxVarietyOffset;
       
  6107 
       
  6108                 TAknLayoutRect popupGridLayRect;
       
  6109                 popupGridLayRect.LayoutRect(mainPaneRect,
       
  6110                     AknLayoutScalable_Avkon::popup_grid_graphic_window(varietyNumber));
       
  6111 
       
  6112                 popupGridRect = popupGridLayRect.Rect();
       
  6113 
       
  6114                 popupGridRect.iTl.iY = Rect().iTl.iY;
       
  6115                 popupGridRect.Move(-popupGridRect.iTl.iX,0);
       
  6116                 TPoint point = TPoint( 0, 0 );
       
  6117                 AknsDrawUtils::DrawBackground(
       
  6118                     skin,
       
  6119                     cc,
       
  6120                     this,
       
  6121                     *iBitmapGc,
       
  6122                     point,
       
  6123                     popupGridRect,
       
  6124                     KAknsDrawParamDefault );
       
  6125                 }
       
  6126             else
       
  6127                 {
       
  6128                 TAknLayoutRect popupGridLayRect;
       
  6129                 popupGridLayRect.LayoutRect(iAvkonAppUi->ApplicationRect(),
       
  6130                     AknLayoutScalable_Avkon::popup_grid_graphic2_window(
       
  6131                         0));
       
  6132 
       
  6133                 popupGridRect = popupGridLayRect.Rect();
       
  6134 
       
  6135                 popupGridRect.iTl.iY = Rect().iTl.iY;
       
  6136                 popupGridRect.Move(-popupGridRect.iTl.iX,0);
       
  6137                 TPoint point = TPoint( 0, 0 );
       
  6138                 AknsDrawUtils::DrawBackground(
       
  6139                     skin,
       
  6140                     cc,
       
  6141                     this,
       
  6142                     *iBitmapGc,
       
  6143                     point,
       
  6144                     popupGridRect,
       
  6145                     KAknsDrawParamDefault );
       
  6146                 }
       
  6147             iOffscreenBgDrawn = ETrue;
       
  6148             }
       
  6149         }
  5895     }
  6150     }
  5896 
  6151 
  5897 EXPORT_C CCoeControl* CAknCharMap::ComponentControl(TInt aIndex) const
  6152 EXPORT_C CCoeControl* CAknCharMap::ComponentControl(TInt aIndex) const
  5898     {
  6153     {
  5899     if (iSBFrame && iSBFrame->TypeOfVScrollBar() == CEikScrollBarFrame::EDoubleSpan)
  6154     if (iSBFrame && iSBFrame->TypeOfVScrollBar() == CEikScrollBarFrame::EDoubleSpan)
  6238 
  6493 
  6239         TAknLayoutRect rightCellLayRect;
  6494         TAknLayoutRect rightCellLayRect;
  6240         rightCellLayRect.LayoutRect(gridRect,
  6495         rightCellLayRect.LayoutRect(gridRect,
  6241             AknLayoutScalable_Avkon::cell_graphic_popup_pane_cp2(0,1,0));
  6496             AknLayoutScalable_Avkon::cell_graphic_popup_pane_cp2(0,1,0));
  6242 
  6497 
  6243         TInt firstVisibleIndex = iFirstVisibleRow * iMaxColumns;
       
  6244         // Max columns.
  6498         // Max columns.
  6245         iMaxColumns = gridRect.Width() / firstCellRect.Width();
  6499         iMaxColumns = gridRect.Width() / firstCellRect.Width();
  6246         iFirstVisibleRow = firstVisibleIndex / iMaxColumns;
       
  6247 
  6500 
  6248         // Max visible rows.
  6501         // Max visible rows.
  6249         iExtension->iMaxVisibleRows = gridRect.Height() / firstCellRect.Height();
  6502         iExtension->iMaxVisibleRows = gridRect.Height() / firstCellRect.Height();
  6250 
  6503 
  6251         // Cell width.
  6504         // Cell width.
  6304         TAknLayoutRect firstCellLayRect;
  6557         TAknLayoutRect firstCellLayRect;
  6305         firstCellLayRect.LayoutRect(popupGridRect,
  6558         firstCellLayRect.LayoutRect(popupGridRect,
  6306             AknLayoutScalable_Avkon::aid_size_cell_graphic2(gridVariety,0,0));
  6559             AknLayoutScalable_Avkon::aid_size_cell_graphic2(gridVariety,0,0));
  6307 
  6560 
  6308         TRect firstCellRect = firstCellLayRect.Rect();
  6561         TRect firstCellRect = firstCellLayRect.Rect();
  6309         TInt firstVisibleIndex = iFirstVisibleRow * iMaxColumns;
       
  6310 
  6562 
  6311         // Max columns.
  6563         // Max columns.
  6312         iMaxColumns = gridRect.Width() / firstCellRect.Width();
  6564         iMaxColumns = gridRect.Width() / firstCellRect.Width();
  6313         iFirstVisibleRow = firstVisibleIndex / iMaxColumns;
       
  6314 
  6565 
  6315         // Max visible rows.
  6566         // Max visible rows.
  6316         iExtension->iMaxVisibleRows = gridRect.Height() / firstCellRect.Height();
  6567         iExtension->iMaxVisibleRows = gridRect.Height() / firstCellRect.Height();
  6317 
  6568 
  6318         // Cell width.
  6569         // Cell width.
  6544                         // down event on an item, play feedback
  6795                         // down event on an item, play feedback
  6545                         MTouchFeedback* feedback = MTouchFeedback::Instance();
  6796                         MTouchFeedback* feedback = MTouchFeedback::Instance();
  6546                         if ( feedback &&
  6797                         if ( feedback &&
  6547                              aPointerEvent.iType == TPointerEvent::EButton1Down )
  6798                              aPointerEvent.iType == TPointerEvent::EButton1Down )
  6548                             {
  6799                             {
  6549                             feedback->InstantFeedback( this, ETouchFeedbackList );
  6800                             feedback->InstantFeedback( this, ETouchFeedbackBasicItem );
  6550                             }
  6801                             }
  6551                         if ( aPointerEvent.iType == TPointerEvent::EDrag &&
  6802                         if ( aPointerEvent.iType == TPointerEvent::EDrag &&
  6552                              iCursorPos != iOldCursorPos )
  6803                              iCursorPos != iOldCursorPos )
  6553                             {
  6804                             {
  6554                             // Disable selection.
  6805                             // Disable selection.
  6587                             // play feedback
  6838                             // play feedback
  6588                             MTouchFeedback* feedback = MTouchFeedback::Instance();
  6839                             MTouchFeedback* feedback = MTouchFeedback::Instance();
  6589                             if ( feedback )
  6840                             if ( feedback )
  6590                                 {
  6841                                 {
  6591                                 feedback->InstantFeedback( this, 
  6842                                 feedback->InstantFeedback( this, 
  6592                                                            ETouchFeedbackList,
  6843                                                            ETouchFeedbackBasicItem,
  6593                                                            ETouchFeedbackVibra,
  6844                                                            ETouchFeedbackVibra,
  6594                                                            TPointerEvent() );
  6845                                                            TPointerEvent() );
  6595                                 }
  6846                                 }
  6596 
  6847 
  6597                             iExtension->iObserver->HandleControlEventL(
  6848                             iExtension->iObserver->HandleControlEventL(