104 void CVirtualKeyCtrl::ConstructL() |
104 void CVirtualKeyCtrl::ConstructL() |
105 { |
105 { |
106 BaseConstructL(); |
106 BaseConstructL(); |
107 |
107 |
108 //tap accuracy enhancement |
108 //tap accuracy enhancement |
109 if ( FeatureManager::FeatureSupported( KFeatureIdFfCapacitiveDisplay )) |
109 if( FeatureManager::FeatureSupported( KFeatureIdFfCapacitiveDisplay )) |
110 { |
110 { |
111 TMargins margins; |
111 TMargins margins; |
112 UiLayout()->GetKeyExtResponseArea( margins ); |
112 UiLayout()->GetKeyExtResponseArea( margins ); |
113 TPoint topLeftMargin( margins.iLeft, margins.iTop ); |
113 TPoint topLeftMargin( margins.iLeft, margins.iTop ); |
114 TSize bottomRightMargin( margins.iRight, margins.iBottom ); |
114 TSize bottomRightMargin( margins.iRight, margins.iBottom ); |
149 |
149 |
150 // replace the shift text to shift icon |
150 // replace the shift text to shift icon |
151 if( iKeyboard->ShiftIcon() && |
151 if( iKeyboard->ShiftIcon() && |
152 iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)) == KKeyShiftCharacter ) |
152 iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)) == KKeyShiftCharacter ) |
153 { |
153 { |
154 // Get the rect of the shift icon |
154 //CFbsBitGc* gc = GetGc();//static_cast<CFbsBitGc*>(BitGc()); |
155 TRect shiftIconDrawRect = iKeyboard->ShiftIconRect(); |
|
156 shiftIconDrawRect.Move( iKeyboard->Rect().iTl ); |
|
157 AknPenInputDrawUtils::DrawColorIcon( iKeyboard->ShiftIcon(), |
155 AknPenInputDrawUtils::DrawColorIcon( iKeyboard->ShiftIcon(), |
158 *aGc, |
156 *aGc, |
159 shiftIconDrawRect ); |
157 textLayout.TextRect() ); |
160 } |
158 } |
161 else if(iKeyboard->StarIcon() && |
159 else if(iKeyboard->StarIcon() && |
162 iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)) == KKeyStarCharacter ) |
160 iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)) == KKeyStarCharacter ) |
163 { |
161 { |
164 // Get the size of the icon |
162 // Get the size of the icon |
165 TSize starIconSize = iKeyboard->StarIcon()->Bitmap()->SizeInPixels(); |
163 TSize starIconSize = iKeyboard->StarIcon()->Bitmap()->SizeInPixels(); |
166 // Get the rect of draw icon area |
164 // Get the rect of draw icon area |
167 TRect drawIconRect = iKeyboard->StarIconRect(); |
165 TRect drawIconRect = textLayout.TextRect(); |
168 drawIconRect.Move( iKeyboard->Rect().iTl ); |
|
169 |
|
170 // When the size of icon is different with the size of draw icon area, |
166 // When the size of icon is different with the size of draw icon area, |
171 // because the icon is drew from the left top coordinate of the draw |
167 // because the icon is drew from the left top coordinate of the draw |
172 // icon area, so the icon will not be drew in the center. In this case, |
168 // icon area, so the icon will not be drew in the center. In this case, |
173 // we need to adjust the top left coordinate of draw icon rect to |
169 // we need to adjust the top left coordinate of draw icon rect to |
174 // make sure that the icon will be drew in the center of the key |
170 // make sure that the icon will be drew in the center of the key |