|
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: Definition of CDialer class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CDIALER_H |
|
21 #define CDIALER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <coecntrl.h> |
|
25 #include <coemain.h> |
|
26 |
|
27 #include "mnumberentry.h" |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CEikButtonGroupContainer; |
|
33 class CDialerKeyPadContainer; |
|
34 class CDialerNumberEntry; |
|
35 class MNumberEntry; |
|
36 class CEikMenuPane; |
|
37 class CEikonEnv; |
|
38 class CAknEdwinState; |
|
39 class MNumberEntryObserver; |
|
40 |
|
41 // CLASS DECLARATION |
|
42 |
|
43 /** |
|
44 * CDialer class. |
|
45 * |
|
46 * @lib dialer.lib |
|
47 * @since Series60_5.0 |
|
48 * |
|
49 * Description: |
|
50 * Dialer is used in two applications, telephony and video telephony. |
|
51 * |
|
52 * In Telephony dialer handles number (number/sip address) input from |
|
53 * user via touch screen, VKB or hw keyboard (ITU-T and QWERTY). |
|
54 * |
|
55 * From host application dialer requires: |
|
56 * - View/container as CCoeControl |
|
57 * |
|
58 * |
|
59 * Usage: |
|
60 * |
|
61 |
|
62 // Hide status pane. |
|
63 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
64 { |
|
65 static_cast<CAknAppUi*>( CEikonEnv::Static()->EikAppUi())-> |
|
66 StatusPane()->MakeVisible( ETrue); |
|
67 } |
|
68 else |
|
69 { |
|
70 static_cast<CAknAppUi*>( CEikonEnv::Static()->EikAppUi())-> |
|
71 StatusPane()->MakeVisible( EFalse ); |
|
72 } |
|
73 |
|
74 // Calculate dialer area: |
|
75 TRect screenRect( |
|
76 TPoint( 0, 0 ), |
|
77 iCoeEnv->ScreenDevice()->SizeInPixels() ); |
|
78 |
|
79 TAknLayoutRect appRect; |
|
80 appRect.LayoutRect( |
|
81 screenRect, AknLayout::application_window( screenRect ); |
|
82 |
|
83 TAknLayoutRect mainRect; |
|
84 mainRect.LayoutRect( |
|
85 appRect.Rect(), |
|
86 AknLayout::main_pane( appRect.Rect(), 0, 1, 0 ) ); |
|
87 |
|
88 TRect mainPane( mainRect.Rect() ); |
|
89 |
|
90 // Reduce the space that CBA need from the rect |
|
91 CEikButtonGroupContainer cba = iEikEnv.AppUiFactory()->Cba(); |
|
92 TRect mainPane( aRect ); |
|
93 cba->ReduceRect( mainPane ); |
|
94 |
|
95 // Create dialer from container (CCoeControl) that created |
|
96 // dialer window (CreateWindowL). |
|
97 |
|
98 |
|
99 * In telephony dialer: |
|
100 |
|
101 // Create dialer. |
|
102 CDialer* dialer = CDialer::NewL( *this, aDialerArea ); |
|
103 |
|
104 // Open dialer |
|
105 // Open and show dialer |
|
106 iDialer->CreateNumberEntry(); |
|
107 |
|
108 // methods in MNumberEntry are available to contol dialer and |
|
109 // get/set text in number entry. |
|
110 |
|
111 // Close dialer |
|
112 iDialer->RemoveNumberEntry( ); |
|
113 // Delete dialer |
|
114 delete dialer; |
|
115 * |
|
116 */ |
|
117 NONSHARABLE_CLASS(CDialer) : public CCoeControl, public MNumberEntry |
|
118 { |
|
119 public: // Constructors and destructor |
|
120 |
|
121 /** |
|
122 * Two phase constructor |
|
123 * @param aContainer Parent container |
|
124 * @param aRect Area to use for dialer |
|
125 * @return New instance of Dialer |
|
126 */ |
|
127 IMPORT_C static CDialer* NewL( const CCoeControl& aContainer, |
|
128 const TRect& aRect ); |
|
129 |
|
130 /** |
|
131 * Destructor. |
|
132 */ |
|
133 IMPORT_C virtual ~CDialer(); |
|
134 |
|
135 public: // New functions |
|
136 |
|
137 /** |
|
138 * Return MNumberEntry API of Dialer |
|
139 * @return Pointer to MNumberEntry implementation |
|
140 */ |
|
141 IMPORT_C MNumberEntry* NumberEntry(); |
|
142 |
|
143 /** |
|
144 * Set number entry observer. |
|
145 */ |
|
146 IMPORT_C void SetNumberEntryObserver( MNumberEntryObserver& aObserver ); |
|
147 |
|
148 public: // from MNumberEntry |
|
149 |
|
150 /** |
|
151 * Sets number entry active. |
|
152 */ |
|
153 void CreateNumberEntry(); |
|
154 |
|
155 /** |
|
156 * Return pointer to number entry |
|
157 * @return The NE. |
|
158 */ |
|
159 CCoeControl* GetNumberEntry( ) const; |
|
160 |
|
161 /** |
|
162 * Query, is number entry used. |
|
163 * @return ETrue is NE is used. |
|
164 */ |
|
165 TBool IsNumberEntryUsed( ) const; |
|
166 |
|
167 /** |
|
168 * This disables NE drawing but doesn't empty the component. |
|
169 * @param aVisibility NE visible or not. |
|
170 */ |
|
171 void SetNumberEntryVisible( |
|
172 const TBool& aVisibility = ETrue ); |
|
173 |
|
174 /** |
|
175 * Set Number Entry text. |
|
176 * @param aDesC The text. |
|
177 */ |
|
178 void SetTextToNumberEntry( const TDesC& aDesC ); |
|
179 |
|
180 /** |
|
181 * Get Number Entry Text. |
|
182 * @param aDesC The text. |
|
183 */ |
|
184 void GetTextFromNumberEntry( TDes& aDesC ); |
|
185 |
|
186 /** |
|
187 * Removes NE and empties the buffer. |
|
188 */ |
|
189 void RemoveNumberEntry( ); |
|
190 |
|
191 /** |
|
192 * Set number entry's editor mode. |
|
193 * @param aMode for number editor input mode. |
|
194 * @return Input mode of the editor. |
|
195 */ |
|
196 TInt ChangeEditorMode( TBool aDefaultMode = EFalse ); |
|
197 |
|
198 /** |
|
199 * Open VKB |
|
200 */ |
|
201 void OpenVkbL(); |
|
202 |
|
203 /** |
|
204 * Get number entry's editor mode. |
|
205 * @return Input mode of the editor. |
|
206 */ |
|
207 TInt GetEditorMode() const; |
|
208 |
|
209 /** |
|
210 * Resets number entry editor to default values. |
|
211 */ |
|
212 void ResetEditorToDefaultValues(); |
|
213 |
|
214 /** |
|
215 * Set number entry's prompt text. |
|
216 * @param aPromptText. |
|
217 */ |
|
218 void SetNumberEntryPromptText( const TDesC& aPromptText ); |
|
219 |
|
220 /** |
|
221 * Enable or disable tactile feedback. |
|
222 * @param aEnable. |
|
223 */ |
|
224 void EnableTactileFeedback( const TBool aEnable ); |
|
225 |
|
226 private: // Functions from CCoeControl |
|
227 |
|
228 /** |
|
229 * @see CCoeControl |
|
230 */ |
|
231 void SizeChanged(); |
|
232 |
|
233 /** |
|
234 * @see CCoeControl |
|
235 */ |
|
236 void PositionChanged(); |
|
237 |
|
238 /** |
|
239 * @see CCoeControl |
|
240 */ |
|
241 TInt CountComponentControls() const; |
|
242 |
|
243 /** |
|
244 * @see CCoeControl |
|
245 */ |
|
246 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
247 |
|
248 /** |
|
249 * @see CCoeControl |
|
250 */ |
|
251 void Draw( const TRect& aRect ) const; |
|
252 |
|
253 /** |
|
254 * @see CCoeControl |
|
255 */ |
|
256 void FocusChanged( TDrawNow aDrawNow ); |
|
257 |
|
258 /** |
|
259 * @see CCoeControl |
|
260 */ |
|
261 void MakeVisible( TBool aVisible ); |
|
262 |
|
263 /** |
|
264 * @see CCoeControl |
|
265 */ |
|
266 void PrepareForFocusGainL(); |
|
267 |
|
268 /** |
|
269 * @see CCoeControl |
|
270 */ |
|
271 void HandleResourceChange( TInt aType ); |
|
272 |
|
273 /** |
|
274 * @see CCoeControl |
|
275 */ |
|
276 void HandlePointerEventL( const TPointerEvent& aPointerEvent ); |
|
277 |
|
278 |
|
279 private: |
|
280 |
|
281 /** |
|
282 * Constructor |
|
283 */ |
|
284 CDialer(); |
|
285 |
|
286 /** |
|
287 * 2nd phase constructor. |
|
288 * @param aContainer Parent container |
|
289 * @param aRect Area to use for dialer |
|
290 */ |
|
291 void ConstructL( const CCoeControl& aContainer , |
|
292 const TRect& aRect ); |
|
293 |
|
294 /** |
|
295 * Load resource file. |
|
296 */ |
|
297 void LoadResourceL(); |
|
298 |
|
299 /** |
|
300 * Unload resource file. |
|
301 */ |
|
302 void UnLoadResources(); |
|
303 |
|
304 /** |
|
305 * @see CCoeControl::ComponentControl() |
|
306 * @param aIndex control index |
|
307 */ |
|
308 CCoeControl* ComponentControlForDialerMode( const TInt aIndex ) const; |
|
309 |
|
310 /** |
|
311 * Returns edwin state |
|
312 * @return Pointer to CAknEdwinState |
|
313 */ |
|
314 CAknEdwinState* EdwinState(); |
|
315 |
|
316 /** |
|
317 * Updates editor flags for virtual |
|
318 * keyboard. |
|
319 */ |
|
320 void UpdateVkbEditorFlagsL(); |
|
321 |
|
322 private: // Data |
|
323 |
|
324 // Keypad container - owned |
|
325 CDialerKeyPadContainer* iKeypadArea; |
|
326 |
|
327 // Number entry container - owned |
|
328 CDialerNumberEntry* iNumberEntry; |
|
329 |
|
330 // Parent container |
|
331 const CCoeControl* iParentControl; |
|
332 |
|
333 // Is Number entry (e.g. dialer) being used at the moment |
|
334 TBool iIsUsed; |
|
335 |
|
336 // Reference to CEikonEnv |
|
337 CEikonEnv& iEikEnv; |
|
338 |
|
339 // Resource |
|
340 TInt iResourceOffset; |
|
341 |
|
342 // Is virtual key board open |
|
343 TBool iVirtualKeyBoardOpen; |
|
344 |
|
345 }; |
|
346 |
|
347 #endif // CDIALER_H |
|
348 |
|
349 // End of File |