webengine/osswebengine/WebKit/s60/plugins/PluginWin.cpp
changeset 10 a359256acfc6
parent 5 10e98eab6f85
child 11 c8a366e56285
equal deleted inserted replaced
5:10e98eab6f85 10:a359256acfc6
   229 {
   229 {
   230     consumed = EFalse;
   230     consumed = EFalse;
   231 
   231 
   232     switch ( eventType ) {
   232     switch ( eventType ) {
   233         case EEventActivate:
   233         case EEventActivate:
   234                 if ( m_notifier )
   234         {
   235                 {
   235             WebCursor* cursor = StaticObjectsContainer::instance()->webCursor();
   236                     TPoint pt = StaticObjectsContainer::instance()->webCursor()->position() - Position();
   236             CBrCtl*   brCtl = control(m_pluginskin->frame());    
   237                     m_notifier->NotifyL( MPluginNotifier::EPluginActivated, (void*) &pt );
   237             WebView*  view = brCtl->webView();
       
   238 
       
   239             if ( m_notifier )
       
   240             {
       
   241             TPoint pt = TPoint(0,0); 
       
   242             if (cursor) {
       
   243                 pt = cursor->position() + view->PositionRelativeToScreen() - 
       
   244                         m_control->PositionRelativeToScreen();
   238                 }
   245                 }
       
   246             m_notifier->NotifyL( MPluginNotifier::EPluginActivated, (void*) &pt );
       
   247             cursor->cursorUpdate(EFalse);
   239             consumed = ETrue;
   248             consumed = ETrue;
   240             setPluginFocusL( ETrue );
   249             setPluginFocusL( ETrue );
   241         break;
   250             }
   242 
   251 
       
   252             else
       
   253             {
       
   254             m_pluginskin->frame()->frameView()->topView()->setFocusedElementType(TBrCtlDefs::EElementBrokenImage);
       
   255             cursor->cursorUpdate(ETrue);
       
   256             consumed = EFalse;     
       
   257             setPluginFocusL( EFalse );
       
   258             }
       
   259             break;
       
   260         }
   243         case EEventDeactivate:
   261         case EEventDeactivate:
   244                 if( m_notifier )
   262                 if( m_notifier )
   245                 {
   263                 {
   246                     m_notifier->NotifyL( MPluginNotifier::EPluginDeactivated, (void*) 0 );
   264                     m_notifier->NotifyL( MPluginNotifier::EPluginDeactivated, (void*) 0 );
   247                 }
   265                 }
   364         WebFrameView* fv = m_pluginskin->frame()->frameView();
   382         WebFrameView* fv = m_pluginskin->frame()->frameView();
   365         TRect rect(Rect());
   383         TRect rect(Rect());
   366         rect = TRect(fv->viewCoordsInFrameCoords(Rect().iTl), fv->viewCoordsInFrameCoords(Rect().iBr));
   384         rect = TRect(fv->viewCoordsInFrameCoords(Rect().iTl), fv->viewCoordsInFrameCoords(Rect().iBr));
   367         rect = fv->toViewCoords(rect);
   385         rect = fv->toViewCoords(rect);
   368         rect.SetSize(m_bitmap->SizeInPixels()); // toViewCoords sometimes grows the rect by 1, which wil cause the bitmap to not draw
   386         rect.SetSize(m_bitmap->SizeInPixels()); // toViewCoords sometimes grows the rect by 1, which wil cause the bitmap to not draw
   369         if (m_transparentPlugin) {
   387         bitmapContext.DrawBitmap(rect, m_bitmap, rect.Size());
   370             m_bitmapContextMask->SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   371             m_bitmapContextMask->SetPenStyle( CGraphicsContext::ESolidPen );
       
   372             m_bitmapContextMask->SetPenColor( TRgb( 30, 30, 30 ) );
       
   373             m_bitmapContextMask->SetBrushColor( TRgb( 30, 30, 30 ) );
       
   374             m_bitmapContextMask->DrawRect(m_mask->SizeInPixels() );
       
   375             bitmapContext.DrawBitmapMasked(rect, m_bitmap, rect.Size(), m_mask, true);
       
   376         }
       
   377         else {
       
   378             bitmapContext.DrawBitmap(rect, m_bitmap, rect.Size());
       
   379         }
       
   380     }
   388     }
   381     return KErrNone;
   389     return KErrNone;
   382 }
   390 }
   383 
   391 
   384 // -----------------------------------------------------------------------------
   392 // -----------------------------------------------------------------------------
   598 // -----------------------------------------------------------------------------
   606 // -----------------------------------------------------------------------------
   599 // CPluginWin::PluginDeactivate
   607 // CPluginWin::PluginDeactivate
   600 // Deactivate the plugin
   608 // Deactivate the plugin
   601 // -----------------------------------------------------------------------------
   609 // -----------------------------------------------------------------------------
   602 //
   610 //
   603 void PluginWin::pluginDeactivate()
   611 void PluginWin::pluginDeactivate(const TPoint& aPosition)
   604     {
   612 {
   605     m_pluginskin->deActivate();
   613     m_pluginskin->deActivate();
   606     }
   614     if (!m_pluginskin->isActive()) {
       
   615         CBrCtl*   brCtl = control(m_pluginskin->frame());
       
   616         WebView*  view = brCtl->webView();
       
   617         TPoint pos = aPosition + m_control->PositionRelativeToScreen() - 
       
   618                      view->PositionRelativeToScreen();
       
   619         WebCursor* cursor = StaticObjectsContainer::instance()->webCursor();
       
   620         TPoint offset = cursor->position() - pos;
       
   621         cursor->offsetCursor( offset );
       
   622         cursor->cursorUpdate(ETrue);        
       
   623     }
       
   624 }
   607 
   625 
   608 // -----------------------------------------------------------------------------
   626 // -----------------------------------------------------------------------------
   609 // CPluginWin::HitRegionContains
   627 // CPluginWin::HitRegionContains
   610 // -----------------------------------------------------------------------------
   628 // -----------------------------------------------------------------------------
   611 //
   629 //