application/src/PodcastListView.cpp
branchRCL_3
changeset 243 44d205147a83
parent 218 2fd795b1e1b1
child 307 baf7ea4347f9
equal deleted inserted replaced
236:f952f3a1a786 243:44d205147a83
    95         default:
    95         default:
    96             return NULL;
    96             return NULL;
    97         }
    97         }
    98     }
    98     }
    99 
    99 
   100 void CPodcastListContainer::SetLongTapDetectedL(TBool aLongTapDetected)
       
   101 	{
       
   102 	DP("CPodcastListContainer::SetLongTapDetectedL BEGIN");
       
   103 	iLongTapDetected = aLongTapDetected;
       
   104 	
       
   105 	if (aLongTapDetected == EFalse)
       
   106 		{
       
   107 		TPointerEvent event;
       
   108 		event.iType = TPointerEvent::EButton1Up;
       
   109 		//CCoeControl::HandlePointerEventL(event);
       
   110 		}
       
   111 	DP("CPodcastListContainer::SetLongTapDetectedL END");
       
   112 	}
       
   113 
       
   114 void CPodcastListContainer::HandleResourceChange(TInt aType)
   100 void CPodcastListContainer::HandleResourceChange(TInt aType)
   115 {
   101 {
   116 	switch( aType )
   102 	switch( aType )
   117     	{
   103     	{
   118 	    case KEikDynamicLayoutVariantSwitch:
   104 	    case KEikDynamicLayoutVariantSwitch:
   164     {
   150     {
   165       return MAknsControlContext::SupplyMopObject( aId, iBgContext );
   151       return MAknsControlContext::SupplyMopObject( aId, iBgContext );
   166     }
   152     }
   167     return CCoeControl::MopSupplyObject(aId);
   153     return CCoeControl::MopSupplyObject(aId);
   168     }
   154     }
   169 
       
   170 void CPodcastListContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent)
       
   171 	{
       
   172 	if (iPointerListener)
       
   173 		iPointerListener->PointerEventL(aPointerEvent);
       
   174 
       
   175 	// Call base class HandlePointerEventL() if not a long tap
       
   176 	if (!iLongTapDetected)
       
   177 		{
       
   178 		CCoeControl::HandlePointerEventL(aPointerEvent);
       
   179 		}
       
   180 	}
       
   181 
       
   182 
       
   183 void CPodcastListContainer::SetPointerListener(MPointerListener *aPointerListener)
       
   184 	{
       
   185 	iPointerListener = aPointerListener;
       
   186 	}
       
   187 
       
   188 
   155 
   189 CPodcastListView::CPodcastListView()
   156 CPodcastListView::CPodcastListView()
   190 {
   157 {
   191 }
   158 }
   192 
   159 
   204 	if (Toolbar()) {
   171 	if (Toolbar()) {
   205 		iToolbar = Toolbar();
   172 		iToolbar = Toolbar();
   206 		iToolbar->SetToolbarObserver(this);
   173 		iToolbar->SetToolbarObserver(this);
   207 	}
   174 	}
   208 	
   175 	
   209 	iLongTapDetector = CAknLongTapDetector::NewL(this);
       
   210 	iListContainer->SetPointerListener(this);
       
   211 	iListContainer->SetKeyEventListener(this);
   176 	iListContainer->SetKeyEventListener(this);
   212         
   177         
   213 	DP("CPodcastListView::ConstructL END");
   178 	DP("CPodcastListView::ConstructL END");
   214 }
   179 }
   215 
   180 
   240     	AppUi()->RemoveFromStack(iListContainer);
   205     	AppUi()->RemoveFromStack(iListContainer);
   241     	delete iListContainer;
   206     	delete iListContainer;
   242     	}
   207     	}
   243          
   208          
   244     delete iItemArray;
   209     delete iItemArray;
   245     delete iLongTapDetector;
       
   246     iItemIdArray.Close();
   210     iItemIdArray.Close();
   247     }
   211     }
   248 
   212 
   249 	
   213 	
   250 void CPodcastListView::DoActivateL(const TVwsViewId& /*aPrevViewId */,
   214 void CPodcastListView::DoActivateL(const TVwsViewId& /*aPrevViewId */,
   374 		toolbarExtension->SetShown( EFalse );
   338 		toolbarExtension->SetShown( EFalse );
   375 		}
   339 		}
   376 	}
   340 	}
   377 }
   341 }
   378 
   342 
   379 void CPodcastListView::PointerEventL(const TPointerEvent& aPointerEvent)
       
   380 	{
       
   381 	//DP1("CPodcastListView::PointerEventL, iType=%d", aPointerEvent.iType);
       
   382 	// Pass the pointer event to Long tap detector component
       
   383 	iLongTapDetector->PointerEventL(aPointerEvent);
       
   384 	}
       
   385 
       
   386 
       
   387 void CPodcastListView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */)
       
   388 {
       
   389 	DP("CPodcastListView::HandleLongTapEventL BEGIN");
       
   390 	iListContainer->SetLongTapDetectedL(ETrue);
       
   391 	
       
   392 	const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1
       
   393 	TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems(
       
   394 			iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight;
       
   395 
       
   396     if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight)
       
   397     {
       
   398 		iStylusPopupMenu->ShowMenu();
       
   399 		iStylusPopupMenu->SetPosition(aPenEventLocation);
       
   400     }
       
   401     
       
   402 	DP("CPodcastListView::HandleLongTapEventL END");
       
   403 }
       
   404 
       
   405 
       
   406 void CPodcastListView::DynInitToolbarL (TInt /*aResourceId*/, CAknToolbar * /*aToolbar*/)
   343 void CPodcastListView::DynInitToolbarL (TInt /*aResourceId*/, CAknToolbar * /*aToolbar*/)
   407 	{
   344 	{
   408 	}
   345 	}
   409 
   346 
   410 
   347