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 EnableExtResponseArea( ETrue, TRect(TPoint(10,10),TSize(10,10)) ); |
111 TMargins margins; |
|
112 UiLayout()->GetKeyExtResponseArea( margins ); |
|
113 TPoint topLeftMargin( margins.iLeft, margins.iTop ); |
|
114 TSize bottomRightMargin( margins.iRight, margins.iBottom ); |
|
115 EnableExtResponseArea( ETrue, TRect( topLeftMargin,bottomRightMargin ) ); |
112 } |
116 } |
113 } |
117 } |
114 |
118 |
115 // --------------------------------------------------------------------------- |
119 // --------------------------------------------------------------------------- |
116 // CVirtualKeyCtrl::DrawKeyText |
120 // CVirtualKeyCtrl::DrawKeyText |
153 textLayout.TextRect() ); |
157 textLayout.TextRect() ); |
154 } |
158 } |
155 else if(iKeyboard->StarIcon() && |
159 else if(iKeyboard->StarIcon() && |
156 iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)) == KKeyStarCharacter ) |
160 iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)) == KKeyStarCharacter ) |
157 { |
161 { |
158 //CFbsBitGc* gc = static_cast<CFbsBitGc*>(BitGc()); |
162 // Get the size of the icon |
|
163 TSize starIconSize = iKeyboard->StarIcon()->Bitmap()->SizeInPixels(); |
|
164 // Get the rect of draw icon area |
|
165 TRect drawIconRect = textLayout.TextRect(); |
|
166 // When the size of icon is different with the size of draw icon area, |
|
167 // because the icon is drew from the left top coordinate of the draw |
|
168 // icon area, so the icon will not be drew in the center. In this case, |
|
169 // we need to adjust the top left coordinate of draw icon rect to |
|
170 // make sure that the icon will be drew in the center of the key |
|
171 if ( starIconSize != drawIconRect.Size()) |
|
172 { |
|
173 // Adjust the top left coordinate of draw icon rect to make sure |
|
174 // that the icon will be drew in the center of the key |
|
175 drawIconRect.iTl.iX += |
|
176 ( drawIconRect.Width() - starIconSize.iWidth ) / 2; |
|
177 drawIconRect.iTl.iY += |
|
178 ( drawIconRect.Height() - starIconSize.iHeight ) / 2; |
|
179 } |
|
180 |
|
181 // Draw the icon |
159 AknPenInputDrawUtils::DrawColorIcon( iKeyboard->StarIcon(), |
182 AknPenInputDrawUtils::DrawColorIcon( iKeyboard->StarIcon(), |
160 *aGc, |
183 *aGc, |
161 textLayout.TextRect() ); |
184 drawIconRect ); |
162 } |
185 } |
163 else |
186 else |
164 { |
187 { |
165 textLayout.DrawText(*aGc, iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)), |
188 textLayout.DrawText(*aGc, iKeyInfo->KeyUnicodes(TVirtualKeyTextPos(i)), |
166 EFalse, color); |
189 EFalse, color); |