webengine/osswebengine/WebKit/s60/plugins/PluginWin.cpp
changeset 13 10e98eab6f85
parent 8 7c90e6132015
child 16 a359256acfc6
equal deleted inserted replaced
8:7c90e6132015 13:10e98eab6f85
   225 // -----------------------------------------------------------------------------
   225 // -----------------------------------------------------------------------------
   226 //
   226 //
   227 void PluginWin::processEventL( TPluginEventType eventType,
   227 void PluginWin::processEventL( TPluginEventType eventType,
   228                                 TBool& consumed )
   228                                 TBool& consumed )
   229 {
   229 {
   230 	  CBrCtl*   brCtl = control(m_pluginskin->frame());
       
   231 	  WebView*  view = brCtl->webView();
       
   232     consumed = EFalse;
   230     consumed = EFalse;
   233 
   231 
   234     switch ( eventType ) {
   232     switch ( eventType ) {
   235         case EEventActivate:
   233         case EEventActivate:
   236                 if ( m_notifier )
   234                 if ( m_notifier )
   237                 {
   235                 {
   238                     TPoint pt = StaticObjectsContainer::instance()->webCursor()->position() - Position();
   236                     TPoint pt = StaticObjectsContainer::instance()->webCursor()->position() - Position();
   239                     m_notifier->NotifyL( MPluginNotifier::EPluginActivated, (void*) &pt );
   237                     m_notifier->NotifyL( MPluginNotifier::EPluginActivated, (void*) &pt );
   240                 }
   238                 }
   241             consumed = ETrue;
   239             consumed = ETrue;
   242             view->setPluginActivated(true);   //Setting pluginactivated flag in webview
       
   243             setPluginFocusL( ETrue );
   240             setPluginFocusL( ETrue );
   244         break;
   241         break;
   245 
   242 
   246         case EEventDeactivate:
   243         case EEventDeactivate:
   247                 if( m_notifier )
   244                 if( m_notifier )
   248                 {
   245                 {
   249                     m_notifier->NotifyL( MPluginNotifier::EPluginDeactivated, (void*) 0 );
   246                     m_notifier->NotifyL( MPluginNotifier::EPluginDeactivated, (void*) 0 );
   250                 }
   247                 }
   251             consumed = ETrue;
   248             consumed = ETrue;
   252             view->setPluginActivated(false);
       
   253             setPluginFocusL( EFalse );
   249             setPluginFocusL( EFalse );
   254         break;
   250         break;
   255 
   251 
   256         case EEventLoseFocus:
   252         case EEventLoseFocus:
   257         if ( m_notifier ) {
   253         if ( m_notifier ) {
   418 void PluginWin::HandleControlEventL( CCoeControl* /*aControl*/,
   414 void PluginWin::HandleControlEventL( CCoeControl* /*aControl*/,
   419                                       TCoeEvent /*aEventType*/ )
   415                                       TCoeEvent /*aEventType*/ )
   420 {
   416 {
   421 }
   417 }
   422 
   418 
   423 // -----------------------------------------------------------------------------
       
   424 // PluginWin::ViewFocusChanged
       
   425 //
       
   426 // Invoked by CCoeControl to WebKitView to PluginWin when the Browser focus
       
   427 // changes. This method notifies all plugins of thier current focus state.
       
   428 // NOTES:
       
   429 // iBrowserBackground means that the browser app is not top application,
       
   430 // such as when bookmarks, idle screen, or another app/view is in foreground.
       
   431 // aFocused is true if browser has focus and false if browser is out of focus
       
   432 // and a plugin has taken focus.
       
   433 // -----------------------------------------------------------------------------
       
   434 void PluginWin::viewFocusChanged( TBool focused )
       
   435 {
       
   436 if (m_notifier)
       
   437 		{
       
   438 		if (focused)
       
   439 			{
       
   440 			// The browser brings back the focus, and so are plugins.
       
   441 			    HandleGainingForeground();
       
   442 			}
       
   443 		else
       
   444 			{
       
   445 			// The browser doesn't have focus and this plugin focus state is...
       
   446 			if ( m_pluginfocus )
       
   447 				{
       
   448 				// This plugin is selected to be activate, so the focus is on this plugin now.
       
   449 				   HandleGainingForeground();
       
   450 				}
       
   451 			else
       
   452 				{
       
   453 				// The focus on the plugin is cancelled. This happens when deactivate the selected plugin
       
   454 				   HandleLosingForeground();
       
   455 				}
       
   456 			}
       
   457 		}
       
   458 }
       
   459 
   419 
   460 // -----------------------------------------------------------------------------
   420 // -----------------------------------------------------------------------------
   461 // PluginWin::SetPluginFocusL
   421 // PluginWin::SetPluginFocusL
   462 // Give or take focus from the plugin. The calls AddToStackL or RemoveFromStackL
   422 // Give or take focus from the plugin. The calls AddToStackL or RemoveFromStackL
   463 // will cause the CCoeControl architecture to call SetFocus, which will end up
   423 // will cause the CCoeControl architecture to call SetFocus, which will end up
   573         {
   533         {
   574         m_optionmenuhandler->HandlePluginCommandL(id);
   534         m_optionmenuhandler->HandlePluginCommandL(id);
   575         }
   535         }
   576     }
   536     }
   577 
   537 
   578 // -----------------------------------------------------------------------------
       
   579 // PluginWin::FocusChanged
       
   580 //
       
   581 // virtual function from CCoeControl for plugin win
       
   582 // -----------------------------------------------------------------------------
       
   583 //
       
   584 void PluginWin::FocusChanged(TDrawNow aDrawNow)
       
   585 {
       
   586     if(m_pluginfocus) {
       
   587         m_pluginskin->pluginFocusChanged(IsFocused());
       
   588     }
       
   589 }
       
   590 
   538 
   591 // -----------------------------------------------------------------------------
   539 // -----------------------------------------------------------------------------
   592 //
   540 //
   593 NPObject* PluginWin::windowScriptNPObject()
   541 NPObject* PluginWin::windowScriptNPObject()
   594     {
   542     {
   723         CWindowGc& gc = SystemGc();
   671         CWindowGc& gc = SystemGc();
   724         gc.BitBlt(Rect().iTl, m_bitmap);
   672         gc.BitBlt(Rect().iTl, m_bitmap);
   725     }
   673     }
   726 }
   674 }
   727 
   675 
   728 void PluginWin::TogleScreenMode(bool aFullScreen)
   676 void PluginWin::ToggleScreenMode(bool aFullScreen)
   729 {
   677 {
   730   m_fullscreen = aFullScreen;
   678   m_fullscreen = aFullScreen;
   731   CBrCtl*   brCtl = control(m_pluginskin->frame());
   679   CBrCtl*   brCtl = control(m_pluginskin->frame());
   732 
   680   WebCursor* cursor = StaticObjectsContainer::instance()->webCursor();
       
   681   
       
   682   cursor->cursorUpdate(!aFullScreen && !AknLayoutUtils::PenEnabled());
   733   StaticObjectsContainer::instance()->setPluginFullscreen(aFullScreen);
   683   StaticObjectsContainer::instance()->setPluginFullscreen(aFullScreen);
   734   brCtl->reportStateChanged(TBrCtlDefs::EStatePluginFullScreen, m_fullscreen);
   684   brCtl->reportStateChanged(TBrCtlDefs::EStatePluginFullScreen, m_fullscreen);
   735 }
   685 }
   736 void PluginWin::adaptiveZoom(const TPoint& aCurPosition)
   686 void PluginWin::adaptiveZoom(const TPoint& aCurPosition)
   737 {
   687 {