|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Symbian Foundation License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This file implements overlay controls |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CTESTOVERLAYCONTROL_H |
|
19 #define CTESTOVERLAYCONTROL_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32std.h> |
|
23 #include <e32base.h> |
|
24 #include <coecntrl.h> |
|
25 #include <eikenv.h> |
|
26 #include <AknIconUtils.h> |
|
27 #include <freestyleemailui.mbg> |
|
28 #include "FreestyleEmailUiUtilities.h" |
|
29 |
|
30 // forward declarations. |
|
31 class RWsSession; |
|
32 class TFsEmailUiUtility; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 class COverlayControl; |
|
36 |
|
37 /** |
|
38 * Observer for overlay control touch events |
|
39 */ |
|
40 class MOverlayControlObserver |
|
41 { |
|
42 public: |
|
43 virtual void HandleOverlayPointerEventL( COverlayControl* aControl, const TPointerEvent& aEvent ) = 0; |
|
44 }; |
|
45 |
|
46 /** |
|
47 * COverlayControl |
|
48 */ |
|
49 class COverlayControl : public CCoeControl |
|
50 { |
|
51 public: |
|
52 // Constructors and destructor |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 ~COverlayControl(); |
|
58 |
|
59 /** |
|
60 * Two-phased constructor. |
|
61 * @param aParent if not NULL, parent control |
|
62 * @param aObserver observer for touch events |
|
63 * @param aRect initial size and position |
|
64 * @param aBitmapId bitmap to be used |
|
65 * @param aMaskId mask to be used |
|
66 */ |
|
67 static COverlayControl* NewL( CCoeControl* aParent, MOverlayControlObserver* aObserver, |
|
68 const TRect& aRect, TInt aBitmapId, TInt aMaskId ); |
|
69 |
|
70 void Draw( const TRect& ) const; |
|
71 |
|
72 void SetRect( const TRect& aRect ); |
|
73 |
|
74 void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
75 |
|
76 void MakeVisible( TBool aVisible ); |
|
77 |
|
78 /** |
|
79 * Update visual state |
|
80 * @param aButtonDown ETrue if button is in down state |
|
81 */ |
|
82 void UpdateButtonState( TBool aButtonDown ); |
|
83 |
|
84 private: |
|
85 |
|
86 /** |
|
87 * Constructor for performing 1st stage construction |
|
88 * @param aObserver observer for touch events |
|
89 */ |
|
90 COverlayControl( MOverlayControlObserver* aObserver ); |
|
91 |
|
92 /** |
|
93 * EPOC default constructor for performing 2nd stage construction |
|
94 */ |
|
95 void ConstructL( CCoeControl* aParent, const TRect& aRect, TInt aBitmapId, TInt aMaskId ); |
|
96 |
|
97 /** |
|
98 * Make a copy of bitmap |
|
99 */ |
|
100 void CopyBitmapL( const CFbsBitmap& aSource, CFbsBitmap& aDest ); |
|
101 |
|
102 /** |
|
103 * Adjust alpha for the bitmap |
|
104 * @param aBitmap bitmap to adjust |
|
105 * @param aFactor factor to apply |
|
106 */ |
|
107 void AdjustAlpha( CFbsBitmap& aBitmap, TReal aFactor ); |
|
108 |
|
109 /** |
|
110 * Update used mask according to current button state |
|
111 */ |
|
112 void UpdateMask(); |
|
113 |
|
114 private: |
|
115 |
|
116 CFbsBitmap* iBitmap; |
|
117 CFbsBitmap* iMask; |
|
118 CFbsBitmap* iSolidMask; |
|
119 TBool iDownState; |
|
120 |
|
121 MOverlayControlObserver* iObserver; |
|
122 }; |
|
123 |
|
124 #endif // CTESTOVERLAYCONTROL_H |