1 /* |
|
2 * Copyright (c) 2000 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: Manual tuning dialog for FMRadio |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <aknappui.h> |
|
21 #include <AknsFrameBackgroundControlContext.h> |
|
22 #include <aknbutton.h> |
|
23 #include <AknLayoutDef.h> |
|
24 #include <AknLayout2ScalableDef.h> |
|
25 #include <aknlayoutscalable_avkon.cdl.h> |
|
26 #include <avkon.mbg> |
|
27 #include <avkon.rsg> |
|
28 #include <barsread.h> |
|
29 #include <eiklabel.h> |
|
30 #include <skinlayout.cdl.h> |
|
31 #include <AknsDrawUtils.h> |
|
32 #include <StringLoader.h> |
|
33 #include <aknconsts.h> |
|
34 #include <fmradio.rsg> |
|
35 |
|
36 #include "fmradiofrequencyquerycontrol.h" |
|
37 #include "fmradiofrequencyeditor.h" |
|
38 #include "fmradio.hrh" |
|
39 #include "debug.h" |
|
40 |
|
41 // CONSTANTS |
|
42 |
|
43 const TInt KFMRadioButtonLongPressDelay = 450; //microseconds after long press event is reported |
|
44 const TInt KFMRadioButtonRepeatDelay = 500; //microseconds after repeat event is reported |
|
45 const TInt KFMRadioButtonRepeatInterval = 200; //microseconds after repeat event is repeated |
|
46 const TInt KFMRadioButtonRepeatDelayMicroseconds(KFMRadioButtonRepeatDelay*1000); |
|
47 const TInt KFMRadioButtonRepeatIntervalMicrosecondsAccelerated(KFMRadioButtonRepeatInterval*500); |
|
48 const TInt KFMRadioButtonRepeatAccelerationDelay(2000000); //Two seconds until accelerate long press repeat |
|
49 |
|
50 const TInt KEditorFrameCustomLRMargins = 50; |
|
51 const TInt KEditorFrameCustomAdditionHeight = 30; |
|
52 |
|
53 const TInt KFMRadioEditorCustomInnerFrameSize = 15; |
|
54 const TInt KFMRadioEditorCustomButtonMarginToLeftFrame = 1; |
|
55 const TInt KFMRadioEditorCustomButtonSize = 16; |
|
56 |
|
57 |
|
58 // ================= MEMBER FUNCTIONS ======================= |
|
59 |
|
60 // C++ default constructor can NOT contain any code, that |
|
61 // might leave. |
|
62 // |
|
63 CFMRadioFrequencyQueryControl::CFMRadioFrequencyQueryControl() : CAknQueryControl() |
|
64 { |
|
65 } |
|
66 |
|
67 // Destructor |
|
68 CFMRadioFrequencyQueryControl::~CFMRadioFrequencyQueryControl() |
|
69 { |
|
70 if (iFreqEditor) |
|
71 AknsUtils::DeregisterControlPosition(iFreqEditor); |
|
72 delete iFreqEditor; |
|
73 delete iMyPrompt; |
|
74 delete iMyEditorIndicator; |
|
75 delete iEditorContext; |
|
76 |
|
77 if ( iLongPressAccelerationTimer ) |
|
78 { |
|
79 iLongPressAccelerationTimer->Cancel(); |
|
80 delete iLongPressAccelerationTimer; |
|
81 } |
|
82 if ( iLongPressTimer) |
|
83 { |
|
84 iLongPressTimer->Cancel(); |
|
85 delete iLongPressTimer; |
|
86 } |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------- |
|
90 // CFMRadioFrequencyQueryControl::StaticCreateCustomControl |
|
91 // --------------------------------------------------------- |
|
92 // |
|
93 SEikControlInfo CFMRadioFrequencyQueryControl::StaticCreateCustomControl(TInt aIdentifier) |
|
94 { |
|
95 FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyQueryControl::StaticCreateCustomControl -- ENTER") ) ); |
|
96 SEikControlInfo customInfo; |
|
97 Mem::FillZ(&customInfo, sizeof(SEikControlInfo)); // zero all variables |
|
98 |
|
99 if (aIdentifier == EFMRadioCtFrequencyQuery) |
|
100 { |
|
101 customInfo.iControl = new CFMRadioFrequencyQueryControl; |
|
102 } |
|
103 |
|
104 FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyQueryControl::StaticCreateCustomControl -- EXIT") ) ); |
|
105 return customInfo; |
|
106 } |
|
107 |
|
108 // --------------------------------------------------------- |
|
109 // CFMRadioFrequencyQueryControl::ConstructQueryL |
|
110 // --------------------------------------------------------- |
|
111 // |
|
112 void CFMRadioFrequencyQueryControl::ConstructQueryL(TResourceReader& aRes) |
|
113 { |
|
114 |
|
115 iFreqEditor = new (ELeave) CFMRadioFrequencyEditor; |
|
116 iFreqEditor->SetContainerWindowL(*this); |
|
117 iFreqEditor->ConstructFromResourceL(aRes); |
|
118 iFreqEditor->SetObserver(this); |
|
119 iFreqEditor->SetSkinTextColorL( EAknsCIQsnTextColorsCG27 );//query text input field |
|
120 |
|
121 iMyPrompt = new (ELeave) CEikLabel; |
|
122 iMyPrompt->SetContainerWindowL( *this ); |
|
123 HBufC* promptTxt = StringLoader::LoadLC( R_QTN_FMRADIO_MANUAL_TUNE_FREQ ); |
|
124 iMyPrompt->SetTextL( *promptTxt ); |
|
125 CleanupStack::PopAndDestroy( promptTxt ); |
|
126 |
|
127 iMyEditorIndicator = CFMRadioManualTuningEditorIndicator::NewL( this ); |
|
128 |
|
129 // Construct editor context |
|
130 iEditorContext = CAknsFrameBackgroundControlContext::NewL( |
|
131 KAknsIIDQsnFrInput, TRect(0,0,1,1), TRect(0,0,1,1), EFalse ); |
|
132 |
|
133 if ( AknLayoutUtils::PenEnabled() ) |
|
134 { |
|
135 // Buttons with correct icons |
|
136 iIncreaseValueButton = |
|
137 CAknButton::NewL(KAvkonBitmapFile, |
|
138 EMbmAvkonQgn_indi_button_increase, |
|
139 EMbmAvkonQgn_indi_button_increase_mask, |
|
140 -1, |
|
141 -1, |
|
142 EMbmAvkonQgn_indi_button_increase_pressed, |
|
143 EMbmAvkonQgn_indi_button_increase_pressed_mask, |
|
144 -1, |
|
145 -1, |
|
146 KNullDesC, |
|
147 KNullDesC, |
|
148 KAknButtonNoFrame /*| KAknButtonKeyRepeat*/ | KAknButtonReportOnLongPress, |
|
149 0, |
|
150 KAknsIIDQgnIndiButtonIncrease, |
|
151 KAknsIIDNone, |
|
152 KAknsIIDQgnIndiButtonIncreasePressed, |
|
153 KAknsIIDNone ); |
|
154 iIncreaseValueButton->SetContainerWindowL(*this); |
|
155 iIncreaseValueButton->SetParent(this); |
|
156 iIncreaseValueButton->SetObserver(this); |
|
157 iIncreaseValueButton->MakeVisible(ETrue); |
|
158 iIncreaseValueButton->SetFocusing(EFalse); |
|
159 iIncreaseValueButton->SetKeyRepeatInterval( KFMRadioButtonRepeatDelay, KFMRadioButtonRepeatInterval ); |
|
160 iIncreaseValueButton->SetLongPressInterval( KFMRadioButtonLongPressDelay ); |
|
161 |
|
162 iDecreaseValueButton = |
|
163 CAknButton::NewL(KAvkonBitmapFile, |
|
164 EMbmAvkonQgn_indi_button_decrease, |
|
165 EMbmAvkonQgn_indi_button_decrease_mask, |
|
166 -1, |
|
167 -1, |
|
168 EMbmAvkonQgn_indi_button_decrease_pressed, |
|
169 EMbmAvkonQgn_indi_button_decrease_pressed_mask, |
|
170 -1, |
|
171 -1, |
|
172 KNullDesC, |
|
173 KNullDesC, |
|
174 KAknButtonNoFrame /*| KAknButtonKeyRepeat*/ | KAknButtonReportOnLongPress, |
|
175 0, |
|
176 KAknsIIDQgnIndiButtonDecrease, |
|
177 KAknsIIDNone, |
|
178 KAknsIIDQgnIndiButtonDecreasePressed, |
|
179 KAknsIIDNone ); |
|
180 iDecreaseValueButton->SetContainerWindowL(*this); |
|
181 iDecreaseValueButton->SetParent(this); |
|
182 iDecreaseValueButton->SetObserver(this); |
|
183 iDecreaseValueButton->MakeVisible(ETrue); |
|
184 iDecreaseValueButton->SetFocusing(EFalse); |
|
185 iDecreaseValueButton->SetKeyRepeatInterval( KFMRadioButtonRepeatDelay, KFMRadioButtonRepeatInterval ); |
|
186 iDecreaseValueButton->SetLongPressInterval( KFMRadioButtonLongPressDelay ); |
|
187 } |
|
188 |
|
189 iLongPressAccelerationTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
190 iLongPressTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
191 } |
|
192 |
|
193 // --------------------------------------------------------- |
|
194 // CFMRadioFrequencyQueryControl::ComponentControl |
|
195 // --------------------------------------------------------- |
|
196 // |
|
197 CCoeControl* CFMRadioFrequencyQueryControl::ComponentControl(TInt aIndex) const |
|
198 { |
|
199 /*lint -save -e1763*/ |
|
200 CCoeControl* ccontrol = NULL; |
|
201 |
|
202 switch (aIndex) |
|
203 { |
|
204 case 0: |
|
205 { |
|
206 ccontrol = iMyPrompt; |
|
207 break; |
|
208 } |
|
209 case 1: |
|
210 { |
|
211 ccontrol = iMyEditorIndicator; |
|
212 break; |
|
213 } |
|
214 case 2: |
|
215 { |
|
216 ccontrol = iFreqEditor; |
|
217 break; |
|
218 } |
|
219 case 3: |
|
220 { |
|
221 if ( AknLayoutUtils::PenEnabled() ) |
|
222 { |
|
223 ccontrol = iIncreaseValueButton; |
|
224 } |
|
225 break; |
|
226 } |
|
227 |
|
228 case 4: |
|
229 { |
|
230 if ( AknLayoutUtils::PenEnabled() ) |
|
231 { |
|
232 ccontrol = iDecreaseValueButton; |
|
233 } |
|
234 break; |
|
235 } |
|
236 |
|
237 default: |
|
238 { |
|
239 ccontrol = NULL; |
|
240 break; |
|
241 } |
|
242 } |
|
243 return ccontrol; |
|
244 /*lint -restore*/ |
|
245 } |
|
246 |
|
247 // --------------------------------------------------------- |
|
248 // CFMRadioFrequencyQueryControl::CountComponentControls |
|
249 // --------------------------------------------------------- |
|
250 // |
|
251 TInt CFMRadioFrequencyQueryControl::CountComponentControls() const |
|
252 { |
|
253 if ( AknLayoutUtils::PenEnabled() ) |
|
254 { |
|
255 return 5; |
|
256 } |
|
257 else |
|
258 { |
|
259 return 3; |
|
260 } |
|
261 } |
|
262 |
|
263 // --------------------------------------------------------- |
|
264 // CFMRadioFrequencyQueryControl::FocusChanged |
|
265 // --------------------------------------------------------- |
|
266 // |
|
267 void CFMRadioFrequencyQueryControl::FocusChanged(TDrawNow aDrawNow) |
|
268 { |
|
269 if (iFreqEditor) |
|
270 { |
|
271 iFreqEditor->SetFocus(IsFocused(), aDrawNow); |
|
272 SizeChanged(); |
|
273 } |
|
274 } |
|
275 |
|
276 // --------------------------------------------------------- |
|
277 // CFMRadioFrequencyQueryControl::PrepareForFocusLossL |
|
278 // --------------------------------------------------------- |
|
279 // |
|
280 void CFMRadioFrequencyQueryControl::PrepareForFocusLossL() |
|
281 { |
|
282 if (iFreqEditor) |
|
283 { |
|
284 iFreqEditor->PrepareForFocusLossL(); |
|
285 } |
|
286 } |
|
287 |
|
288 // --------------------------------------------------------- |
|
289 // CFMRadioFrequencyQueryControl::SetAcceleratedLongPress |
|
290 // --------------------------------------------------------- |
|
291 // |
|
292 void CFMRadioFrequencyQueryControl::SetAcceleratedLongPress(TBool aAccelerated) |
|
293 { |
|
294 iLongPressAccelerationTimer->Cancel(); |
|
295 iLongPressTimer->Cancel(); |
|
296 |
|
297 if( aAccelerated) |
|
298 { |
|
299 //add more speed |
|
300 iLongPressTimer->Start(KFMRadioButtonRepeatIntervalMicrosecondsAccelerated, |
|
301 KFMRadioButtonRepeatIntervalMicrosecondsAccelerated, |
|
302 TCallBack(LongPressTimerCallBack, this)); |
|
303 } |
|
304 } |
|
305 |
|
306 // --------------------------------------------------------- |
|
307 // CFMRadioFrequencyQueryControl::LongPressAccelerateCallBack |
|
308 // --------------------------------------------------------- |
|
309 // |
|
310 TInt CFMRadioFrequencyQueryControl::LongPressAccelerateCallBack( TAny* aAny ) |
|
311 { |
|
312 ((CFMRadioFrequencyQueryControl*)(aAny))->SetAcceleratedLongPress(ETrue); |
|
313 return KErrNone; |
|
314 } |
|
315 |
|
316 // --------------------------------------------------------- |
|
317 // CFMRadioFrequencyQueryControl::LongPressTimerCallBack |
|
318 // --------------------------------------------------------- |
|
319 // |
|
320 TInt CFMRadioFrequencyQueryControl::LongPressTimerCallBack( TAny* aAny ) |
|
321 { |
|
322 ((CFMRadioFrequencyQueryControl*)(aAny))->DoIncrementOrDecrement(); |
|
323 return KErrNone; |
|
324 } |
|
325 |
|
326 // --------------------------------------------------------- |
|
327 // CFMRadioFrequencyQueryControl::DoIncrementOrDecrement |
|
328 // --------------------------------------------------------- |
|
329 // |
|
330 void CFMRadioFrequencyQueryControl::DoIncrementOrDecrement() |
|
331 { |
|
332 if(iChangeDirectionIncrease) |
|
333 { |
|
334 iFreqEditor->IncrementCurrentField(); |
|
335 } |
|
336 else |
|
337 { |
|
338 iFreqEditor->DecrementCurrentField(); |
|
339 } |
|
340 |
|
341 iKeyPressReported = ETrue; |
|
342 } |
|
343 |
|
344 // --------------------------------------------------------- |
|
345 // CFMRadioFrequencyQueryControl::StartKeypress |
|
346 // --------------------------------------------------------- |
|
347 // |
|
348 void CFMRadioFrequencyQueryControl::StartKeypress() |
|
349 { |
|
350 iKeyPressReported = EFalse; |
|
351 iLongPressAccelerationTimer->Cancel(); |
|
352 iLongPressAccelerationTimer->Start(KFMRadioButtonRepeatAccelerationDelay, 0, |
|
353 TCallBack(LongPressAccelerateCallBack, this)); |
|
354 |
|
355 iLongPressTimer->Cancel(); |
|
356 iLongPressTimer->Start(KFMRadioButtonRepeatDelayMicroseconds, |
|
357 KFMRadioButtonRepeatDelayMicroseconds, |
|
358 TCallBack(LongPressTimerCallBack, this)); |
|
359 iFreqEditor->SetEditorReportState( EFalse ); |
|
360 } |
|
361 |
|
362 // --------------------------------------------------------- |
|
363 // CFMRadioFrequencyQueryControl::OfferKeyEventL |
|
364 // --------------------------------------------------------- |
|
365 // |
|
366 TKeyResponse CFMRadioFrequencyQueryControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
367 { |
|
368 if ( aType == EEventKeyDown && |
|
369 (aKeyEvent.iScanCode == EStdKeyUpArrow || aKeyEvent.iScanCode == EStdKeyDownArrow) ) |
|
370 { |
|
371 iChangeDirectionIncrease = (aKeyEvent.iScanCode == EStdKeyUpArrow); |
|
372 StartKeypress(); |
|
373 |
|
374 return EKeyWasConsumed; |
|
375 } |
|
376 else if ( aType == EEventKeyUp && |
|
377 (aKeyEvent.iScanCode == EStdKeyUpArrow || aKeyEvent.iScanCode == EStdKeyDownArrow) ) |
|
378 { |
|
379 if(!iKeyPressReported) |
|
380 { |
|
381 //was not a long press |
|
382 DoIncrementOrDecrement(); |
|
383 } |
|
384 |
|
385 SetAcceleratedLongPress(EFalse); |
|
386 iFreqEditor->SetEditorReportState( ETrue ); |
|
387 iFreqEditor->DrawAndReportL( EFalse ); |
|
388 |
|
389 return EKeyWasConsumed; |
|
390 } |
|
391 |
|
392 //eat all up and down events, this is for EEventKey |
|
393 if(aKeyEvent.iScanCode == EStdKeyUpArrow || aKeyEvent.iScanCode == EStdKeyDownArrow) |
|
394 { |
|
395 return EKeyWasConsumed; |
|
396 } |
|
397 |
|
398 return iFreqEditor->OfferKeyEventL(aKeyEvent, aType); |
|
399 } |
|
400 |
|
401 // --------------------------------------------------------- |
|
402 // CFMRadioFrequencyQueryControl::HandleControlEventL |
|
403 // --------------------------------------------------------- |
|
404 // |
|
405 void CFMRadioFrequencyQueryControl::HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType) |
|
406 { |
|
407 if ( aEventType == CAknButton::ELongPressEndedEvent ) |
|
408 { |
|
409 SetAcceleratedLongPress(EFalse); |
|
410 iFreqEditor->SetEditorReportState( ETrue ); |
|
411 iFreqEditor->DrawAndReportL( EFalse ); |
|
412 } |
|
413 |
|
414 if ( (aControl == iIncreaseValueButton || aControl == iDecreaseValueButton ) |
|
415 && aEventType == CAknButton::ELongPressEvent ) |
|
416 { |
|
417 iChangeDirectionIncrease = (aControl == iIncreaseValueButton); |
|
418 StartKeypress(); |
|
419 return; |
|
420 } |
|
421 |
|
422 //single presses |
|
423 if ( aControl == iIncreaseValueButton && aEventType == EEventStateChanged ) |
|
424 { |
|
425 iFreqEditor->IncrementCurrentField(); |
|
426 return; |
|
427 } |
|
428 |
|
429 else if ( aControl == iDecreaseValueButton && aEventType == EEventStateChanged ) |
|
430 { |
|
431 iFreqEditor->DecrementCurrentField(); |
|
432 return; |
|
433 } |
|
434 |
|
435 //finally tune to the frequency |
|
436 if (iQueryControlObserver && aEventType == EEventStateChanged) |
|
437 { |
|
438 if ( iFreqEditor->IsValidToReport() ) |
|
439 { |
|
440 MAknQueryControlObserver::TQueryValidationStatus validity = MAknQueryControlObserver::EEditorValueValid; |
|
441 if ( !iFreqEditor->IsValid() ) |
|
442 { |
|
443 validity = MAknQueryControlObserver::EEditorValueNotParsed; |
|
444 } |
|
445 iQueryControlObserver->HandleQueryEditorStateEventL( this, MAknQueryControlObserver::EQueryControlEditorStateChanging, validity ); |
|
446 } |
|
447 } |
|
448 } |
|
449 |
|
450 // --------------------------------------------------------- |
|
451 // CFMRadioFrequencyQueryControl::SetFrequency |
|
452 // --------------------------------------------------------- |
|
453 // |
|
454 void CFMRadioFrequencyQueryControl::SetFrequency(const TUint32 aFreq) |
|
455 { |
|
456 if (iFreqEditor) |
|
457 { |
|
458 iFreqEditor->SetFrequency(aFreq); |
|
459 } |
|
460 } |
|
461 |
|
462 // --------------------------------------------------------- |
|
463 // CFMRadioFrequencyQueryControl::Frequency |
|
464 // --------------------------------------------------------- |
|
465 // |
|
466 TUint32 CFMRadioFrequencyQueryControl::Frequency() const |
|
467 { |
|
468 if (iFreqEditor) |
|
469 { |
|
470 return iFreqEditor->Frequency(); |
|
471 } |
|
472 return 0; |
|
473 } |
|
474 |
|
475 // --------------------------------------------------------- |
|
476 // CFMRadioFrequencyQueryControl::ControlByLayoutOrNull |
|
477 // --------------------------------------------------------- |
|
478 // |
|
479 CCoeControl* CFMRadioFrequencyQueryControl::ControlByLayoutOrNull(TInt /*aLayout*/) |
|
480 { |
|
481 return iFreqEditor; |
|
482 } |
|
483 |
|
484 // --------------------------------------------------------- |
|
485 // CFMRadioFrequencyQueryControl::EditorContentIsValidL |
|
486 // --------------------------------------------------------- |
|
487 // |
|
488 TBool CFMRadioFrequencyQueryControl::EditorContentIsValidL() const |
|
489 { |
|
490 TInt ret = EFalse; |
|
491 if (iFreqEditor) |
|
492 { |
|
493 CEikMfne* editor = iFreqEditor; |
|
494 ret = editor->Field(editor->CurrentField())->IsValid(); |
|
495 } |
|
496 return ret; |
|
497 } |
|
498 |
|
499 // --------------------------------------------------------- |
|
500 // CFMRadioFrequencyQueryControl::SetAndUseFlags |
|
501 // --------------------------------------------------------- |
|
502 // |
|
503 void CFMRadioFrequencyQueryControl::SetAndUseFlags(TBitFlags16 aFlags) |
|
504 { |
|
505 iFlags = aFlags; |
|
506 iMyEditorIndicator->SetFlags(aFlags); |
|
507 } |
|
508 |
|
509 // --------------------------------------------------------- |
|
510 // CFMRadioFrequencyQueryControl::LayoutEditor |
|
511 // --------------------------------------------------------- |
|
512 // |
|
513 void CFMRadioFrequencyQueryControl::LayoutEditor(const TLayoutMethod& aLayoutM) |
|
514 { |
|
515 TIndex LAFIndex(NbrOfPromptLines()); |
|
516 iHasEditor = ETrue; |
|
517 LayoutEditorFrame(aLayoutM); |
|
518 LayoutEditorIndicator(aLayoutM); |
|
519 |
|
520 CEikMfne* edwin = NULL; |
|
521 |
|
522 if ( iFreqEditor ) |
|
523 { |
|
524 edwin = iFreqEditor; |
|
525 } |
|
526 |
|
527 if ( edwin ) |
|
528 { |
|
529 TInt variety( LAFIndex.PromptLine() ); |
|
530 if ( AknLayoutUtils::PenEnabled() ) |
|
531 { |
|
532 variety = NbrOfPromptLines() != 0 ? ( 6 - NbrOfPromptLines() ) : 5; |
|
533 } |
|
534 TAknWindowLineLayout lineLayout( AknLayoutScalable_Avkon::query_popup_pane( variety ) ); |
|
535 TAknTextComponentLayout textLayout( AknLayoutScalable_Avkon::query_popup_pane_t1() ); |
|
536 if ( KFMRadioFrequencyQueryDialogCustomAdditionHeight ) |
|
537 { |
|
538 lineLayout.it = iDialogSize.iHeight / 2 - lineLayout.iH / 2; |
|
539 } |
|
540 |
|
541 AknLayoutUtils::LayoutMfne( edwin, LayoutRect(), |
|
542 TAknWindowComponentLayout::ComposeText( |
|
543 lineLayout, |
|
544 textLayout ) ); |
|
545 |
|
546 |
|
547 edwin->SetBorder( TGulBorder::ENone ); |
|
548 if ( IsFocused() && !edwin->IsFocused() ) |
|
549 { |
|
550 edwin->SetFocus( ETrue ); |
|
551 } |
|
552 edwin->SetUpAndDownKeysConsumed( ETrue ); |
|
553 } |
|
554 } |
|
555 |
|
556 // --------------------------------------------------------- |
|
557 // CFMRadioFrequencyQueryControl::LayoutPrompt |
|
558 // --------------------------------------------------------- |
|
559 // |
|
560 void CFMRadioFrequencyQueryControl::LayoutPrompt(const TLayoutMethod& /*aLayoutM*/) |
|
561 { |
|
562 if (iMyPrompt) |
|
563 { |
|
564 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
565 TRgb color; |
|
566 TInt error = AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG19 ); |
|
567 |
|
568 AknLayoutUtils::LayoutLabel(iMyPrompt, LayoutRect(), AKN_LAYOUT_TEXT_Code_query_pop_up_window_texts_Line_1(0) ); |
|
569 |
|
570 if (!error) |
|
571 { |
|
572 TRAP_IGNORE(AknLayoutUtils::OverrideControlColorL( *iMyPrompt, EColorLabelText, color ) ) |
|
573 } |
|
574 } |
|
575 |
|
576 } |
|
577 |
|
578 // --------------------------------------------------------- |
|
579 // CFMRadioFrequencyQueryControl::LayoutImageOrAnim |
|
580 // --------------------------------------------------------- |
|
581 // |
|
582 void CFMRadioFrequencyQueryControl::LayoutImageOrAnim(const TLayoutMethod& /*aLayoutM*/) |
|
583 { |
|
584 } |
|
585 |
|
586 // --------------------------------------------------------- |
|
587 // CFMRadioFrequencyQueryControl::LayoutEditorFrame |
|
588 // --------------------------------------------------------- |
|
589 // |
|
590 void CFMRadioFrequencyQueryControl::LayoutEditorFrame(const TLayoutMethod& /*aLayoutM*/) |
|
591 { |
|
592 TIndex LAFIndex(NbrOfPromptLines()); |
|
593 TRect rect = LayoutRect(); |
|
594 |
|
595 TInt variety( LAFIndex.PromptLine() ); |
|
596 TAknWindowLineLayout lineLayout(AKN_LAYOUT_WINDOW_Code_query_pop_up_window_elements_Line_1( variety )); |
|
597 lineLayout.il += KEditorFrameCustomLRMargins; |
|
598 lineLayout.ir += KEditorFrameCustomLRMargins; |
|
599 lineLayout.it -= KEditorFrameCustomAdditionHeight/2; |
|
600 lineLayout.ib -= KEditorFrameCustomAdditionHeight/2; |
|
601 lineLayout.iH += KEditorFrameCustomAdditionHeight; |
|
602 if( KFMRadioFrequencyQueryDialogCustomAdditionHeight ) |
|
603 { |
|
604 lineLayout.it = iDialogSize.iHeight/ 2 - lineLayout.iH / 2; |
|
605 } |
|
606 iEditorVerShadow.LayoutRect( rect, lineLayout ); |
|
607 |
|
608 lineLayout = AKN_LAYOUT_WINDOW_Code_query_pop_up_window_elements_Line_2( variety ); |
|
609 lineLayout.il += KEditorFrameCustomLRMargins; |
|
610 lineLayout.ir += KEditorFrameCustomLRMargins; |
|
611 lineLayout.it -= KEditorFrameCustomAdditionHeight/2; |
|
612 lineLayout.ib -= KEditorFrameCustomAdditionHeight/2; |
|
613 lineLayout.iH += KEditorFrameCustomAdditionHeight; |
|
614 if( KFMRadioFrequencyQueryDialogCustomAdditionHeight ) |
|
615 { |
|
616 lineLayout.it = iDialogSize.iHeight/ 2 - lineLayout.iH / 2; |
|
617 } |
|
618 iEditorHorShadow.LayoutRect( rect, lineLayout ); |
|
619 |
|
620 // variety needs to be adjusted for touch layouts. |
|
621 if ( AknLayoutUtils::PenEnabled() ) |
|
622 { |
|
623 variety = NbrOfPromptLines() != 0 ? ( 6 - NbrOfPromptLines() ) : 5; |
|
624 } |
|
625 lineLayout = AknLayoutScalable_Avkon::query_popup_pane( variety ); |
|
626 lineLayout.il += KEditorFrameCustomLRMargins; |
|
627 lineLayout.ir += KEditorFrameCustomLRMargins; |
|
628 lineLayout.it -= KEditorFrameCustomAdditionHeight/2; |
|
629 lineLayout.ib -= KEditorFrameCustomAdditionHeight/2; |
|
630 lineLayout.iH += KEditorFrameCustomAdditionHeight; |
|
631 if( KFMRadioFrequencyQueryDialogCustomAdditionHeight ) |
|
632 { |
|
633 lineLayout.it = iDialogSize.iHeight/ 2 - lineLayout.iH / 2; |
|
634 } |
|
635 iEditorFrame.LayoutRect( rect, lineLayout ); |
|
636 iFreqEditor->SetEditorFrameRect( iEditorFrame.Rect() ); |
|
637 } |
|
638 |
|
639 // --------------------------------------------------------- |
|
640 // CFMRadioFrequencyQueryControl::LayoutEditorIndicator |
|
641 // --------------------------------------------------------- |
|
642 // |
|
643 void CFMRadioFrequencyQueryControl::LayoutEditorIndicator(const TLayoutMethod& /*aLayoutM*/) |
|
644 { |
|
645 TIndex LAFIndex(NbrOfPromptLines()); |
|
646 |
|
647 if (!iMyEditorIndicator) |
|
648 return; |
|
649 |
|
650 TInt variety( LAFIndex.PromptLine() ); |
|
651 if ( AknLayoutUtils::PenEnabled() ) |
|
652 { |
|
653 // adjust layout variety for touch |
|
654 variety = 5 - variety; |
|
655 } |
|
656 TAknWindowLineLayout lineLayout(AknLayoutScalable_Avkon::indicator_popup_pane( variety )); |
|
657 lineLayout.ir += KEditorFrameCustomLRMargins; |
|
658 lineLayout.it -= KEditorFrameCustomAdditionHeight/2; |
|
659 if( KFMRadioFrequencyQueryDialogCustomAdditionHeight ) |
|
660 { |
|
661 lineLayout.it = iDialogSize.iHeight / 2 - lineLayout.iH - iEditorFrame.Rect().Height()/2; |
|
662 } |
|
663 AknLayoutUtils::LayoutControl(iMyEditorIndicator, LayoutRect(), lineLayout ); |
|
664 } |
|
665 |
|
666 // --------------------------------------------------------- |
|
667 // CFMRadioFrequencyQueryControl::LayoutRect |
|
668 // --------------------------------------------------------- |
|
669 // |
|
670 TRect CFMRadioFrequencyQueryControl::LayoutRect() |
|
671 { |
|
672 TPoint topLeft = Position(); |
|
673 TRect parent( TPoint(0,0), iDialogSize ); |
|
674 TAknLayoutRect layout; |
|
675 |
|
676 layout.LayoutRect(parent, AKN_LAYOUT_WINDOW_Note_pop_up_window_graphics_Line_5(parent)); |
|
677 |
|
678 TRect rect(layout.Rect()); |
|
679 topLeft.iX -= rect.iTl.iX; |
|
680 topLeft.iY -= rect.iTl.iY; |
|
681 |
|
682 TPoint bottomRight (topLeft); |
|
683 TSize size (iDialogSize); |
|
684 bottomRight.iY += size.iHeight; |
|
685 bottomRight.iX += size.iWidth; |
|
686 return TRect(topLeft,bottomRight); |
|
687 } |
|
688 |
|
689 // --------------------------------------------------------- |
|
690 // CFMRadioFrequencyQueryControl::SetLineWidthsL |
|
691 // --------------------------------------------------------- |
|
692 // |
|
693 void CFMRadioFrequencyQueryControl::SetLineWidthsL() |
|
694 { |
|
695 if (!iLineWidths) |
|
696 return; |
|
697 |
|
698 iLineWidths->Reset(); |
|
699 TAknWindowLineLayout lineLayout(AknLayoutScalable_Avkon::popup_query_code_window(0)); |
|
700 if( KFMRadioFrequencyQueryDialogCustomAdditionHeight ) |
|
701 lineLayout.it += KFMRadioFrequencyQueryDialogCustomAdditionHeight / 2; |
|
702 |
|
703 TAknLayoutRect parentLayoutRect; |
|
704 parentLayoutRect.LayoutRect(iAvkonAppUi->ClientRect(), lineLayout); |
|
705 |
|
706 TAknLayoutText textRect; |
|
707 for (TInt i = 0; i < 3; i++) |
|
708 { |
|
709 TAknTextLineLayout textLineLayout = AKN_LAYOUT_TEXT_Code_query_pop_up_window_texts_Line_1(i); |
|
710 if ( KFMRadioFrequencyQueryDialogCustomAdditionHeight ) |
|
711 { |
|
712 textLineLayout.iB -= KFMRadioFrequencyQueryDialogCustomAdditionHeight / 2; |
|
713 } |
|
714 textRect.LayoutText(parentLayoutRect.Rect(), textLineLayout); |
|
715 iLineWidths->AppendL(textRect.TextRect().Width()); |
|
716 } |
|
717 } |
|
718 |
|
719 // --------------------------------------------------------- |
|
720 // CFMRadioFrequencyQueryControl::Draw |
|
721 // --------------------------------------------------------- |
|
722 // |
|
723 void CFMRadioFrequencyQueryControl::Draw(const TRect& /*aRect*/) const |
|
724 { |
|
725 CWindowGc& gc=SystemGc(); |
|
726 TRect rect(Rect()); |
|
727 |
|
728 TRect dialogRect(TPoint(0,0), iDialogSize ); |
|
729 rect.iBr.iY += dialogRect.iBr.iY; |
|
730 |
|
731 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
732 |
|
733 TRgb color; |
|
734 TInt error = AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG19 ); |
|
735 if ( !error ) |
|
736 { |
|
737 TRAP_IGNORE(AknLayoutUtils::OverrideControlColorL( *(CAknQueryControl*)this, EColorLabelText, color ) ); |
|
738 } |
|
739 |
|
740 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
741 AknsDrawUtils::Background( skin, cc, this, gc, rect ); |
|
742 DrawFrequencyEditorFrame(gc,rect); |
|
743 } |
|
744 |
|
745 /** |
|
746 * Draw frequency editor frame and shadow |
|
747 */ |
|
748 void CFMRadioFrequencyQueryControl::DrawFrequencyEditorFrame(CWindowGc& aGc,TRect& /*aRect*/) const |
|
749 { |
|
750 if (iHasEditor) |
|
751 { |
|
752 TBool skinnedDraw( EFalse ); |
|
753 skinnedDraw = AknsDrawUtils::Background( |
|
754 AknsUtils::SkinInstance(), |
|
755 iEditorContext, |
|
756 aGc, |
|
757 iEditorFrame.Rect() ); |
|
758 |
|
759 if( !skinnedDraw ) |
|
760 { |
|
761 iEditorFrame.DrawOutLineRect(aGc); |
|
762 iEditorVerShadow.DrawRect(aGc); |
|
763 iEditorHorShadow.DrawRect(aGc); |
|
764 } |
|
765 } |
|
766 } |
|
767 |
|
768 // --------------------------------------------------------- |
|
769 // CFMRadioFrequencyQueryControl::SizeChanged. |
|
770 // --------------------------------------------------------- |
|
771 // |
|
772 void CFMRadioFrequencyQueryControl::SizeChanged() |
|
773 { |
|
774 if (iMyPrompt) |
|
775 { |
|
776 iMyPrompt->SetRect(LayoutRect()); |
|
777 LayoutPrompt(ETimeQueryLayoutM); |
|
778 } |
|
779 if (iFreqEditor) |
|
780 { |
|
781 LayoutEditor(ETimeQueryLayoutM); |
|
782 } |
|
783 |
|
784 if( iHasEditor && iEditorContext ) |
|
785 { |
|
786 // Layout editor context |
|
787 TAknLayoutRect topLeft; |
|
788 TAknLayoutRect bottomRight; |
|
789 |
|
790 TAknWindowLineLayout lineLayout(SkinLayout::Input_field_skin_placing__general__Line_2()); |
|
791 topLeft.LayoutRect(iEditorFrame.Rect(), lineLayout ); |
|
792 bottomRight.LayoutRect(TRect(iEditorFrame.Rect().iBr, iEditorFrame.Rect().iBr), SkinLayout::Input_field_skin_placing__general__Line_5()); |
|
793 |
|
794 TRect outerRect = TRect(topLeft.Rect().iTl, bottomRight.Rect().iBr); |
|
795 TRect innerRect = TRect(topLeft.Rect().iBr, bottomRight.Rect().iTl); |
|
796 |
|
797 outerRect.iTl.iY -= KFMRadioEditorCustomInnerFrameSize; |
|
798 outerRect.iBr.iY += KFMRadioEditorCustomInnerFrameSize; |
|
799 |
|
800 innerRect.iTl.iY -= KFMRadioEditorCustomInnerFrameSize; |
|
801 innerRect.iBr.iY += KFMRadioEditorCustomInnerFrameSize; |
|
802 |
|
803 iEditorContext->SetFrameRects( outerRect, innerRect ); |
|
804 // Chain with the background (since the frame doesn't occupy the entire |
|
805 // layout and it may even be transparent) |
|
806 iEditorContext->SetParentContext( AknsDrawUtils::ControlContextOfParent( this ) ); |
|
807 |
|
808 if ( AknLayoutUtils::PenEnabled() ) |
|
809 { |
|
810 if ( !iIncreaseValueButton ) |
|
811 { |
|
812 TRAPD( err, iIncreaseValueButton = |
|
813 CAknButton::NewL(KAvkonBitmapFile, |
|
814 EMbmAvkonQgn_indi_button_increase, |
|
815 EMbmAvkonQgn_indi_button_increase_mask, |
|
816 -1, |
|
817 -1, |
|
818 EMbmAvkonQgn_indi_button_increase_pressed, |
|
819 EMbmAvkonQgn_indi_button_increase_pressed_mask, |
|
820 -1, |
|
821 -1, |
|
822 KNullDesC, |
|
823 KNullDesC, |
|
824 KAknButtonNoFrame | KAknButtonKeyRepeat | KAknButtonReportOnLongPress, |
|
825 0, |
|
826 KAknsIIDQgnIndiButtonIncrease, |
|
827 KAknsIIDNone, |
|
828 KAknsIIDQgnIndiButtonIncreasePressed, |
|
829 KAknsIIDNone ); |
|
830 iIncreaseValueButton->SetContainerWindowL(*this); |
|
831 ); |
|
832 |
|
833 if ( err == KErrNone ) |
|
834 { |
|
835 iIncreaseValueButton->SetParent(this); |
|
836 iIncreaseValueButton->SetObserver(this); |
|
837 iIncreaseValueButton->MakeVisible(ETrue); |
|
838 iIncreaseValueButton->SetFocusing(EFalse); |
|
839 iIncreaseValueButton->SetKeyRepeatInterval( KFMRadioButtonRepeatDelay, KFMRadioButtonRepeatInterval ); |
|
840 iIncreaseValueButton->SetLongPressInterval( KFMRadioButtonLongPressDelay ); |
|
841 } |
|
842 } |
|
843 |
|
844 if ( !iDecreaseValueButton ) |
|
845 { |
|
846 TRAPD( err, iDecreaseValueButton = CAknButton::NewL(KAvkonBitmapFile, |
|
847 EMbmAvkonQgn_indi_button_decrease, |
|
848 EMbmAvkonQgn_indi_button_decrease_mask, |
|
849 -1, |
|
850 -1, |
|
851 EMbmAvkonQgn_indi_button_decrease_pressed, |
|
852 EMbmAvkonQgn_indi_button_decrease_pressed_mask, |
|
853 -1, |
|
854 -1, |
|
855 KNullDesC, |
|
856 KNullDesC, |
|
857 KAknButtonNoFrame | KAknButtonKeyRepeat | KAknButtonReportOnLongPress, |
|
858 0, |
|
859 KAknsIIDQgnIndiButtonDecrease, |
|
860 KAknsIIDNone, |
|
861 KAknsIIDQgnIndiButtonDecreasePressed, |
|
862 KAknsIIDNone ); |
|
863 iDecreaseValueButton->SetContainerWindowL(*this); |
|
864 ); |
|
865 |
|
866 if ( err == KErrNone ) |
|
867 { |
|
868 iDecreaseValueButton->SetParent(this); |
|
869 iDecreaseValueButton->SetObserver(this); |
|
870 iDecreaseValueButton->MakeVisible(ETrue); |
|
871 iDecreaseValueButton->SetFocusing(EFalse); |
|
872 iDecreaseValueButton->SetKeyRepeatInterval( KFMRadioButtonRepeatDelay, KFMRadioButtonRepeatInterval ); |
|
873 iDecreaseValueButton->SetLongPressInterval( KFMRadioButtonLongPressDelay ); |
|
874 } |
|
875 } |
|
876 // Position the buttons according to LAF |
|
877 |
|
878 TIndex LAFIndex(NbrOfPromptLines()); |
|
879 TInt variety( 5 - LAFIndex.PQCWindow() ); |
|
880 |
|
881 AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); |
|
882 TInt offset = 0; |
|
883 if (cbaLocation == AknLayoutUtils::EAknCbaLocationRight) |
|
884 { |
|
885 offset = 3; |
|
886 } |
|
887 else if (cbaLocation == AknLayoutUtils::EAknCbaLocationLeft) |
|
888 { |
|
889 offset = 6; |
|
890 } |
|
891 variety += offset; |
|
892 |
|
893 TAknWindowComponentLayout btnSpaceLayout; |
|
894 |
|
895 btnSpaceLayout = AknLayoutScalable_Avkon::button_value_adjust_pane( variety ); |
|
896 |
|
897 if ( iIncreaseValueButton ) |
|
898 { |
|
899 TAknWindowLineLayout buttonIncr = TAknWindowComponentLayout::Compose( |
|
900 btnSpaceLayout, |
|
901 AknLayoutScalable_Avkon::button_value_adjust_pane_g1()).LayoutLine(); |
|
902 |
|
903 TInt marginToNumberFrame = KEditorFrameCustomLRMargins - |
|
904 KFMRadioEditorCustomButtonMarginToLeftFrame - KFMRadioEditorCustomButtonSize; |
|
905 |
|
906 buttonIncr.ir += marginToNumberFrame; |
|
907 buttonIncr.iH += KFMRadioEditorCustomButtonSize; |
|
908 buttonIncr.iW += KFMRadioEditorCustomButtonSize; |
|
909 |
|
910 if ( KFMRadioFrequencyQueryDialogCustomAdditionHeight ) |
|
911 { |
|
912 buttonIncr.it = iDialogSize.iHeight / 2 - buttonIncr.iH; |
|
913 } |
|
914 |
|
915 TAknLayoutRect increaseValueButtonRect; |
|
916 increaseValueButtonRect.LayoutRect( LayoutRect(), buttonIncr ); |
|
917 iIncreaseValueButton->SetRect(increaseValueButtonRect.Rect()); |
|
918 } |
|
919 |
|
920 if ( iDecreaseValueButton) |
|
921 { |
|
922 TAknWindowLineLayout buttonDecr = TAknWindowComponentLayout::Compose( |
|
923 btnSpaceLayout, |
|
924 AknLayoutScalable_Avkon::button_value_adjust_pane_g2()).LayoutLine(); |
|
925 |
|
926 TInt marginToNumberFrame = KEditorFrameCustomLRMargins - |
|
927 KFMRadioEditorCustomButtonMarginToLeftFrame - KFMRadioEditorCustomButtonSize; |
|
928 |
|
929 buttonDecr.ir += marginToNumberFrame; |
|
930 buttonDecr.iH += KFMRadioEditorCustomButtonSize; |
|
931 buttonDecr.iW += KFMRadioEditorCustomButtonSize; |
|
932 |
|
933 if ( KFMRadioFrequencyQueryDialogCustomAdditionHeight ) |
|
934 { |
|
935 buttonDecr.it = iDialogSize.iHeight / 2; |
|
936 } |
|
937 TAknLayoutRect decreaseValueButtonRect; |
|
938 decreaseValueButtonRect.LayoutRect( LayoutRect(), buttonDecr ); |
|
939 iDecreaseValueButton->SetRect(decreaseValueButtonRect.Rect()); |
|
940 } |
|
941 } |
|
942 } |
|
943 } |
|
944 |
|
945 // --------------------------------------------------------- |
|
946 // CFMRadioFrequencyQueryControl::MopSupplyObject |
|
947 // --------------------------------------------------------- |
|
948 // |
|
949 TTypeUid::Ptr CFMRadioFrequencyQueryControl::MopSupplyObject(TTypeUid aId) |
|
950 { |
|
951 if( (aId.iUid == MAknsControlContext::ETypeId) && |
|
952 iEditorContext && iHasEditor ) |
|
953 { |
|
954 // Return specific context iff editor exists and the context |
|
955 // has been constructed. |
|
956 return MAknsControlContext::SupplyMopObject( |
|
957 aId, iEditorContext ); |
|
958 } |
|
959 |
|
960 if ( aId.iUid == CAknQueryControl::ETypeId ) |
|
961 { |
|
962 return aId.MakePtr( this ); |
|
963 } |
|
964 |
|
965 return SupplyMopObject(aId, iMyEditorIndicator); |
|
966 } |
|
967 |
|
968 // --------------------------------------------------------- |
|
969 // CFMRadioFrequencyQueryControl::WindowLayout |
|
970 // --------------------------------------------------------- |
|
971 // |
|
972 void CFMRadioFrequencyQueryControl::WindowLayout( TAknWindowLineLayout& aLayout ) const |
|
973 { |
|
974 TIndex LAFIndex(NbrOfPromptLines()); |
|
975 |
|
976 aLayout = AknLayoutScalable_Avkon::popup_query_code_window(LAFIndex.PQCWindow()); |
|
977 if( KFMRadioFrequencyQueryDialogCustomAdditionHeight ) |
|
978 { |
|
979 aLayout.iH += KFMRadioFrequencyQueryDialogCustomAdditionHeight; |
|
980 } |
|
981 } |
|
982 |
|
983 // --------------------------------------------------------- |
|
984 // CFMRadioFrequencyQueryControl::CanLeaveEditorL |
|
985 // --------------------------------------------------------- |
|
986 // |
|
987 TBool CFMRadioFrequencyQueryControl::CanLeaveEditorL() |
|
988 { |
|
989 FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyQueryControl::CanLeaveEditorL") ) ); |
|
990 |
|
991 if (iFreqEditor) |
|
992 { |
|
993 return iFreqEditor->CanLeaveEditorL(); |
|
994 } |
|
995 return ETrue; |
|
996 } |
|
997 |
|
998 |
|
999 /********************************* |
|
1000 * CFMRadioManualTuningEditorIndicator |
|
1001 *********************************/ |
|
1002 |
|
1003 CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator* CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::NewL(CCoeControl* aControl) |
|
1004 { |
|
1005 CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator* self = new(ELeave)CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator(); |
|
1006 CleanupStack::PushL(self); |
|
1007 self->ConstructL(aControl); |
|
1008 CleanupStack::Pop(self); |
|
1009 return self; |
|
1010 } |
|
1011 |
|
1012 CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::~CFMRadioManualTuningEditorIndicator() |
|
1013 { |
|
1014 } |
|
1015 |
|
1016 CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::CFMRadioManualTuningEditorIndicator() : CAknIndicatorContainer(CAknIndicatorContainer::EQueryEditorIndicators) |
|
1017 { |
|
1018 } |
|
1019 |
|
1020 void CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::ConstructL(CCoeControl* aControl) |
|
1021 { |
|
1022 CreateWindowL(aControl); |
|
1023 |
|
1024 TResourceReader reader; |
|
1025 iCoeEnv->CreateResourceReaderLC(reader, R_AVKON_NAVI_PANE_EDITOR_INDICATORS); |
|
1026 ConstructFromResourceL(reader); |
|
1027 CleanupStack::PopAndDestroy(); // resource reader |
|
1028 |
|
1029 SetExtent(TPoint(0,0), TSize(0,0)); |
|
1030 MakeVisible( EFalse ); |
|
1031 //ActivateL(); |
|
1032 } |
|
1033 |
|
1034 void CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::SetState(TAknEditingState aState) |
|
1035 { |
|
1036 FTRACE( FPrint( _L(" *** FM Radio -- CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::SetState (%d)"), (int)aState ) ); |
|
1037 if (AknLayoutUtils::Variant() == EEuropeanVariant) |
|
1038 { |
|
1039 SetIndicatorState(TUid::Uid(EAknNaviPaneEditorIndicatorNumberCase), (aState == ENumeric) ? EAknIndicatorStateOn : EAknIndicatorStateOff, EFalse); |
|
1040 SetIndicatorState(TUid::Uid(EAknNaviPaneEditorIndicatorArabicIndicNumberCase), (aState == EArabicIndicNumeric) ? EAknIndicatorStateOn : EAknIndicatorStateOff, EFalse); |
|
1041 SetIndicatorState(TUid::Uid(EAknNaviPaneEditorIndicatorQuery), (aState == EStateNone) ? EAknIndicatorStateOff : EAknIndicatorStateOn, EFalse); |
|
1042 } |
|
1043 else |
|
1044 { |
|
1045 SetIndicatorState(TUid::Uid(EAknNaviPaneEditorIndicatorNumberCase), (aState == ENumeric) ? EAknIndicatorStateOn : EAknIndicatorStateOff, EFalse); |
|
1046 SetIndicatorState(TUid::Uid(EAknNaviPaneEditorIndicatorQuery), (aState == EStateNone) ? EAknIndicatorStateOff : EAknIndicatorStateOn, EFalse); |
|
1047 } |
|
1048 |
|
1049 MakeVisible( EFalse ); |
|
1050 //DrawDeferred(); |
|
1051 } |
|
1052 |
|
1053 CAknIndicatorContainer* CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::IndicatorContainer() |
|
1054 { |
|
1055 return this; |
|
1056 } |
|
1057 |
|
1058 void CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::SetFlags(TBitFlags16 aFlags) |
|
1059 { |
|
1060 iBitFlags = aFlags; |
|
1061 } |
|
1062 |
|
1063 void CFMRadioFrequencyQueryControl::CFMRadioManualTuningEditorIndicator::Reserved_1() |
|
1064 { |
|
1065 } |
|
1066 |
|
1067 /***************************************************************** |
|
1068 * CFMRadioFrequencyQueryControl::TIndex |
|
1069 * |
|
1070 * Manage indexes into LAF tables |
|
1071 * |
|
1072 * PN stands for "Popup Note" |
|
1073 * |
|
1074 * PQD stands for "Popup Query Data' |
|
1075 * |
|
1076 * PQC stands for "Popup Query Code' |
|
1077 * |
|
1078 * 'DPQ' stands for "Data Query Popup" |
|
1079 ******************************************************************/ |
|
1080 |
|
1081 |
|
1082 CFMRadioFrequencyQueryControl::TIndex::TIndex(TInt aNumberOfPromptLines) |
|
1083 : iNumberOfPromptLines(aNumberOfPromptLines) |
|
1084 { |
|
1085 } |
|
1086 |
|
1087 /** |
|
1088 * Return index into LAF tables that depend directly on number of prompt lines, |
|
1089 * index is equal to number of prompt lines minus one unless there are no prompt |
|
1090 * lines in which case the index is zero |
|
1091 */ |
|
1092 TInt CFMRadioFrequencyQueryControl::TIndex::PromptLine() const |
|
1093 { |
|
1094 return iNumberOfPromptLines > 0 ? iNumberOfPromptLines - 1 : 0; |
|
1095 } |
|
1096 |
|
1097 /** |
|
1098 * Return index into Main Pane PQDC Window, which |
|
1099 * depends on total number of prompt lines minus 2, e.g. |
|
1100 * index 0 for 2 prompt lines total. |
|
1101 * |
|
1102 */ |
|
1103 TInt CFMRadioFrequencyQueryControl::TIndex::DQPWindowTextsLine2(TInt aLineNum) const |
|
1104 { |
|
1105 static const TInt KDataQueryPopupWindowTextsLine2Index[3][5] = |
|
1106 { {0, 1, 2, 3, 4}, //1 PROMPT LINE |
|
1107 {5, 6, 7, 8, 9}, //2 PROMPT LINES |
|
1108 {10, 10, 10, 10, 10} }; //3 PROMPT LINES |
|
1109 |
|
1110 return KDataQueryPopupWindowTextsLine2Index[PromptLine()][aLineNum-1]; |
|
1111 } |
|
1112 |
|
1113 TInt CFMRadioFrequencyQueryControl::TIndex::PNWindow() const |
|
1114 { |
|
1115 static const TInt KPopupNoteWindowIndex[5] = { 0,0,0,1,2 }; |
|
1116 |
|
1117 AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); |
|
1118 if (cbaLocation == AknLayoutUtils::EAknCbaLocationRight) |
|
1119 { |
|
1120 // variety numbers for right CBA are 3,4 and 5 |
|
1121 return (KPopupNoteWindowIndex[PromptLine()] + 3); |
|
1122 } |
|
1123 else if (cbaLocation == AknLayoutUtils::EAknCbaLocationLeft) |
|
1124 { |
|
1125 /// variety numbers for left CBA are 6,7 and 8 |
|
1126 return (KPopupNoteWindowIndex[PromptLine()] + 6); |
|
1127 } |
|
1128 else // bottom |
|
1129 { |
|
1130 return KPopupNoteWindowIndex[PromptLine()]; |
|
1131 } |
|
1132 } |
|
1133 |
|
1134 TInt CFMRadioFrequencyQueryControl::TIndex::PQDWindow(TInt aLineNum) const |
|
1135 { |
|
1136 AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); |
|
1137 |
|
1138 if (cbaLocation == AknLayoutUtils::EAknCbaLocationRight) |
|
1139 { |
|
1140 static const TInt KPopupQueryDataWindowIndex[7] = |
|
1141 {13, 12, 11, 10, 9, 8, 7}; // variety numbers for right CBA are 7-13 |
|
1142 return KPopupQueryDataWindowIndex[PromptLine()+aLineNum-1]; |
|
1143 } |
|
1144 else if (cbaLocation == AknLayoutUtils::EAknCbaLocationLeft) |
|
1145 { |
|
1146 static const TInt KPopupQueryDataWindowIndex[7] = |
|
1147 {20, 19, 18, 17, 16, 15, 14}; // variety numbers for left CBA are 14-20 |
|
1148 return KPopupQueryDataWindowIndex[PromptLine()+aLineNum-1]; |
|
1149 } |
|
1150 else // bottom |
|
1151 { |
|
1152 static const TInt KPopupQueryDataWindowIndex[7] = |
|
1153 {0, 1, 2, 3, 4, 5, 6}; // variety numbers for bottom CBA are 0-6 |
|
1154 return KPopupQueryDataWindowIndex[PromptLine()+aLineNum-1]; |
|
1155 } |
|
1156 } |
|
1157 |
|
1158 TInt CFMRadioFrequencyQueryControl::TIndex::PQCWindow() const |
|
1159 { |
|
1160 AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); |
|
1161 |
|
1162 if (cbaLocation == AknLayoutUtils::EAknCbaLocationRight) |
|
1163 { |
|
1164 // variety numbers for right CBA are 3,4 and 5 |
|
1165 return iNumberOfPromptLines > 0 ? (iNumberOfPromptLines - 1 + 3) : 3; |
|
1166 } |
|
1167 else if (cbaLocation == AknLayoutUtils::EAknCbaLocationLeft) |
|
1168 { |
|
1169 // variety numbers for left CBA are 6,7 and 8 |
|
1170 return iNumberOfPromptLines > 0 ? (iNumberOfPromptLines - 1 + 6) : 6; |
|
1171 } |
|
1172 else // bottom |
|
1173 { |
|
1174 // variety numbers for bottom CBA are 0,1 and 2 |
|
1175 return iNumberOfPromptLines > 0 ? (iNumberOfPromptLines - 1) : 0; |
|
1176 } |
|
1177 } |
|
1178 |
|
1179 // --------------------------------------------------------- |
|
1180 // CFMRadioFrequencyQueryControl::HandlePointerEventL |
|
1181 // --------------------------------------------------------- |
|
1182 // |
|
1183 void CFMRadioFrequencyQueryControl::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
1184 { |
|
1185 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
1186 iFreqEditor->HandlePointerEventL( aPointerEvent ); |
|
1187 } |
|
1188 |
|
1189 // End of File |
|