|
1 /* |
|
2 * Copyright (c) 2007 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: CDialerNumberEntry class handles viewing |
|
15 * and positioning of Number Entry and offers API |
|
16 * to access NE contents. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 #ifndef CDIALERNUMBERENTRY_H |
|
23 #define CDIALERNUMBERENTRY_H |
|
24 |
|
25 // INCLUDES |
|
26 #include <coecntrl.h> |
|
27 #include <coemain.h> |
|
28 #include <AknPhoneNumberEditor.h> |
|
29 |
|
30 #include "cdialercontainerbase.h" |
|
31 |
|
32 // CONSTANTS |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CAknPhoneNumberEditor; |
|
36 class CAknButton; |
|
37 class CAknsFrameBackgroundControlContext; |
|
38 class MNumberEntryObserver; |
|
39 class CEikLabel; |
|
40 |
|
41 |
|
42 // Number entry varietys |
|
43 enum TDialerNEVariety |
|
44 { |
|
45 KDialerNELayoutLargeFont, |
|
46 KDialerNELayoutSmallFont |
|
47 }; |
|
48 |
|
49 // CLASS DECLARATION |
|
50 |
|
51 /** |
|
52 * CDialerNumberEntry control class |
|
53 * |
|
54 * @lib dialer.lib |
|
55 * @since S60 v5.0 |
|
56 */ |
|
57 NONSHARABLE_CLASS(CDialerNumberEntry) : |
|
58 public CDialerContainerBase |
|
59 { |
|
60 public: // Constructors and destructor |
|
61 |
|
62 /** |
|
63 * Two phase constructor |
|
64 * @param aContainer Parent container |
|
65 * @return New instance of CDialerNumberEntry |
|
66 */ |
|
67 static CDialerNumberEntry* NewL( |
|
68 const CCoeControl& aContainer ); |
|
69 |
|
70 /** |
|
71 * Destructor. |
|
72 */ |
|
73 virtual ~CDialerNumberEntry(); |
|
74 |
|
75 public: // New functions |
|
76 |
|
77 /** |
|
78 * Return text length in number entry |
|
79 * @return text length |
|
80 */ |
|
81 TInt TextLength(); |
|
82 |
|
83 /** |
|
84 * Return number entry as CCoeControl |
|
85 * @return CCoeControl pointer of CAknPhoneNumberEditor |
|
86 */ |
|
87 CCoeControl* GetNumberEntry( ) const; |
|
88 |
|
89 /** |
|
90 * Create and show number entry |
|
91 */ |
|
92 void CreateNumberEntry(); |
|
93 |
|
94 /** |
|
95 * Toggles editor mode from number->text->number->.. |
|
96 * @param aDefaultMode if EFalse, set mode to number, |
|
97 * else toggle mode. |
|
98 */ |
|
99 TInt ChangeEditorMode( TBool aDefaultMode ); |
|
100 |
|
101 /** |
|
102 * Return current editor mode |
|
103 * @return editor mode. |
|
104 */ |
|
105 TInt GetEditorMode() const; |
|
106 |
|
107 /** |
|
108 * Set text to number entry |
|
109 * @param aDesc Text to set. |
|
110 */ |
|
111 void SetTextToNumberEntry( const TDesC& aDesC ); |
|
112 |
|
113 /** |
|
114 * Get tect from number entry. |
|
115 * @param aDesc Text is returned here. |
|
116 */ |
|
117 void GetTextFromNumberEntry( TDes& aDesC ); |
|
118 |
|
119 /** |
|
120 * Reset editor to default values. |
|
121 */ |
|
122 void ResetEditorToDefaultValues(); |
|
123 |
|
124 /** |
|
125 * Set number entry's prompt text. |
|
126 * @param aPromptText. |
|
127 */ |
|
128 void SetNumberEntryPromptTextL( const TDesC& aPromptText ); |
|
129 |
|
130 |
|
131 /** |
|
132 * Handles command targeted to this container. |
|
133 * @param aCommand Command. |
|
134 */ |
|
135 TBool HandleCommandL( TDialerCommandId aCommand); |
|
136 |
|
137 /** |
|
138 * Set number entry observer. |
|
139 */ |
|
140 void SetNumberEntryObserver( MNumberEntryObserver& aObserver ); |
|
141 |
|
142 /** |
|
143 * Clear editor flags to default values. |
|
144 */ |
|
145 void ClearEditorFlags(); |
|
146 |
|
147 private: // Functions from MCoeControlObserver |
|
148 /** |
|
149 * @see MCoeControlObserver |
|
150 */ |
|
151 void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType ); |
|
152 |
|
153 private: // Functions from CCoeControl |
|
154 |
|
155 /** |
|
156 * @see CCoeControl |
|
157 */ |
|
158 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
159 TEventCode aType ); |
|
160 |
|
161 /** |
|
162 * @see CCoeControl |
|
163 */ |
|
164 TInt CountComponentControls() const; |
|
165 |
|
166 /** |
|
167 * @see CCoeControl |
|
168 */ |
|
169 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
170 |
|
171 /** |
|
172 * @see CCoeControl |
|
173 */ |
|
174 void Draw( const TRect& /*aRect */) const; |
|
175 |
|
176 /** |
|
177 * @see CCoeControl |
|
178 */ |
|
179 void HandleResourceChange( TInt aType ); |
|
180 |
|
181 public: |
|
182 /** |
|
183 * @see CCoeControl |
|
184 */ |
|
185 void SetFocus( TBool aFocus, |
|
186 TDrawNow aDrawNow=ENoDrawNow ); |
|
187 |
|
188 private: // From CDialerContainerBase |
|
189 |
|
190 |
|
191 /** |
|
192 * @see CDialerContainerBase |
|
193 */ |
|
194 void SetVariety( ); |
|
195 |
|
196 /** |
|
197 * @see CDialerContainerBase |
|
198 */ |
|
199 void SetLayout( ); |
|
200 |
|
201 /** |
|
202 * @see CDialerContainerBase |
|
203 */ |
|
204 TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); |
|
205 |
|
206 |
|
207 /** |
|
208 * Get inner and outer rectangles for rectangle frame. |
|
209 * @param aFrameRect Frame rectangle. |
|
210 * @param aOuterRect Outer rectangle (return). |
|
211 * @param aInnerRect Inner rectangle (return). |
|
212 */ |
|
213 void RectFrameInnerOuterRects( const TRect& aFrameRect, |
|
214 TRect& aOuterRect, |
|
215 TRect& aInnerRect ); |
|
216 private: |
|
217 |
|
218 /** |
|
219 * 2nd phase constructor. |
|
220 */ |
|
221 void ConstructL(); |
|
222 |
|
223 /** |
|
224 * Constructor |
|
225 * @param aContainer Parent container |
|
226 * @param aCommandHandler |
|
227 */ |
|
228 CDialerNumberEntry( |
|
229 const CCoeControl& aContainer/*, |
|
230 MDialerCommandHandler& aCommandHandler */); |
|
231 |
|
232 /** |
|
233 * Construct number editor from layout. |
|
234 */ |
|
235 void ConstructEditorFromResourceL( TResourceReader& aReader ); |
|
236 |
|
237 /** |
|
238 * Update formats in number entry from layout |
|
239 */ |
|
240 void UpdateNumberEntryFormats(); |
|
241 |
|
242 /** |
|
243 * Calculates number entry layout & format for given number entry variety |
|
244 * @param aFormat -format to be filled |
|
245 * @param aNEVariety -determines the format layot |
|
246 */ |
|
247 void CalculateLayout( CAknPhoneNumberEditor::TFormat& aFormat, |
|
248 TInt aNEVariety ); |
|
249 /** |
|
250 * Start virtual keyboard. |
|
251 */ |
|
252 void StartVirtualKeyBoard(); |
|
253 |
|
254 /** |
|
255 * Checks the number entry and informs client via observer interface |
|
256 * whether the state is changed. |
|
257 */ |
|
258 void InformNumberEntryState(); |
|
259 |
|
260 |
|
261 void CheckLabelSkinningColor(); |
|
262 |
|
263 /** |
|
264 * Checks editor formatting. |
|
265 */ |
|
266 void HandleEditorFormatting(); |
|
267 |
|
268 private: // Data |
|
269 |
|
270 // Number editor field |
|
271 CAknPhoneNumberEditor* iEditor; |
|
272 |
|
273 //Prompt text label for number entry. |
|
274 CEikLabel* iLabel; |
|
275 |
|
276 // NE Font. |
|
277 CFbsFont* iNEFont; |
|
278 |
|
279 // Amount of formats for updating. |
|
280 TInt iFormatCount; |
|
281 |
|
282 // Skin control context for the editor (9-piece) |
|
283 CAknsFrameBackgroundControlContext* iFrameContext; |
|
284 |
|
285 TRect iOuterRect; |
|
286 |
|
287 TRect iInnerRect; |
|
288 |
|
289 MNumberEntryObserver* iObserver; |
|
290 |
|
291 TBool iNumberContents; |
|
292 }; |
|
293 |
|
294 #endif // CDIALERNUMBERENTRY_H |
|
295 |
|
296 // End of File |