equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
73 |
73 |
74 /** |
74 /** |
75 * Extension flags. |
75 * Extension flags. |
76 */ |
76 */ |
77 TBitFlags iFlags; |
77 TBitFlags iFlags; |
78 |
|
79 /** |
|
80 * Item that received pen down event |
|
81 */ |
|
82 TInt iPenDownOnItem; |
|
83 |
|
84 /** |
|
85 * Is selection valid |
|
86 */ |
|
87 TBool iIsValidSelection; |
|
88 |
|
89 }; |
78 }; |
90 // end of CAknRadioButtonSettingPageExtension class definition |
79 // end of CAknRadioButtonSettingPageExtension class definition |
91 |
80 |
92 |
81 |
93 CAknRadioButtonSettingPageExtension::CAknRadioButtonSettingPageExtension( |
82 CAknRadioButtonSettingPageExtension::CAknRadioButtonSettingPageExtension( |
94 CCoeControl& aOwner ) : |
83 CCoeControl& aOwner ) : |
95 iOldFocusedItemIndex( -1 ), |
84 iOldFocusedItemIndex(-1), iIsDragged( EFalse ) |
96 iIsDragged( EFalse ), |
|
97 iPenDownOnItem ( KErrNotFound ), |
|
98 iIsValidSelection( ETrue ) |
|
99 { |
85 { |
100 if ( static_cast<CAknAppUi*>( |
86 if ( static_cast<CAknAppUi*>( |
101 aOwner.ControlEnv()->AppUi() )->IsSingleClickCompatible() ) |
87 aOwner.ControlEnv()->AppUi() )->IsSingleClickCompatible() ) |
102 { |
88 { |
103 iFlags.Set( ESingleClickEnabled ); |
89 iFlags.Set( ESingleClickEnabled ); |
241 iExtension = new (ELeave) CAknRadioButtonSettingPageExtension( *this ); |
227 iExtension = new (ELeave) CAknRadioButtonSettingPageExtension( *this ); |
242 } |
228 } |
243 |
229 |
244 switch ( aEventType ) |
230 switch ( aEventType ) |
245 { |
231 { |
246 case MEikListBoxObserver::EEventPenDownOnItem: |
|
247 { |
|
248 if ( iExtension ) |
|
249 { |
|
250 iExtension->iPenDownOnItem = ListBoxControl()->CurrentItemIndex(); |
|
251 } |
|
252 break; |
|
253 } |
|
254 case MEikListBoxObserver::EEventItemSingleClicked: |
232 case MEikListBoxObserver::EEventItemSingleClicked: |
255 case MEikListBoxObserver::EEventItemDoubleClicked: |
233 case MEikListBoxObserver::EEventItemDoubleClicked: |
256 { |
234 { |
257 SelectCurrentItemL(); |
235 SelectCurrentItemL(); |
258 AttemptExitL( ETrue ); |
236 AttemptExitL( ETrue ); |
267 // it must be reverted back to represent the same item as |
245 // it must be reverted back to represent the same item as |
268 // the current selection in the setting page. |
246 // the current selection in the setting page. |
269 // Only in single click enabled applications. |
247 // Only in single click enabled applications. |
270 if ( iExtension && |
248 if ( iExtension && |
271 iExtension->iFlags.IsSet( |
249 iExtension->iFlags.IsSet( |
272 CAknRadioButtonSettingPageExtension::ESingleClickEnabled ) && |
250 CAknRadioButtonSettingPageExtension::ESingleClickEnabled ) ) |
273 iCurrentSelectionIndex >= 0 && |
|
274 iCurrentSelectionIndex < ListBoxControl()->Model()->NumberOfItems() ) |
|
275 { |
251 { |
276 ListBoxControl()->View()->SetCurrentItemIndex( |
252 ListBoxControl()->View()->SetCurrentItemIndex( |
277 iCurrentSelectionIndex ); |
253 iCurrentSelectionIndex ); |
278 } |
254 } |
279 break; |
255 break; |
307 view->SelectItemL( aPushed ); |
283 view->SelectItemL( aPushed ); |
308 } |
284 } |
309 } |
285 } |
310 |
286 |
311 EXPORT_C void CAknRadioButtonSettingPage::SelectCurrentItemL() |
287 EXPORT_C void CAknRadioButtonSettingPage::SelectCurrentItemL() |
312 { |
288 { |
313 if ( ListBoxControl()->IsHighlightEnabled() || |
289 iCurrentSelectionIndex = ListBoxControl()->CurrentItemIndex(); |
314 ( iExtension && iExtension->iIsValidSelection ) ) |
|
315 { |
|
316 iCurrentSelectionIndex = ListBoxControl()->CurrentItemIndex(); |
|
317 } |
|
318 else |
|
319 { |
|
320 ListBoxControl()->SetCurrentItemIndex ( iCurrentSelectionIndex ); |
|
321 } |
|
322 |
|
323 SetRadioButtonSelectionL( iCurrentSelectionIndex ); |
290 SetRadioButtonSelectionL( iCurrentSelectionIndex ); |
324 UpdateSettingL(); |
291 UpdateSettingL(); |
325 if( iSettingPageObserver ) |
292 if( iSettingPageObserver ) |
326 iSettingPageObserver->HandleSettingPageEventL(this, MAknSettingPageObserver::EEventSettingChanged); |
293 iSettingPageObserver->HandleSettingPageEventL(this, MAknSettingPageObserver::EEventSettingChanged); |
327 } |
294 } |
485 EXPORT_C void CAknRadioButtonSettingPage::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
452 EXPORT_C void CAknRadioButtonSettingPage::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
486 { |
453 { |
487 TPointerEvent& event = const_cast<TPointerEvent&>( aPointerEvent ); |
454 TPointerEvent& event = const_cast<TPointerEvent&>( aPointerEvent ); |
488 event.iModifiers &= ~EModifierShift; |
455 event.iModifiers &= ~EModifierShift; |
489 event.iModifiers &= ~EModifierCtrl; |
456 event.iModifiers &= ~EModifierCtrl; |
490 |
457 |
491 if ( iExtension ) |
|
492 { |
|
493 TInt index ( KErrNotFound ); |
|
494 ListBoxControl()->View()->XYPosToItemIndex( |
|
495 aPointerEvent.iPosition, index ); |
|
496 if ( index == iExtension->iPenDownOnItem |
|
497 && iExtension->iPenDownOnItem != KErrNotFound ) |
|
498 { |
|
499 iExtension->iIsValidSelection = ETrue; |
|
500 } |
|
501 else |
|
502 { |
|
503 iExtension->iIsValidSelection = EFalse; |
|
504 } |
|
505 } |
|
506 CAknListBoxSettingPage::HandlePointerEventL( aPointerEvent ); |
458 CAknListBoxSettingPage::HandlePointerEventL( aPointerEvent ); |
507 } |
459 } |
508 |
460 |
509 EXPORT_C void* CAknRadioButtonSettingPage::ExtensionInterface( TUid /*aInterface*/ ) |
461 EXPORT_C void* CAknRadioButtonSettingPage::ExtensionInterface( TUid /*aInterface*/ ) |
510 { |
462 { |
523 * Setting Page reserved methods |
475 * Setting Page reserved methods |
524 */ |
476 */ |
525 EXPORT_C void CAknRadioButtonSettingPage::HandleResourceChange(TInt aType) |
477 EXPORT_C void CAknRadioButtonSettingPage::HandleResourceChange(TInt aType) |
526 { |
478 { |
527 if( aType == KAknsMessageSkinChange ) |
479 if( aType == KAknsMessageSkinChange ) |
528 { |
480 { |
529 TRAP_IGNORE( InitialiseRadioButtonBitmapsL() ); |
481 TRAP_IGNORE( InitialiseRadioButtonBitmapsL() ); |
530 } |
482 } |
531 else if( aType == KEikMessageFadeAllWindows ) |
483 |
532 { |
|
533 if ( iExtension ) |
|
534 { |
|
535 iExtension->iIsValidSelection = EFalse; |
|
536 } |
|
537 } |
|
538 CAknListBoxSettingPage::HandleResourceChange(aType); |
484 CAknListBoxSettingPage::HandleResourceChange(aType); |
539 } |
485 } |
540 |
486 |
541 EXPORT_C void CAknRadioButtonSettingPage::CAknSettingPage_Reserved_1() |
487 EXPORT_C void CAknRadioButtonSettingPage::CAknSettingPage_Reserved_1() |
542 { |
488 { |
550 */ |
496 */ |
551 EXPORT_C void CAknRadioButtonSettingPage::CAknListBoxSettingPage_Reserved_1() |
497 EXPORT_C void CAknRadioButtonSettingPage::CAknListBoxSettingPage_Reserved_1() |
552 { |
498 { |
553 } |
499 } |
554 |
500 |
555 //--------------------------------------------------------------------------------------- |
|
556 // CAknRadioButtonSettingPage::ProcessCommandL() |
|
557 // Processes events from the softkeys. (Or translated from key events) |
|
558 //--------------------------------------------------------------------------------------- |
|
559 // |
|
560 EXPORT_C void CAknRadioButtonSettingPage::ProcessCommandL( TInt aCommandId ) |
|
561 { |
|
562 if ( !EnableSingleClickHighlight( aCommandId ) ) |
|
563 { |
|
564 // no single click mode was enabled, just call the base class method |
|
565 CAknSettingPage::ProcessCommandL( aCommandId ); |
|
566 } |
|
567 } |
|
568 |
|
569 // End of File |
501 // End of File |