19 #ifndef C_CDIALERKEYPADBUTTON_H |
19 #ifndef C_CDIALERKEYPADBUTTON_H |
20 #define C_CDIALERKEYPADBUTTON_H |
20 #define C_CDIALERKEYPADBUTTON_H |
21 |
21 |
22 #include <e32base.h> |
22 #include <e32base.h> |
23 #include <aknbutton.h> |
23 #include <aknbutton.h> |
|
24 #include "dialercommon.h" |
|
25 |
|
26 const TMifDialer KDialerNoIcon = EMbmDialerLastElement; |
24 |
27 |
25 // CLASS DECLARATION |
28 // CLASS DECLARATION |
26 |
29 |
27 /** |
30 /** |
28 * Contains keypad button data. |
31 * Contains keypad button data. |
29 * |
32 * |
30 * @lib dialer.lib |
33 * @lib dialer.lib |
31 * @since S60 v5.0 |
34 * @since S60 v5.0 |
32 */ |
35 */ |
33 NONSHARABLE_CLASS( CDialerKeyPadButton ) : public CBase |
36 NONSHARABLE_CLASS( CDialerKeyPadButton ) : public CAknButton |
34 { |
37 { |
35 public: |
38 public: |
36 |
39 |
37 CDialerKeyPadButton(); |
40 /** |
38 |
41 * @param aNumberLabel The number (etc) of the key. |
|
42 * Reference must remain valid until reset with SetNumLabel |
|
43 * @parem aPrimaryAlphaLabel The first row of alphabets of the key. |
|
44 * Reference must remain valid until reset with SetPrimaryAlphaLabel |
|
45 * @param aSecondaryAlphaLabel The second row of alphabets of the key. |
|
46 * Reference must remain valid until reset with SetSecondaryAlphaLabel |
|
47 * @param aScanCode The button scanCode. |
|
48 * @param aKeyCode The button keyCode. |
|
49 * @param aButtonIconId The icon for the normal state. |
|
50 * @param aButtonIconMaskId The icon mask for the normal state. |
|
51 * @param aFlags CAknButton flags |
|
52 */ |
|
53 static CDialerKeyPadButton* NewLC( const TDesC& aNumberLabel, |
|
54 const TDesC& aPrimaryAlphaLabel, |
|
55 const TDesC& aSecondaryAlphaLabel, |
|
56 TInt aScanCode, |
|
57 TInt aKeyCode, |
|
58 TMifDialer aButtonIconId, |
|
59 TMifDialer aButtonIconMaskId, |
|
60 TInt aFlags ); |
|
61 |
|
62 /** |
|
63 * Destructor |
|
64 */ |
39 ~CDialerKeyPadButton(); |
65 ~CDialerKeyPadButton(); |
40 |
66 |
41 public: |
67 public: |
42 CCoeControl* Control() const { return iButton; }; |
68 |
|
69 /** |
|
70 * Scan code associated with the key. |
|
71 */ |
43 TInt ScanCode() const; |
72 TInt ScanCode() const; |
|
73 |
|
74 /** |
|
75 * Key code associated with the key |
|
76 */ |
44 TInt KeyCode() const; |
77 TInt KeyCode() const; |
45 void CreateButtonL( const TInt aScanCode, |
78 |
46 const TInt aKeyCode, |
79 /** |
47 const TMifDialer aButtonIcon, |
80 * Set layout variety to be used |
48 const TMifDialer aButtonIconMask ); |
81 */ |
49 void SetIconSize( TSize& aSize ); |
82 void SetVariety( TInt aVariety ); |
|
83 |
|
84 /** |
|
85 * Set operation mode of the keypad. Operation mode has rules, |
|
86 * which labels are shown and how they are laid out. |
|
87 */ |
|
88 void SetOperationMode( TDialerOperationMode aMode ); |
|
89 |
|
90 /** |
|
91 * Set number label for the key. |
|
92 * @param aLabel Reference to new label text. The reference must remain |
|
93 * valid until reset or this button is deleted. |
|
94 */ |
|
95 void SetNumLabel( const TDesC& aLabel ); |
|
96 |
|
97 /** |
|
98 * Set first row alphabet label. |
|
99 * @param aLabel Reference to new label text. The reference must remain |
|
100 * valid until reset or this button is deleted. |
|
101 */ |
|
102 void SetPrimaryAlphaLabel( const TDesC& aLabel ); |
|
103 |
|
104 /** |
|
105 * Set second row alphabet label for the key. |
|
106 * @param aLabel Reference to new label text. The reference must remain |
|
107 * valid until reset or this button is deleted. |
|
108 */ |
|
109 void SetSecondaryAlphaLabel( const TDesC& aLabel ); |
|
110 |
|
111 /** |
|
112 * Enable or disable audio feedback for this button. |
|
113 * @param aEnable ETrue if audio feedback should be enabled. |
|
114 * EFalse otherwise. |
|
115 */ |
|
116 void EnableAudioFeedback( const TBool aEnable ); |
|
117 |
|
118 public: //from CAknButton |
|
119 |
|
120 /** |
|
121 * @see CAknButton |
|
122 */ |
50 void HandleResourceChange( TInt aType ); |
123 void HandleResourceChange( TInt aType ); |
51 void MapDialerIconToSkinIcon( const TInt aDialerIcon, |
124 |
52 TAknsItemID& aItemId ) const; |
125 protected: // from CAknButton |
53 void EnableAudioFeedback( const TBool aEnable ); |
126 |
54 |
127 /** |
|
128 * @see CAknButton |
|
129 */ |
|
130 void Draw(const TRect& aRect) const; |
|
131 |
|
132 /** |
|
133 * @see CAknButton |
|
134 */ |
|
135 void SizeChanged(); |
|
136 |
55 private: |
137 private: |
|
138 |
56 void UpdateIconL(); |
139 void UpdateIconL(); |
|
140 void DrawIconAndText( CWindowGc& aGc ) const; |
|
141 void GetTextColors( TRgb& aPenColor, TRgb& aBrushColor ) const; |
|
142 void MapDialerIconToSkinIcon( TInt aDialerIcon, |
|
143 TAknsItemID& aItemId ) const; |
|
144 |
|
145 private: // constructors |
|
146 |
|
147 /** |
|
148 * C++ constructor |
|
149 * |
|
150 * @param aNumberLabel The number (etc) of the key. |
|
151 * @param aPrimaryAlphaLabel The first row of alphabets of the key. |
|
152 * @param aSecondaryAlphaLabel The second row of alphabets of the key. |
|
153 * @param aScanCode The button scanCode. |
|
154 * @param aKeyCode The button keyCode. |
|
155 * @param aButtonIconId The icon for the normal state. |
|
156 * @param aButtonIconMaskId The mask icon for the normal state. |
|
157 * @param aFlags CAknButton flags |
|
158 */ |
|
159 CDialerKeyPadButton( const TDesC& aNumberLabel, |
|
160 const TDesC& aPrimaryAlphaLabel, |
|
161 const TDesC& aSecondaryAlphaLabel, |
|
162 TInt aScanCode, |
|
163 TInt aKeyCode, |
|
164 TMifDialer aButtonIconId, |
|
165 TMifDialer aButtonIconMaskId, |
|
166 TInt aFlags ); |
|
167 |
|
168 /** |
|
169 * Symbian 2nd phase constructor. |
|
170 * |
|
171 * @param aFlags Flags of the button. |
|
172 */ |
|
173 void ConstructL( TInt aFlags ); |
57 |
174 |
58 private: // data |
175 private: // data |
59 |
176 |
60 CAknButton* iButton; |
177 /** Scan code of the key */ |
61 |
|
62 TInt iScanCode; |
178 TInt iScanCode; |
|
179 |
|
180 /** Key code of the key */ |
63 TInt iKeyCode; |
181 TInt iKeyCode; |
64 TMifDialer iButtonIcon; |
182 |
65 TMifDialer iButtonIconMask; |
183 /** ID of the icon bitmap */ |
|
184 TMifDialer iButtonIconId; |
|
185 |
|
186 /** ID of the icon mask */ |
|
187 TMifDialer iButtonIconMaskId; |
|
188 |
|
189 /** Layout variety to use */ |
|
190 TInt iVariety; |
|
191 |
|
192 /** Operation mode of the keypad */ |
|
193 TDialerOperationMode iOperationMode; |
|
194 |
|
195 /** Layout for number */ |
|
196 TAknLayoutText iNumberLayout; |
|
197 |
|
198 /** Layout for primary row of alphabets */ |
|
199 TAknLayoutText iPrimaryAlphaLayout; |
|
200 |
|
201 /** Layout for secondar row of alphabets */ |
|
202 TAknLayoutText iSecondaryAlphaLayout; |
|
203 |
|
204 /** Label containing the number or hash or asterisk */ |
|
205 TPtrC iNumberLabel; |
|
206 |
|
207 /** Label containing first row of alphabets */ |
|
208 TPtrC iPrimaryAlphaLabel; |
|
209 |
|
210 /** Label containing second row of alphabets */ |
|
211 TPtrC iSecondaryAlphaLabel; |
|
212 |
|
213 /** Rect inside the button where icon is drawn (if available) */ |
|
214 TRect iIconRect; |
66 }; |
215 }; |
67 |
216 |
68 #endif // C_CDIALERKEYPADBUTTON_H |
217 #endif // C_CDIALERKEYPADBUTTON_H |