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