25
|
1 |
/*
|
|
2 |
* Copyright (c) 2008, 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 "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Definition of CDialerKeyPadButton class.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef C_CDIALERKEYPADBUTTON_H
|
|
20 |
#define C_CDIALERKEYPADBUTTON_H
|
|
21 |
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <aknbutton.h>
|
|
24 |
#include "dialercommon.h"
|
|
25 |
|
|
26 |
const TMifDialer KDialerNoIcon = EMbmDialerLastElement;
|
|
27 |
|
|
28 |
// CLASS DECLARATION
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Contains keypad button data.
|
|
32 |
*
|
|
33 |
* @lib dialer.lib
|
|
34 |
* @since S60 v5.0
|
|
35 |
*/
|
|
36 |
NONSHARABLE_CLASS( CDialerKeyPadButton ) : public CAknButton
|
|
37 |
{
|
|
38 |
public: // Enumerations
|
|
39 |
|
|
40 |
enum TDialerKeyPadButtonEvent
|
|
41 |
{
|
|
42 |
/* Reported to the observer when pointer is dragged outside
|
|
43 |
* the button's area.
|
|
44 |
*/
|
|
45 |
EEventDraggingOutsideButton = 200
|
|
46 |
};
|
|
47 |
|
|
48 |
public:
|
|
49 |
|
|
50 |
/**
|
|
51 |
* @param aNumberLabel The number (etc) of the key.
|
|
52 |
* Reference must remain valid until reset with SetNumLabel
|
|
53 |
* @parem aPrimaryAlphaLabel The first row of alphabets of the key.
|
|
54 |
* Reference must remain valid until reset with SetPrimaryAlphaLabel
|
|
55 |
* @param aSecondaryAlphaLabel The second row of alphabets of the key.
|
|
56 |
* Reference must remain valid until reset with SetSecondaryAlphaLabel
|
|
57 |
* @param aScanCode The button scanCode.
|
|
58 |
* @param aKeyCode The button keyCode.
|
|
59 |
* @param aButtonIconId The icon for the normal state.
|
|
60 |
* @param aButtonIconMaskId The icon mask for the normal state.
|
|
61 |
* @param aFlags CAknButton flags
|
|
62 |
*/
|
|
63 |
static CDialerKeyPadButton* NewLC( const TDesC& aNumberLabel,
|
|
64 |
const TDesC& aPrimaryAlphaLabel,
|
|
65 |
const TDesC& aSecondaryAlphaLabel,
|
|
66 |
TInt aScanCode,
|
|
67 |
TInt aKeyCode,
|
|
68 |
TMifDialer aButtonIconId,
|
|
69 |
TMifDialer aButtonIconMaskId,
|
|
70 |
TInt aFlags );
|
|
71 |
|
|
72 |
/**
|
|
73 |
* Destructor
|
|
74 |
*/
|
|
75 |
~CDialerKeyPadButton();
|
|
76 |
|
|
77 |
public:
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Scan code associated with the key.
|
|
81 |
*/
|
|
82 |
TInt ScanCode() const;
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Key code associated with the key
|
|
86 |
*/
|
|
87 |
TInt KeyCode() const;
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Set layout variety to be used
|
|
91 |
*/
|
|
92 |
void SetVariety( TInt aVariety );
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Set operation mode of the keypad. Operation mode has rules,
|
|
96 |
* which labels are shown and how they are laid out.
|
|
97 |
*/
|
|
98 |
void SetOperationMode( TDialerOperationMode aMode );
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Set number label for the key.
|
|
102 |
* @param aLabel Reference to new label text. The reference must remain
|
|
103 |
* valid until reset or this button is deleted.
|
|
104 |
*/
|
|
105 |
void SetNumLabel( const TDesC& aLabel );
|
|
106 |
|
|
107 |
/**
|
|
108 |
* Set first row alphabet label.
|
|
109 |
* @param aLabel Reference to new label text. The reference must remain
|
|
110 |
* valid until reset or this button is deleted.
|
|
111 |
*/
|
|
112 |
void SetPrimaryAlphaLabel( const TDesC& aLabel );
|
|
113 |
|
|
114 |
/**
|
|
115 |
* Set second row alphabet label for the key.
|
|
116 |
* @param aLabel Reference to new label text. The reference must remain
|
|
117 |
* valid until reset or this button is deleted.
|
|
118 |
*/
|
|
119 |
void SetSecondaryAlphaLabel( const TDesC& aLabel );
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Enable or disable audio feedback for this button.
|
|
123 |
* @param aEnable ETrue if audio feedback should be enabled.
|
|
124 |
* EFalse otherwise.
|
|
125 |
*/
|
|
126 |
void EnableAudioFeedback( const TBool aEnable );
|
|
127 |
|
|
128 |
public: //from CAknButton
|
|
129 |
|
|
130 |
/**
|
|
131 |
* @see CAknButton
|
|
132 |
*/
|
|
133 |
void HandleResourceChange( TInt aType );
|
|
134 |
|
|
135 |
protected: // from CAknButton
|
|
136 |
|
|
137 |
/**
|
|
138 |
* @see CAknButton
|
|
139 |
*/
|
|
140 |
void Draw(const TRect& aRect) const;
|
|
141 |
|
|
142 |
/**
|
|
143 |
* @see CAknButton
|
|
144 |
*/
|
|
145 |
void SizeChanged();
|
|
146 |
|
|
147 |
/**
|
|
148 |
* @see CAknButton
|
|
149 |
*/
|
|
150 |
void HandlePointerEventL( const TPointerEvent& aPointerEvent );
|
|
151 |
|
|
152 |
private:
|
|
153 |
|
|
154 |
void UpdateIconL();
|
|
155 |
void DrawIconAndText( CWindowGc& aGc ) const;
|
|
156 |
void GetTextColors( TRgb& aPenColor, TRgb& aBrushColor ) const;
|
|
157 |
void MapDialerIconToSkinIcon( TInt aDialerIcon,
|
|
158 |
TAknsItemID& aItemId ) const;
|
|
159 |
void SetIconLayout( const TRect& aRect );
|
|
160 |
|
|
161 |
private: // constructors
|
|
162 |
|
|
163 |
/**
|
|
164 |
* C++ constructor
|
|
165 |
*
|
|
166 |
* @param aNumberLabel The number (etc) of the key.
|
|
167 |
* @param aPrimaryAlphaLabel The first row of alphabets of the key.
|
|
168 |
* @param aSecondaryAlphaLabel The second row of alphabets of the key.
|
|
169 |
* @param aScanCode The button scanCode.
|
|
170 |
* @param aKeyCode The button keyCode.
|
|
171 |
* @param aButtonIconId The icon for the normal state.
|
|
172 |
* @param aButtonIconMaskId The mask icon for the normal state.
|
|
173 |
* @param aFlags CAknButton flags
|
|
174 |
*/
|
|
175 |
CDialerKeyPadButton( const TDesC& aNumberLabel,
|
|
176 |
const TDesC& aPrimaryAlphaLabel,
|
|
177 |
const TDesC& aSecondaryAlphaLabel,
|
|
178 |
TInt aScanCode,
|
|
179 |
TInt aKeyCode,
|
|
180 |
TMifDialer aButtonIconId,
|
|
181 |
TMifDialer aButtonIconMaskId,
|
|
182 |
TInt aFlags );
|
|
183 |
|
|
184 |
/**
|
|
185 |
* Symbian 2nd phase constructor.
|
|
186 |
*
|
|
187 |
* @param aFlags Flags of the button.
|
|
188 |
*/
|
|
189 |
void ConstructL( TInt aFlags );
|
|
190 |
|
|
191 |
private: // data
|
|
192 |
|
|
193 |
/** Scan code of the key */
|
|
194 |
TInt iScanCode;
|
|
195 |
|
|
196 |
/** Key code of the key */
|
|
197 |
TInt iKeyCode;
|
|
198 |
|
|
199 |
/** ID of the icon bitmap */
|
|
200 |
TMifDialer iButtonIconId;
|
|
201 |
|
|
202 |
/** ID of the icon mask */
|
|
203 |
TMifDialer iButtonIconMaskId;
|
|
204 |
|
|
205 |
/** Layout variety to use */
|
|
206 |
TInt iVariety;
|
|
207 |
|
|
208 |
/** Operation mode of the keypad */
|
|
209 |
TDialerOperationMode iOperationMode;
|
|
210 |
|
|
211 |
/** Layout for number */
|
|
212 |
TAknLayoutText iNumberLayout;
|
|
213 |
|
|
214 |
/** Layout for primary row of alphabets */
|
|
215 |
TAknLayoutText iPrimaryAlphaLayout;
|
|
216 |
|
|
217 |
/** Layout for secondar row of alphabets */
|
|
218 |
TAknLayoutText iSecondaryAlphaLayout;
|
|
219 |
|
|
220 |
/** Label containing the number or hash or asterisk */
|
|
221 |
TPtrC iNumberLabel;
|
|
222 |
|
|
223 |
/** Label containing first row of alphabets */
|
|
224 |
TPtrC iPrimaryAlphaLabel;
|
|
225 |
|
|
226 |
/** Label containing second row of alphabets */
|
|
227 |
TPtrC iSecondaryAlphaLabel;
|
|
228 |
|
|
229 |
/** Rect inside the button where icon is drawn (if available) */
|
|
230 |
TRect iIconRect;
|
|
231 |
|
|
232 |
/** Own variable for counting drag events, cannot use the one in base class */
|
|
233 |
TInt iDragEventCounter;
|
|
234 |
};
|
|
235 |
|
|
236 |
#endif // C_CDIALERKEYPADBUTTON_H
|