168 |
168 |
169 if ( mask && mask->DisplayMode() == EGray256 ) |
169 if ( mask && mask->DisplayMode() == EGray256 ) |
170 { |
170 { |
171 CGulIcon* newIcon = CGulIcon::NewLC(); |
171 CGulIcon* newIcon = CGulIcon::NewLC(); |
172 CFbsBitmap* newPic = new ( ELeave ) CFbsBitmap; |
172 CFbsBitmap* newPic = new ( ELeave ) CFbsBitmap; |
173 CleanupStack::PushL( newPic ); |
|
174 |
173 |
175 newPic->Duplicate( aIcon->Bitmap()->Handle() ); |
174 newPic->Duplicate( aIcon->Bitmap()->Handle() ); |
176 newIcon->SetBitmap( newPic ); |
175 //newPic ownership is transferred to newIcon |
|
176 newIcon->SetBitmap( newPic ); |
177 |
177 |
178 CFbsBitmap* newMask = new ( ELeave ) CFbsBitmap; |
178 CFbsBitmap* newMask = new ( ELeave ) CFbsBitmap; |
|
179 CleanupStack::PushL( newMask ); |
179 |
180 |
180 User::LeaveIfError( newMask->Create( |
181 User::LeaveIfError( newMask->Create( |
181 newIcon->Bitmap()->SizeInPixels(), EGray256 ) ); |
182 newIcon->Bitmap()->SizeInPixels(), EGray256 ) ); |
182 CleanupStack::PushL( newMask ); |
|
183 |
183 |
184 CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( newMask ); |
184 CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( newMask ); |
185 CleanupStack::PushL( bitmapDevice ); |
185 CleanupStack::PushL( bitmapDevice ); |
186 |
186 |
187 CFbsBitGc* bitGc( NULL ); |
187 CFbsBitGc* bitGc( NULL ); |
210 newMask->UnlockHeap(); |
210 newMask->UnlockHeap(); |
211 newIcon->SetMask( newMask ); |
211 newIcon->SetMask( newMask ); |
212 ReplaceIconStatic( aDimmedIcon, newIcon, aScaleMode ); |
212 ReplaceIconStatic( aDimmedIcon, newIcon, aScaleMode ); |
213 |
213 |
214 CleanupStack::PopAndDestroy( 2 ); // bitmapDevice, bitGc |
214 CleanupStack::PopAndDestroy( 2 ); // bitmapDevice, bitGc |
215 CleanupStack::Pop( 3 ); // newIcon, newPic, newMask |
215 CleanupStack::Pop( 2 ); // newIcon, newMask |
216 } |
216 } |
217 } |
217 } |
218 } |
218 } |
219 // ============================ EXTENSION CLASS ================================ |
219 // ============================ EXTENSION CLASS ================================ |
220 |
220 |
2305 CAknButtonState* state = State(); |
2305 CAknButtonState* state = State(); |
2306 if ( !state ) |
2306 if ( !state ) |
2307 { |
2307 { |
2308 return; |
2308 return; |
2309 } |
2309 } |
2310 |
2310 TBool hitArea( EFalse ); |
2311 if ( ( iFlags & KAknButtonHitTest ) && |
2311 TRAP_IGNORE( hitArea = HitAreaContainsL( aPointerEvent.iPosition, EFalse )) |
2312 !HitAreaContainsL( aPointerEvent.iPosition, EFalse ) ) |
2312 if ( ( iFlags & KAknButtonHitTest ) && !hitArea ) |
2313 { |
2313 { |
2314 buttonEvent = EFalse; |
2314 buttonEvent = EFalse; |
2315 } |
2315 } |
2316 |
2316 |
2317 TBool redrawNeeded(EFalse); |
2317 TBool redrawNeeded(EFalse); |