30 const TSize KAdditionalArea( 25, 11 ); |
30 const TSize KAdditionalArea( 25, 11 ); |
31 const TInt32 KCaptureIconDelta( 7 ); |
31 const TInt32 KCaptureIconDelta( 7 ); |
32 const TUint32 KToolbarExtensionBgColor = 0x00000000; |
32 const TUint32 KToolbarExtensionBgColor = 0x00000000; |
33 const TInt KToolBarExtensionBgAlpha = 0x7F; |
33 const TInt KToolBarExtensionBgAlpha = 0x7F; |
34 const TInt KCaptureButtonOrdinalPriority( 1 ); |
34 const TInt KCaptureButtonOrdinalPriority( 1 ); |
35 |
35 const TSize KIconMargin( 7, 7 ); |
36 |
36 |
37 // ----------------------------------------------------------------------------- |
37 // ----------------------------------------------------------------------------- |
38 // CCamCaptureButtonContainer::CCamCaptureButtonContainer |
38 // CCamCaptureButtonContainer::CCamCaptureButtonContainer |
39 // ----------------------------------------------------------------------------- |
39 // ----------------------------------------------------------------------------- |
40 // |
40 // |
63 // Keep hidden until explicitly made visible |
63 // Keep hidden until explicitly made visible |
64 MakeVisible( EFalse ); |
64 MakeVisible( EFalse ); |
65 CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
65 CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() ); |
66 |
66 |
67 // Load capture icon |
67 // Load capture icon |
68 TInt bitmapId = EMbmCameraappQgn_indi_cam4_capture; |
68 TInt bitmapId = EMbmCameraappQgn_indi_cam4_capture_image; |
69 TInt maskId = EMbmCameraappQgn_indi_cam4_capture_mask; |
69 TInt maskId = EMbmCameraappQgn_indi_cam4_capture_image_mask; |
|
70 TInt bitmapPressedId = EMbmCameraappQgn_indi_cam4_capture_image_pressed; |
|
71 TInt maskPressedId = EMbmCameraappQgn_indi_cam4_capture_image_pressed_mask; |
|
72 |
70 if ( iCameraMode == ECamControllerVideo ) |
73 if ( iCameraMode == ECamControllerVideo ) |
71 { |
74 { |
72 bitmapId = EMbmCameraappQgn_indi_cam4_video; |
75 bitmapId = EMbmCameraappQgn_indi_cam4_capture_video; |
73 maskId = EMbmCameraappQgn_indi_cam4_video_mask; |
76 maskId = EMbmCameraappQgn_indi_cam4_capture_video_mask; |
74 } |
77 bitmapPressedId = EMbmCameraappQgn_indi_cam4_capture_video_pressed; |
|
78 maskPressedId = EMbmCameraappQgn_indi_cam4_capture_video_pressed_mask; |
|
79 } |
|
80 |
|
81 iCaptureRect = aRect; |
|
82 iCaptureRect.Move(-iCaptureRect.iTl.iX, -iCaptureRect.iTl.iY ); |
|
83 iCaptureRect.Shrink( KIconMargin ); |
|
84 |
75 AknIconUtils::CreateIconL( |
85 AknIconUtils::CreateIconL( |
76 iCaptureIcon, |
86 iCaptureIcon, |
77 iCaptureMask, |
87 iCaptureIconMask, |
78 KCamBitmapFile(), |
88 KCamBitmapFile(), |
79 bitmapId, |
89 bitmapId, |
80 maskId ); |
90 maskId ); |
81 AknIconUtils::SetSize( iCaptureIcon, KIconSize, EAspectRatioPreserved ); |
91 AknIconUtils::SetSize( iCaptureIcon, iCaptureRect.Size() ); |
|
92 AknIconUtils::SetSize( iCaptureIconMask, iCaptureRect.Size() ); |
82 |
93 |
83 iCaptureRect = aRect; |
94 AknIconUtils::CreateIconL( |
|
95 iCaptureIconPressed, |
|
96 iCaptureIconPressedMask, |
|
97 KCamBitmapFile(), |
|
98 bitmapPressedId, |
|
99 maskPressedId ); |
|
100 AknIconUtils::SetSize( iCaptureIconPressed, iCaptureRect.Size() ); |
|
101 AknIconUtils::SetSize( iCaptureIconPressedMask, iCaptureRect.Size() ); |
|
102 |
84 iFeedback = MTouchFeedback::Instance(); |
103 iFeedback = MTouchFeedback::Instance(); |
85 PRINT( _L("Camera <= CCamCaptureButtonContainer::ConstructL") ); |
104 PRINT( _L("Camera <= CCamCaptureButtonContainer::ConstructL") ); |
86 } |
105 } |
87 |
106 |
88 // ----------------------------------------------------------------------------- |
107 // ----------------------------------------------------------------------------- |
90 // ----------------------------------------------------------------------------- |
109 // ----------------------------------------------------------------------------- |
91 // |
110 // |
92 CCamCaptureButtonContainer::~CCamCaptureButtonContainer() |
111 CCamCaptureButtonContainer::~CCamCaptureButtonContainer() |
93 { |
112 { |
94 delete iCaptureIcon; |
113 delete iCaptureIcon; |
95 delete iCaptureMask; |
114 delete iCaptureIconMask; |
|
115 delete iCaptureIconPressed; |
|
116 delete iCaptureIconPressedMask; |
96 } |
117 } |
97 |
118 |
98 // ----------------------------------------------------------------------------- |
119 // ----------------------------------------------------------------------------- |
99 // CCamCaptureButtonContainer::NewLC |
120 // CCamCaptureButtonContainer::NewLC |
100 // ----------------------------------------------------------------------------- |
121 // ----------------------------------------------------------------------------- |
264 // ------------------------------------------------------------- |
285 // ------------------------------------------------------------- |
265 // |
286 // |
266 void CCamCaptureButtonContainer::DrawCaptureButton( CBitmapContext& aGc ) const |
287 void CCamCaptureButtonContainer::DrawCaptureButton( CBitmapContext& aGc ) const |
267 { |
288 { |
268 PRINT( _L("Camera => CCamCaptureButtonContainer::DrawCaptureButton") ); |
289 PRINT( _L("Camera => CCamCaptureButtonContainer::DrawCaptureButton") ); |
269 |
|
270 TRect boundingRect( iCaptureRect ); |
290 TRect boundingRect( iCaptureRect ); |
271 boundingRect.Move( -iCaptureRect.iTl.iX, -iCaptureRect.iTl.iY ); |
291 boundingRect.Move( -boundingRect.iTl.iX, -boundingRect.iTl.iY ); |
272 boundingRect.Shrink( KAdditionalArea ); |
292 |
273 |
|
274 TPoint iconTl( boundingRect.iTl.iX + KCaptureIconDelta, |
|
275 boundingRect.iTl.iY + KCaptureIconDelta ); |
|
276 |
|
277 aGc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); |
|
278 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
279 aGc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
280 if ( iCaptureButtonPressed ) |
293 if ( iCaptureButtonPressed ) |
281 { |
294 { |
282 aGc.SetBrushColor( KRgbBlack ); |
295 aGc.BitBltMasked( iCaptureRect.iTl, iCaptureIconPressed, boundingRect, iCaptureIconPressedMask, EFalse ); |
283 } |
296 } |
284 else |
297 else |
285 { |
298 { |
286 aGc.SetBrushColor( TRgb( KToolbarExtensionBgColor, KToolBarExtensionBgAlpha ) ); |
299 aGc.BitBltMasked( iCaptureRect.iTl, iCaptureIcon, boundingRect, iCaptureIconMask, EFalse ); |
287 } |
300 |
288 aGc.DrawEllipse( boundingRect ); |
301 } |
289 |
|
290 TRect iconRect( KIconSize ); |
|
291 aGc.SetPenStyle( CGraphicsContext::ESolidPen ); |
|
292 aGc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
293 aGc.BitBltMasked( iconTl, iCaptureIcon, iconRect, iCaptureMask, EFalse ); |
|
294 |
302 |
295 PRINT( _L("Camera <= CCamCaptureButtonContainer::DrawCaptureButton") ); |
303 PRINT( _L("Camera <= CCamCaptureButtonContainer::DrawCaptureButton") ); |
296 } |
304 } |
297 |
305 |