phoneuis/easydialing/src/easydialinglistbox.cpp
branchRCL_3
changeset 19 544e34b3255a
parent 17 38529f706030
child 34 b68fcd923911
equal deleted inserted replaced
17:38529f706030 19:544e34b3255a
    32 #include <phonebook2.mbg>
    32 #include <phonebook2.mbg>
    33 #include <phonebook2ece.mbg>
    33 #include <phonebook2ece.mbg>
    34 
    34 
    35 #include <ccappcommlauncherpluginrsc.rsg>
    35 #include <ccappcommlauncherpluginrsc.rsg>
    36 
    36 
    37 // AvKON and drawing header files
       
    38 
       
    39 #include <aknpointereventsuppressor.h> 
       
    40 #include <aknlongtapdetector.h> // Required for touch
    37 #include <aknlongtapdetector.h> // Required for touch
    41 #include <AknsFrameBackgroundControlContext.h>
    38 #include <AknsFrameBackgroundControlContext.h>
    42 #include <AknInfoPopupNoteController.h>  // tooltips
       
    43 
    39 
    44 #include <aknlayoutscalable_apps.cdl.h>
    40 #include <aknlayoutscalable_apps.cdl.h>
    45 #include <layoutmetadata.cdl.h>
    41 #include <layoutmetadata.cdl.h>
    46 #include <gulicon.h>
    42 #include <gulicon.h>
    47 #include <centralrepository.h>
    43 #include <centralrepository.h>
   168     {
   164     {
   169     if ( !IsFocused() )
   165     if ( !IsFocused() )
   170         {
   166         {
   171         CEasyDialingListBoxView* view = static_cast<CEasyDialingListBoxView*>( iView );
   167         CEasyDialingListBoxView* view = static_cast<CEasyDialingListBoxView*>( iView );
   172         view->SetCurrentItemIndexToNone();
   168         view->SetCurrentItemIndexToNone();
   173         
       
   174         // Invalidate window area. 
       
   175         // This fixes the drawing problem that the top 
       
   176         // of listbox is not always redrawn on the area that overlaps 
       
   177         // the status pane area. 
       
   178         // TODO: This overlapping no longer happens in 9.2 so this may
       
   179         // now be unnecessary.
       
   180         Window().Invalidate();
       
   181         }
   169         }
   182     CEikFormattedCellListBox::FocusChanged( aDrawNow );
   170     CEikFormattedCellListBox::FocusChanged( aDrawNow );
   183     }
   171     }
   184 
   172 
   185 
   173 
   275 // 
   263 // 
   276 // -----------------------------------------------------------------------------
   264 // -----------------------------------------------------------------------------
   277 //
   265 //
   278 void CEasyDialingListBox::SizeChanged()
   266 void CEasyDialingListBox::SizeChanged()
   279     {
   267     {
       
   268 	// Note that within this call view rect is adjusted to fit into TGulBorder
       
   269     // that could have been given in construction. It's not used by ED listbox.
       
   270     // The view rect is not correct for ED after this call but it's
       
   271     // calculated and set below.
   280     CEikFormattedCellListBox::SizeChanged();
   272     CEikFormattedCellListBox::SizeChanged();
   281     
   273     
   282     TRect parentRect = Rect();
   274     TRect parentRect = Rect();
   283     
   275     
   284     // Set the listbox colors.
   276     // Set the listbox colors.
   315         {
   307         {
   316         viewRect = viewAndScrollBarRect;
   308         viewRect = viewAndScrollBarRect;
   317         scrollBarRect.SetWidth( 0 );
   309         scrollBarRect.SetWidth( 0 );
   318         }
   310         }
   319 
   311 
   320     // Set view rect
   312     // Must use this method so that all eiklistbox's internal variables are 
   321     iView->SetViewRect( viewRect );
   313     // set and updated according to this viewRect. This call would
       
   314     // add list margins but no such are defined in layouts so view's rect is
       
   315     // set to viewRect calculated here.
       
   316     SetViewRectFromClientRect( viewRect );
   322     
   317     
   323     // Set scroll bar rect
   318     // Set scroll bar rect
   324     if ( iSBFrame )
   319     if ( iSBFrame )
   325         {
   320         {
   326         CAknDoubleSpanScrollBar* scrollbar = static_cast <CAknDoubleSpanScrollBar*>( iSBFrame->VerticalScrollBar() );
   321         CAknDoubleSpanScrollBar* scrollbar = static_cast <CAknDoubleSpanScrollBar*>( iSBFrame->VerticalScrollBar() );
   328         scrollbar->SetRect( scrollBarRect );
   323         scrollbar->SetRect( scrollBarRect );
   329         scrollbar->MakeVisible( scrollBarRect.Width() != 0 );
   324         scrollbar->MakeVisible( scrollBarRect.Width() != 0 );
   330         }
   325         }
   331 
   326 
   332     iBGContext->SetFrameRects( parentRect, viewAndScrollBarRect );
   327     iBGContext->SetFrameRects( parentRect, viewAndScrollBarRect );
       
   328     
       
   329     TRAP_IGNORE( CEikFormattedCellListBox::HandleViewRectSizeChangeL() );
   333     }
   330     }
   334 
   331 
   335 
   332 
   336 // -----------------------------------------------------------------------------
   333 // -----------------------------------------------------------------------------
   337 // MopSupplyObject
   334 // MopSupplyObject
   490         {
   487         {
   491         return KErrNotFound;
   488         return KErrNotFound;
   492         }
   489         }
   493     }
   490     }
   494 
   491 
       
   492 
   495 // -----------------------------------------------------------------------------
   493 // -----------------------------------------------------------------------------
   496 // CurrentContactLinkLC
   494 // CurrentContactLinkLC
   497 // 
   495 // 
   498 // -----------------------------------------------------------------------------
   496 // -----------------------------------------------------------------------------
   499 //
   497 //
   541 
   539 
   542     CEikFormattedCellListBox::HandlePointerEventL( aPointerEvent );
   540     CEikFormattedCellListBox::HandlePointerEventL( aPointerEvent );
   543     }
   541     }
   544 
   542 
   545 
   543 
       
   544 // -----------------------------------------------------------------------------
       
   545 // HandleScrollEventL
       
   546 // If the EasyDialingListBox is scrolled by dragging the Scroll bar, this
       
   547 // observer function is called
       
   548 // -----------------------------------------------------------------------------
       
   549 //
       
   550 void CEasyDialingListBox::HandleScrollEventL( CEikScrollBar* aScrollBar, TEikScrollEvent aEventType )
       
   551     {
       
   552     // Report scrolling to the listbox observer
       
   553     TInt scrollEvent( KErrNotFound );
       
   554     switch ( aEventType )
       
   555         {
       
   556         case EEikScrollThumbDragVert:
       
   557             scrollEvent = KEasyDialingScrollingStarted;
       
   558             break;
       
   559 
       
   560         case EEikScrollThumbReleaseVert:
       
   561         case EEikScrollUp:
       
   562         case EEikScrollDown:
       
   563         case EEikScrollPageUp:
       
   564         case EEikScrollPageDown:
       
   565             scrollEvent = KEasyDialingScrollingStopped;
       
   566             break;
       
   567             
       
   568         default:
       
   569             break;
       
   570         }
       
   571     
       
   572     if ( scrollEvent != KErrNotFound )
       
   573         {
       
   574         ReportListBoxEventL( static_cast<MEikListBoxObserver::TListBoxEvent>( scrollEvent ) );
       
   575         }
       
   576     
       
   577     // Base class(es) might be also interested about the scrollbar events
       
   578     CEikFormattedCellListBox::HandleScrollEventL( aScrollBar, aEventType );
       
   579     }
       
   580 
   546 // end of file
   581 // end of file
   547 
   582