25
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 - 2010 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: Shows number keypad and generates keypress event when
|
|
15 |
* buttons are pressed.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <e32event.h>
|
|
22 |
#include <gulicon.h>
|
|
23 |
#include <eikapp.h>
|
|
24 |
#include <aknbutton.h>
|
|
25 |
#include <AknControl.h>
|
|
26 |
#include <AknsUtils.h>
|
|
27 |
#include <AknsSkinInstance.h>
|
|
28 |
#include <AknsDrawUtils.h>
|
|
29 |
#include <AknsConstants.h>
|
|
30 |
#include <AknLayout2Def.h>
|
|
31 |
#include <aknlayoutscalable_apps.cdl.h>
|
|
32 |
#include <layoutmetadata.cdl.h>
|
|
33 |
#include <data_caging_path_literals.hrh> // for KDC_APP_RESOURCE_DIR
|
|
34 |
#include <touchfeedback.h>
|
|
35 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
36 |
#include <AknsFrameBackgroundControlContext.h>
|
|
37 |
|
|
38 |
#include "cdialerkeypadcontainer.h"
|
|
39 |
#include "dialercommon.h"
|
|
40 |
#include "dialertrace.h"
|
|
41 |
|
|
42 |
#include "cdialerkeypadbutton.h"
|
|
43 |
|
|
44 |
// Number of buttons in this container
|
|
45 |
const TInt KNumberOfButtons = 12;
|
|
46 |
|
|
47 |
struct TDialerButton
|
|
48 |
{
|
|
49 |
TMifDialer iBitmap;
|
|
50 |
TMifDialer iBitmapMask;
|
|
51 |
TInt iScanCode;
|
|
52 |
TInt iKeyCode;
|
|
53 |
};
|
|
54 |
|
|
55 |
const TDialerButton KKeyPadButtons[ KNumberOfButtons ] =
|
|
56 |
|
|
57 |
{
|
|
58 |
{ EMbmDialerQgn_indi_dialer_voicemail,
|
|
59 |
EMbmDialerQgn_indi_dialer_voicemail_mask,
|
|
60 |
'1',
|
|
61 |
'1'
|
|
62 |
},
|
|
63 |
{ KDialerNoIcon, KDialerNoIcon,
|
|
64 |
'2', '2' },
|
|
65 |
{ KDialerNoIcon, KDialerNoIcon,
|
|
66 |
'3', '3' },
|
|
67 |
{ KDialerNoIcon, KDialerNoIcon,
|
|
68 |
'4', '4' },
|
|
69 |
{ KDialerNoIcon, KDialerNoIcon,
|
|
70 |
'5', '5' },
|
|
71 |
{ KDialerNoIcon, KDialerNoIcon,
|
|
72 |
'6', '6' },
|
|
73 |
{ KDialerNoIcon, KDialerNoIcon,
|
|
74 |
'7', '7' },
|
|
75 |
{ KDialerNoIcon, KDialerNoIcon,
|
|
76 |
'8', '8' },
|
|
77 |
{ KDialerNoIcon, KDialerNoIcon,
|
|
78 |
'9', '9' },
|
|
79 |
{ KDialerNoIcon, KDialerNoIcon,
|
|
80 |
EStdKeyNkpAsterisk, '*' },
|
|
81 |
{ EMbmDialerQgn_indi_dialer_internet,
|
|
82 |
EMbmDialerQgn_indi_dialer_internet_mask,
|
|
83 |
'0', '0' },
|
|
84 |
{ KDialerNoIcon, KDialerNoIcon,
|
|
85 |
EStdKeyHash, '#' }
|
|
86 |
};
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
// ========================= MEMBER FUNCTIONS ================================
|
|
91 |
|
|
92 |
// ---------------------------------------------------------------------------
|
|
93 |
// Symbian OS two phased constructor
|
|
94 |
// ---------------------------------------------------------------------------
|
|
95 |
//
|
|
96 |
CDialerKeyPadContainer* CDialerKeyPadContainer::NewL(
|
|
97 |
const CCoeControl& aContainer,
|
|
98 |
TDialerOperationMode aOperatingMode
|
|
99 |
)
|
|
100 |
{
|
|
101 |
CDialerKeyPadContainer* self =
|
|
102 |
new( ELeave )CDialerKeyPadContainer ( aContainer, aOperatingMode );
|
|
103 |
CleanupStack::PushL( self );
|
|
104 |
self->ConstructL();
|
|
105 |
CleanupStack::Pop(self);
|
|
106 |
return self;
|
|
107 |
}
|
|
108 |
|
|
109 |
|
|
110 |
// ---------------------------------------------------------------------------
|
|
111 |
// Symbian OS two phased constructor
|
|
112 |
// ---------------------------------------------------------------------------
|
|
113 |
//
|
|
114 |
void CDialerKeyPadContainer::ConstructL()
|
|
115 |
{
|
|
116 |
DIALER_PRINT("KeyPadContainer::ConstructL<");
|
|
117 |
BaseConstructL();
|
|
118 |
iKeyLabelManager = CDialerKeyPadLabelManager::NewL( *iCoeEnv, *this );
|
|
119 |
CreateButtonsL();
|
|
120 |
iCoeEnv->AddForegroundObserverL( *this );
|
|
121 |
DIALER_PRINT("KeyPadContainer::ConstructL>");
|
|
122 |
}
|
|
123 |
|
|
124 |
// Constructor
|
|
125 |
CDialerKeyPadContainer::CDialerKeyPadContainer(
|
|
126 |
const CCoeControl& aContainer,
|
|
127 |
TDialerOperationMode aOperatingMode )
|
|
128 |
: CDialerContainerBase (
|
|
129 |
const_cast<CCoeControl&>(aContainer) ),
|
|
130 |
iOperatingMode( aOperatingMode )
|
|
131 |
{
|
|
132 |
}
|
|
133 |
|
|
134 |
// Destructor
|
|
135 |
CDialerKeyPadContainer::~CDialerKeyPadContainer()
|
|
136 |
{
|
|
137 |
iButtons.ResetAndDestroy();
|
|
138 |
iCoeEnv->RemoveForegroundObserver( *this );
|
|
139 |
delete iKeyLabelManager;
|
|
140 |
}
|
|
141 |
|
|
142 |
// ---------------------------------------------------------------------------
|
|
143 |
// CDialerKeyPadContainer::CountComponentControls
|
|
144 |
//
|
|
145 |
// ---------------------------------------------------------------------------
|
|
146 |
//
|
|
147 |
TInt CDialerKeyPadContainer::CountComponentControls() const
|
|
148 |
{
|
|
149 |
return KNumberOfButtons;
|
|
150 |
}
|
|
151 |
|
|
152 |
// ---------------------------------------------------------------------------
|
|
153 |
// CDialerKeyPadContainer::ComponentControl
|
|
154 |
//
|
|
155 |
// ---------------------------------------------------------------------------
|
|
156 |
//
|
|
157 |
CCoeControl* CDialerKeyPadContainer::ComponentControl( TInt aIndex ) const
|
|
158 |
{
|
|
159 |
__ASSERT_DEBUG( aIndex < KNumberOfButtons,
|
|
160 |
_L("CDialerKeyPadContainer::ComponentControl, index out of range."));
|
|
161 |
|
|
162 |
return iButtons[aIndex];
|
|
163 |
}
|
|
164 |
|
|
165 |
// ---------------------------------------------------------------------------
|
|
166 |
// CDialerKeyPadContainer::HandlePointerEventL
|
|
167 |
//
|
|
168 |
// ---------------------------------------------------------------------------
|
|
169 |
//
|
|
170 |
void CDialerKeyPadContainer::HandlePointerEventL(
|
|
171 |
const TPointerEvent& aPointerEvent )
|
|
172 |
{
|
|
173 |
DIALER_PRINT("KeyPadContainer::HandlePointerEventL<");
|
|
174 |
|
|
175 |
CCoeControl::HandlePointerEventL( aPointerEvent );
|
|
176 |
|
|
177 |
if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
|
|
178 |
{
|
|
179 |
iPointerEvent = aPointerEvent;
|
|
180 |
iKeyUpSimulatedDueToDragging = EFalse;
|
|
181 |
}
|
|
182 |
DIALER_PRINT("KeyPadContainer::HandlePointerEventL>");
|
|
183 |
}
|
|
184 |
|
|
185 |
// ---------------------------------------------------------------------------
|
|
186 |
// CDialerKeyPadContainer::SetVariety
|
|
187 |
//
|
|
188 |
// Set variety according to current state.
|
|
189 |
// ---------------------------------------------------------------------------
|
|
190 |
//
|
|
191 |
void CDialerKeyPadContainer::SetVariety()
|
|
192 |
{
|
|
193 |
if ( Layout_Meta_Data::IsLandscapeOrientation() )
|
|
194 |
{
|
|
195 |
iVariety = EVideoVarietyLandscape;
|
|
196 |
}
|
|
197 |
else
|
|
198 |
{
|
|
199 |
iVariety = EVideoVarietyPortrait;
|
|
200 |
}
|
|
201 |
}
|
|
202 |
|
|
203 |
// ---------------------------------------------------------------------------
|
|
204 |
// CDialerKeyPadContainer::SetLayout
|
|
205 |
//
|
|
206 |
// Set layout for video dtmf or phone dialer
|
|
207 |
// ---------------------------------------------------------------------------
|
|
208 |
//
|
|
209 |
void CDialerKeyPadContainer::SetLayout()
|
|
210 |
{
|
|
211 |
if ( iOperatingMode == EModeDialer ||
|
|
212 |
iOperatingMode == EModeEasyDialing )
|
|
213 |
{
|
|
214 |
// Same renewed layout is used regardless of the status
|
|
215 |
// of Easy Dialing
|
|
216 |
SetEasyDialingLayout();
|
|
217 |
}
|
|
218 |
else
|
|
219 |
{
|
|
220 |
SetVideoLayout();
|
|
221 |
}
|
|
222 |
}
|
|
223 |
|
|
224 |
// ---------------------------------------------------------------------------
|
|
225 |
// CDialerKeyPadContainer::SetPhoneLayout
|
|
226 |
//
|
|
227 |
// ---------------------------------------------------------------------------
|
|
228 |
//
|
|
229 |
void CDialerKeyPadContainer::SetPhoneLayout()
|
|
230 |
{
|
|
231 |
// Set Number entry layout.
|
|
232 |
/*
|
|
233 |
|
|
234 |
// LAF Table : grid_dialer2_keypad_pane
|
|
235 |
inline TAknLayoutScalableParameterLimits cell_dialer2_keypad_pane_ParamLimits()
|
|
236 |
inline TAknWindowComponentLayout cell_dialer2_keypad_pane()
|
|
237 |
|
|
238 |
// LAF Table : cell_dialer2_keypad_pane
|
|
239 |
inline TAknLayoutScalableParameterLimits bg_button_pane_pane_cp04_ParamLimits()
|
|
240 |
inline TAknWindowComponentLayout bg_button_pane_pane_cp04()
|
|
241 |
inline TAknLayoutScalableParameterLimits cell_dialer2_keypad_pane_g1_ParamLimits()
|
|
242 |
*/
|
|
243 |
|
|
244 |
TRect parentRect( Rect() );
|
|
245 |
|
|
246 |
// Layout buttons
|
|
247 |
TAknLayoutScalableParameterLimits limits =
|
|
248 |
AknLayoutScalable_Apps::cell_dialer2_keypad_pane_ParamLimits( iVariety );
|
|
249 |
|
|
250 |
TInt i = 0;
|
|
251 |
for ( TInt row = limits.FirstRow(); row <= limits.LastRow(); row++ )
|
|
252 |
{
|
|
253 |
for ( TInt col = limits.FirstColumn();
|
|
254 |
col <= limits.LastColumn(); col++ )
|
|
255 |
{
|
|
256 |
iButtons[i]->SetVariety( iVariety );
|
|
257 |
iButtons[i]->SetOperationMode( iOperatingMode );
|
|
258 |
|
|
259 |
AknLayoutUtils::LayoutControl( iButtons[i], parentRect, TAknWindowComponentLayout::Compose(
|
|
260 |
AknLayoutScalable_Apps::cell_dialer2_keypad_pane( iVariety, col, row ),
|
|
261 |
AknLayoutScalable_Apps::bg_button_pane_pane_cp04( iVariety ) ) );
|
|
262 |
i++;
|
|
263 |
}
|
|
264 |
}
|
|
265 |
}
|
|
266 |
|
|
267 |
// ---------------------------------------------------------------------------
|
|
268 |
// CDialerKeyPadContainer::SetEasyDialingLayout
|
|
269 |
//
|
|
270 |
// ---------------------------------------------------------------------------
|
|
271 |
//
|
|
272 |
void CDialerKeyPadContainer::SetEasyDialingLayout()
|
|
273 |
{
|
|
274 |
TRect parentRect( Rect() );
|
|
275 |
|
|
276 |
// Layout buttons
|
|
277 |
TAknLayoutScalableParameterLimits limits =
|
|
278 |
AknLayoutScalable_Apps::cell_dialer2_keypad_pane_ParamLimits( iVariety );
|
|
279 |
|
|
280 |
// Rectangle of the first button
|
|
281 |
TAknLayoutRect buttonLayoutRect;
|
|
282 |
buttonLayoutRect.LayoutRect( parentRect,
|
|
283 |
AknLayoutScalable_Apps::cell_dia3_key_num_pane( iVariety ) );
|
|
284 |
TRect firstButtonRect = buttonLayoutRect.Rect();
|
|
285 |
// Move the first button rect to top-left-corner of the keypad area,
|
|
286 |
// the default place is wrong in mirrored layout.
|
|
287 |
firstButtonRect.SetRect( parentRect.iTl, firstButtonRect.Size() );
|
|
288 |
|
|
289 |
TInt colCount = limits.LastColumn() - limits.FirstColumn() + 1;
|
|
290 |
|
|
291 |
for ( TInt row = limits.FirstRow() ; row <= limits.LastRow() ; row++ )
|
|
292 |
{
|
|
293 |
for ( TInt col = limits.FirstColumn() ; col <= limits.LastColumn() ; col++ )
|
|
294 |
{
|
|
295 |
// Calculate corresponding index in iButtons array
|
|
296 |
TInt idx = col + row * colCount;
|
|
297 |
|
|
298 |
// Set mode and variety so that correct button internal layout will be used.
|
|
299 |
// Always use ED mode, so that text labels are visible even when ED is off.
|
|
300 |
iButtons[idx]->SetVariety( iVariety );
|
|
301 |
iButtons[idx]->SetOperationMode( EModeEasyDialing );
|
|
302 |
|
|
303 |
// Layout button
|
|
304 |
TRect buttonRect = firstButtonRect;
|
|
305 |
buttonRect.Move( col * buttonRect.Width(), row * buttonRect.Height() );
|
|
306 |
buttonRect.Shrink( 1, 1 ); // to create small gap between buttons
|
|
307 |
iButtons[idx]->SetRect( buttonRect );
|
|
308 |
}
|
|
309 |
}
|
|
310 |
|
|
311 |
}
|
|
312 |
|
|
313 |
// ---------------------------------------------------------------------------
|
|
314 |
// CDialerKeyPadContainer::SetVideoLayout
|
|
315 |
//
|
|
316 |
// ---------------------------------------------------------------------------
|
|
317 |
//
|
|
318 |
void CDialerKeyPadContainer::SetVideoLayout()
|
|
319 |
{
|
|
320 |
TRect parentRect( Rect() );
|
|
321 |
|
|
322 |
TAknLayoutScalableParameterLimits limits =
|
|
323 |
AknLayoutScalable_Apps::cell_video_dialer_keypad_pane_ParamLimits( iVariety ) ;
|
|
324 |
|
|
325 |
TInt i = 0;
|
|
326 |
for ( TInt row = limits.FirstRow(); row <= limits.LastRow(); row++ )
|
|
327 |
{
|
|
328 |
for ( TInt col = limits.FirstColumn();
|
|
329 |
col <= limits.LastColumn();
|
|
330 |
col++ )
|
|
331 |
{
|
|
332 |
iButtons[i]->SetVariety( iVariety );
|
|
333 |
iButtons[i]->SetOperationMode( iOperatingMode );
|
|
334 |
|
|
335 |
// Layout button
|
|
336 |
AknLayoutUtils::LayoutControl(
|
|
337 |
iButtons[i], parentRect,
|
|
338 |
TAknWindowComponentLayout::Compose(
|
|
339 |
AknLayoutScalable_Apps::cell_video_dialer_keypad_pane(
|
|
340 |
iVariety, col, row ),
|
|
341 |
AknLayoutScalable_Apps::bg_button_pane_cp08( iVariety ) ) );
|
|
342 |
i++;
|
|
343 |
}
|
|
344 |
}
|
|
345 |
}
|
|
346 |
|
|
347 |
// ---------------------------------------------------------------------------
|
|
348 |
// CDialerKeyPadContainer::CreateButtonsL
|
|
349 |
//
|
|
350 |
// Create buttons for this container.
|
|
351 |
// ---------------------------------------------------------------------------
|
|
352 |
//
|
|
353 |
void CDialerKeyPadContainer::CreateButtonsL()
|
|
354 |
{
|
|
355 |
DIALER_PRINT("KeyPadContainer::CreateButtonsL<");
|
|
356 |
|
|
357 |
TInt flags ( KAknButtonReportOnKeyDown |
|
|
358 |
KAknButtonRequestExitOnButtonUpEvent );
|
|
359 |
|
|
360 |
for ( TInt i = 0; i < KNumberOfButtons; i++ )
|
|
361 |
{
|
|
362 |
const TPtrC numLabel = iKeyLabelManager->ButtonNumLabel( i );
|
|
363 |
|
|
364 |
const TPtrC alphaLabel = iKeyLabelManager->ButtonFirstAlphaLabel( i );
|
|
365 |
|
|
366 |
const TPtrC secondAlphaLabel = iKeyLabelManager->ButtonSecondAlphaLabel( i );
|
|
367 |
|
|
368 |
CDialerKeyPadButton* button = CDialerKeyPadButton::NewLC(
|
|
369 |
numLabel,
|
|
370 |
alphaLabel,
|
|
371 |
secondAlphaLabel,
|
|
372 |
KKeyPadButtons[i].iScanCode,
|
|
373 |
KKeyPadButtons[i].iKeyCode,
|
|
374 |
KKeyPadButtons[i].iBitmap,
|
|
375 |
KKeyPadButtons[i].iBitmapMask,
|
|
376 |
flags );
|
|
377 |
iButtons.AppendL( button );
|
|
378 |
CleanupStack::Pop( button );
|
|
379 |
|
|
380 |
button->SetMopParent( this );
|
|
381 |
button->SetParent( this );
|
|
382 |
button->SetContainerWindowL( *this );
|
|
383 |
button->SetObserver( this );
|
|
384 |
button->ActivateL();
|
|
385 |
}
|
|
386 |
DIALER_PRINT("KeyPadContainer::CreateButtonsL>");
|
|
387 |
}
|
|
388 |
|
|
389 |
// ---------------------------------------------------------------------------
|
|
390 |
// CDialerKeyPadContainer::HandleControlEventL
|
|
391 |
//
|
|
392 |
// Handles an event from an observed button item.
|
|
393 |
// Finds the pressed button and generates key press event, which
|
|
394 |
// is handled by parent control.
|
|
395 |
//
|
|
396 |
// ---------------------------------------------------------------------------
|
|
397 |
//
|
|
398 |
void CDialerKeyPadContainer::HandleControlEventL( CCoeControl* aControl,
|
|
399 |
TCoeEvent aEventType )
|
|
400 |
{
|
|
401 |
DIALER_PRINTF("KeyPadContainer::HandleControlEventL.EventType=",
|
|
402 |
(TInt)aEventType);
|
|
403 |
|
|
404 |
if ( aEventType == EEventStateChanged ||
|
|
405 |
aEventType == EEventRequestCancel ||
|
|
406 |
aEventType == EEventRequestExit ||
|
|
407 |
aEventType == CDialerKeyPadButton::EEventDraggingOutsideButton )
|
|
408 |
|
|
409 |
{
|
|
410 |
// Find tapped control
|
|
411 |
|
|
412 |
CDialerKeyPadButton* tappedButton = NULL;
|
|
413 |
for ( TInt i=0; i < iButtons.Count(); i++ )
|
|
414 |
{
|
|
415 |
if ( iButtons[i] == aControl )
|
|
416 |
{
|
|
417 |
tappedButton = iButtons[i];
|
|
418 |
break;
|
|
419 |
}
|
|
420 |
}
|
|
421 |
|
|
422 |
if ( !tappedButton )
|
|
423 |
{
|
|
424 |
__ASSERT_DEBUG( EFalse, DialerPanic( EDialerPanicEventFromUnknownControl ) );
|
|
425 |
return;
|
|
426 |
}
|
|
427 |
|
|
428 |
// Send key event to phone.
|
|
429 |
TKeyEvent keyEvent;
|
|
430 |
keyEvent.iCode = 0; // iCode should be 0 for all but EEventKey type of events
|
|
431 |
keyEvent.iScanCode = tappedButton->ScanCode();
|
|
432 |
keyEvent.iModifiers = ( EModifierNumLock | EModifierKeypad ); // Mark that this event is dialer simulated
|
|
433 |
keyEvent.iRepeats = 0;
|
|
434 |
|
|
435 |
switch ( aEventType )
|
|
436 |
{
|
|
437 |
case EEventRequestExit:
|
|
438 |
case EEventRequestCancel:
|
|
439 |
{
|
|
440 |
DIALER_PRINT("HandleControlEventL.EEventRequestExit");
|
|
441 |
iButtonPressedDown = EFalse;
|
|
442 |
if ( !iKeyUpSimulatedDueToDragging )
|
|
443 |
{
|
|
444 |
ControlEnv()->SimulateKeyEventL( keyEvent, EEventKeyUp );
|
|
445 |
}
|
|
446 |
iKeyUpSimulatedDueToDragging = EFalse;
|
|
447 |
}
|
|
448 |
break;
|
|
449 |
|
|
450 |
case EEventStateChanged:
|
|
451 |
{
|
|
452 |
DIALER_PRINT("HandleControlEventL.EEventStateChanged");
|
|
453 |
iButtonPressedDown = ETrue;
|
|
454 |
iParentControl.PrepareForFocusGainL();
|
|
455 |
|
|
456 |
ControlEnv()->SimulateKeyEventL( keyEvent, EEventKeyDown );
|
|
457 |
|
|
458 |
if ( iButtonPressedDown )
|
|
459 |
{
|
|
460 |
// Send event key if key havent be lifted up already
|
|
461 |
keyEvent.iCode = tappedButton->KeyCode();
|
|
462 |
ControlEnv()->SimulateKeyEventL( keyEvent, EEventKey );
|
|
463 |
}
|
|
464 |
}
|
|
465 |
break;
|
|
466 |
|
|
467 |
case CDialerKeyPadButton::EEventDraggingOutsideButton:
|
|
468 |
{
|
|
469 |
DIALER_PRINT("HandleControlEventL.EEventDraggingOutsideButton");
|
|
470 |
// User hasn't released touch yet but in order to cancel
|
|
471 |
// long press action handled and initiated by parent control,
|
|
472 |
// we must send key up event now.
|
|
473 |
if ( !iKeyUpSimulatedDueToDragging )
|
|
474 |
{
|
|
475 |
ControlEnv()->SimulateKeyEventL( keyEvent, EEventKeyUp );
|
|
476 |
iKeyUpSimulatedDueToDragging = ETrue;
|
|
477 |
}
|
|
478 |
}
|
|
479 |
break;
|
|
480 |
|
|
481 |
default:
|
|
482 |
break;
|
|
483 |
}
|
|
484 |
}
|
|
485 |
DIALER_PRINT("KeyPadContainer::HandleControlEventL>");
|
|
486 |
}
|
|
487 |
|
|
488 |
// ---------------------------------------------------------------------------
|
|
489 |
// CDialerKeyPadContainer::HandleResourceChange
|
|
490 |
//
|
|
491 |
// Forwards skin change event to buttons
|
|
492 |
//
|
|
493 |
// ---------------------------------------------------------------------------
|
|
494 |
//
|
|
495 |
void CDialerKeyPadContainer::HandleResourceChange( TInt aType )
|
|
496 |
{
|
|
497 |
if ( aType == KAknsMessageSkinChange )
|
|
498 |
{
|
|
499 |
for ( TInt i=0; i < iButtons.Count(); i++ )
|
|
500 |
{
|
|
501 |
iButtons[i]->HandleResourceChange( aType );
|
|
502 |
}
|
|
503 |
}
|
|
504 |
}
|
|
505 |
|
|
506 |
// ---------------------------------------------------------------------------
|
|
507 |
// CDialerKeyPadContainer::MakeVisible
|
|
508 |
//
|
|
509 |
// Called when dialer control becomes visible or invisible
|
|
510 |
//
|
|
511 |
// ---------------------------------------------------------------------------
|
|
512 |
//
|
|
513 |
void CDialerKeyPadContainer::MakeVisible( TBool aVisible )
|
|
514 |
{
|
|
515 |
// This is needed when dialer control disappeares during keypress.
|
|
516 |
// Last pressed pointer event must be forwarted to framework
|
|
517 |
// as pointer up event. Thus button is set to unpressed state etc.
|
|
518 |
// This code calls HandlePointerEventL of the parent class instead of this.
|
|
519 |
// If we call this classes HandlePointerEventL, this classes
|
|
520 |
// grab status is not cleared, and later coming EButton1Up events may end
|
|
521 |
// up erroneously to this class, although intended elsewhere.
|
|
522 |
//
|
|
523 |
if ( !aVisible && iButtonPressedDown && Parent() )
|
|
524 |
{
|
|
525 |
iPointerEvent.iType = TPointerEvent::EButton1Up;
|
|
526 |
TRAP_IGNORE( Parent()->HandlePointerEventL( iPointerEvent ) );
|
|
527 |
}
|
|
528 |
CCoeControl::MakeVisible( aVisible );
|
|
529 |
}
|
|
530 |
|
|
531 |
// ---------------------------------------------------------------------------
|
|
532 |
// CDialerKeyPadContainer::SetOperationMode
|
|
533 |
//
|
|
534 |
// Set new operation mode for the keypad
|
|
535 |
//
|
|
536 |
// ---------------------------------------------------------------------------
|
|
537 |
//
|
|
538 |
void CDialerKeyPadContainer::SetOperationMode( TDialerOperationMode aOperatingMode )
|
|
539 |
{
|
|
540 |
iOperatingMode = aOperatingMode;
|
|
541 |
}
|
|
542 |
|
|
543 |
// ---------------------------------------------------------------------------
|
|
544 |
// CDialerKeyPadContainer::HandleGainingForeground
|
|
545 |
//
|
|
546 |
//
|
|
547 |
// ---------------------------------------------------------------------------
|
|
548 |
//
|
|
549 |
void CDialerKeyPadContainer::HandleGainingForeground()
|
|
550 |
{
|
|
551 |
|
|
552 |
}
|
|
553 |
|
|
554 |
// ---------------------------------------------------------------------------
|
|
555 |
// CDialerKeyPadContainer::HandleLosingForeground
|
|
556 |
//
|
|
557 |
//
|
|
558 |
// ---------------------------------------------------------------------------
|
|
559 |
//
|
|
560 |
void CDialerKeyPadContainer::HandleLosingForeground()
|
|
561 |
{
|
|
562 |
// This is needed when dialer control disappeares during keypress.
|
|
563 |
// Last pressed pointer event must be forwarted to framework
|
|
564 |
// as pointer up event. Thus button is set to unpressed state etc.
|
|
565 |
// This code calls HandlePointerEventL of the parent class instead of this.
|
|
566 |
// If we call this classes HandlePointerEventL, this classes
|
|
567 |
// grab status is not cleared, and later coming EButton1Up events may end
|
|
568 |
// up erroneously to this class, although intended elsewhere.
|
|
569 |
//
|
|
570 |
if ( iButtonPressedDown && Parent() )
|
|
571 |
{
|
|
572 |
iPointerEvent.iType = TPointerEvent::EButton1Up;
|
|
573 |
TRAP_IGNORE( Parent()->HandlePointerEventL( iPointerEvent ) );
|
|
574 |
}
|
|
575 |
}
|
|
576 |
|
|
577 |
// ---------------------------------------------------------------------------
|
|
578 |
// CDialerKeyPadContainer::KeyLabelsChanged
|
|
579 |
//
|
|
580 |
// Reset button labels and update the layout
|
|
581 |
// ---------------------------------------------------------------------------
|
|
582 |
//
|
|
583 |
void CDialerKeyPadContainer::KeyLabelsChanged()
|
|
584 |
{
|
|
585 |
for ( TInt i = 0 ; i < iButtons.Count() ; i++ )
|
|
586 |
{
|
|
587 |
const TPtrC numLabel = iKeyLabelManager->ButtonNumLabel( i );
|
|
588 |
const TPtrC alphaLabel = iKeyLabelManager->ButtonFirstAlphaLabel( i );
|
|
589 |
const TPtrC secondAlphaLabel = iKeyLabelManager->ButtonSecondAlphaLabel( i );
|
|
590 |
|
|
591 |
iButtons[i]->SetNumLabel( numLabel );
|
|
592 |
iButtons[i]->SetPrimaryAlphaLabel( alphaLabel );
|
|
593 |
iButtons[i]->SetSecondaryAlphaLabel( secondAlphaLabel );
|
|
594 |
|
|
595 |
// reset layout
|
|
596 |
iButtons[i]->SetSize( iButtons[i]->Size() );
|
|
597 |
}
|
|
598 |
DrawDeferred();
|
|
599 |
}
|
|
600 |
|
|
601 |
// ---------------------------------------------------------------------------
|
|
602 |
// CDialerKeyPadContainer::EnableTactileFeedback
|
|
603 |
//
|
|
604 |
//
|
|
605 |
// ---------------------------------------------------------------------------
|
|
606 |
//
|
|
607 |
void CDialerKeyPadContainer::EnableTactileFeedback( const TBool aEnable )
|
|
608 |
{
|
|
609 |
for ( TInt i=0; i < iButtons.Count(); i++ )
|
|
610 |
{
|
|
611 |
iButtons[i]->EnableAudioFeedback( aEnable );
|
|
612 |
}
|
|
613 |
|
|
614 |
}
|
|
615 |
// End of File
|